From 4bd455f45a5d27e7a9057e5c7362b274c8000b9c Mon Sep 17 00:00:00 2001 From: Rafael Laboissiere Date: Fri, 12 Jul 2019 20:10:41 -0300 Subject: Import fim_0.5.3.orig.tar.gz [dgit import orig fim_0.5.3.orig.tar.gz] --- AUTHORS | 7 + BUGS | 124 + COPYING | 340 + ChangeLog | 3822 ++ FAQ.TXT | 11 + INSTALL | 370 + Makefile.am | 218 + Makefile.in | 1059 + NEWS | 239 + README | 462 + README.FIRST | 70 + THANKS | 8 + TODO | 504 + VERSION | 1 + aclocal.m4 | 1171 + autogen.sh | 26 + config.h.in | 576 + configure | 14017 +++++ configure.ac | 1951 + depcomp | 464 + distros/Makefile.am | 36 + distros/Makefile.in | 628 + doc/FIM.TXT | 1606 + doc/FIM.html | 1584 + doc/Makefile.am | 41 + doc/Makefile.in | 620 + doc/doctags.c | 83 + doc/fim-stylesheet.css | 23 + doc/fim.man | 515 + doc/fim.man.html | 1132 + doc/fimgs.man | 38 + doc/fimgs.man.html | 144 + doc/fimrc.man | 1418 + doc/fimrc.man.html | 1736 + doc/vim2html.pl | 231 + install-sh | 527 + media/fim.png | Bin 0 -> 8315 bytes media/image.jpg | Bin 0 -> 2136 bytes media/image.png | Bin 0 -> 2646 bytes missing | 331 + scripts/Makefile.am | 23 + scripts/Makefile.in | 620 + scripts/example/oneline.fim | 18 + scripts/maintenance/configure-brute-check.sh | 35 + scripts/maintenance/configure-live.sh | 6 + scripts/maintenance/configure-minimal.sh | 9 + scripts/maintenance/configure-noscripting.sh | 5 + scripts/maintenance/configure-only-fb-mini.sh | 6 + scripts/maintenance/cron-build.sh.in | 109 + scripts/maintenance/cron-rsync.sh.in | 25 + scripts/maintenance/cron-svndump.pl.in | 31 + scripts/maintenance/htmlbody.awk | 9 + scripts/maintenance/remote-build.sh.in | 28 + scripts/maintenance/yacc2grammar.awk | 10 + scripts/maintenance/yacc2grammar.h | 16 + scripts/rc/fimrc.eog | 16 + scripts/rc/fimrc.gqview | 138 + scripts/rc/fimrc.kuickshow | 12 + scripts/rc/fimrc.lazy | 28 + scripts/tests/font.sh | 49 + scripts/tests/maxlenscript.fim | 65402 ++++++++++++++++++++++++ scripts/tests/sanity.fim | 145 + scripts/tests/version.sh | 36 + scripts/utilities/fimscan.sh | 51 + scripts/utilities/screenshot.sh | 46 + src/AADevice.cpp | 675 + src/AADevice.h | 100 + src/Arg.cpp | 30 + src/Arg.h | 41 + src/Benchmarkable.h | 38 + src/Browser.cpp | 2044 + src/Browser.h | 178 + src/CACADevice.cpp | 371 + src/CACADevice.h | 88 + src/Cache.cpp | 795 + src/Cache.h | 132 + src/Command.cpp | 25 + src/Command.h | 88 + src/CommandConsole-cmd.cpp | 914 + src/CommandConsole-help.cpp | 236 + src/CommandConsole-init.cpp | 470 + src/CommandConsole-var.cpp | 252 + src/CommandConsole.cpp | 2476 + src/CommandConsole.h | 398 + src/DebugConsole.cpp | 488 + src/DebugConsole.h | 106 + src/DisplayDevice.cpp | 288 + src/DisplayDevice.h | 109 + src/DummyDisplayDevice.h | 68 + src/FbiStuff.cpp | 2465 + src/FbiStuff.h | 109 + src/FbiStuffBit1.cpp | 162 + src/FbiStuffBit24.cpp | 141 + src/FbiStuffBmp.cpp | 260 + src/FbiStuffDjvu.cpp | 221 + src/FbiStuffFbtools.cpp | 90 + src/FbiStuffFbtools.h | 42 + src/FbiStuffGif.cpp | 314 + src/FbiStuffJasPer.cpp | 297 + src/FbiStuffJpeg.cpp | 657 + src/FbiStuffList.h | 210 + src/FbiStuffLoader.cpp | 197 + src/FbiStuffLoader.h | 168 + src/FbiStuffMagick.cpp | 185 + src/FbiStuffMatrixMarket.cpp | 157 + src/FbiStuffPcx.cpp | 717 + src/FbiStuffPdf.cpp | 295 + src/FbiStuffPng.cpp | 366 + src/FbiStuffPpm.cpp | 205 + src/FbiStuffPs.cpp | 215 + src/FbiStuffText.cpp | 215 + src/FbiStuffTiff.cpp | 294 + src/FbiStuffXyz.cpp | 222 + src/FimWindow.cpp | 1302 + src/FimWindow.h | 239 + src/FontServer.cpp | 351 + src/FontServer.h | 135 + src/FramebufferDevice.cpp | 1929 + src/FramebufferDevice.h | 544 + src/Image.cpp | 1456 + src/Image.h | 392 + src/Imlib2Device.cpp | 654 + src/Imlib2Device.h | 108 + src/Makefile.am | 210 + src/Makefile.in | 1246 + src/Namespace.cpp | 230 + src/Namespace.h | 87 + src/SDLDevice.cpp | 1130 + src/SDLDevice.h | 110 + src/Var.cpp | 83 + src/Var.h | 302 + src/Viewport.cpp | 1017 + src/Viewport.h | 132 + src/b2ba.c | 30 + src/common.cpp | 1019 + src/common.h | 115 + src/defaultConfiguration.cpp | 166 + src/default_font_byte_array.h | 349 + src/default_icon_byte_array.h | 91 + src/examples.h | 20 + src/fim.cpp | 1669 + src/fim.h | 936 + src/fim_limits.h | 37 + src/fim_plugin.cpp | 164 + src/fim_plugin.h | 29 + src/fim_stream.cpp | 97 + src/fim_stream.h | 56 + src/fim_string.cpp | 618 + src/fim_string.h | 156 + src/fim_types.h | 90 + src/fim_wrappers.h | 34 + src/fimgs | 319 + src/fimrc | 302 + src/grammar.h | 81 + src/help-acm.cpp | 5 + src/help.cpp | 112 + src/interpreter.cpp | 484 + src/lex.h | 63 + src/lex.lex | 241 + src/readline.cpp | 477 + src/readline.h | 41 + src/regex.c | 5758 +++ src/testdir/Makefile | 45 + src/testdir/test1.in | 37 + src/testdir/test1.ok | 11 + src/testdir/test10.in | 23 + src/testdir/test10.ok | 11 + src/testdir/test11.in | 8 + src/testdir/test11.ok | 3 + src/testdir/test12.in | 27 + src/testdir/test12.ok | 6 + src/testdir/test13.in | 7 + src/testdir/test13.ok | 3 + src/testdir/test14.in | 8 + src/testdir/test14.ok | 11 + src/testdir/test15.in | 8 + src/testdir/test15.ok | 2 + src/testdir/test16.in | 9 + src/testdir/test16.ok | 3 + src/testdir/test2.in | 29 + src/testdir/test2.ok | 9 + src/testdir/test3.in | 42 + src/testdir/test3.ok | 12 + src/testdir/test4.in | 15 + src/testdir/test4.ok | 5 + src/testdir/test5.in | 17 + src/testdir/test5.ok | 6 + src/testdir/test6.in | 22 + src/testdir/test6.ok | 5 + src/testdir/test7.in | 96 + src/testdir/test7.ok | 2 + src/testdir/test8.in | 98 + src/testdir/test8.ok | 80 + src/testdir/test9.in | 10 + src/testdir/test9.ok | 12 + src/testsuite/config/unix.exp | 18 + src/testsuite/fim.test/fim.exp | 18 + src/version.h | 85 + src/yacc.ypp | 482 + var/fonts/Lat15-Terminus16.psf | Bin 0 -> 5548 bytes 200 files changed, 148121 insertions(+) create mode 100644 AUTHORS create mode 100644 BUGS create mode 100644 COPYING create mode 100644 ChangeLog create mode 100644 FAQ.TXT create mode 100644 INSTALL create mode 100644 Makefile.am create mode 100644 Makefile.in create mode 100644 NEWS create mode 100644 README create mode 100644 README.FIRST create mode 100644 THANKS create mode 100644 TODO create mode 100644 VERSION create mode 100644 aclocal.m4 create mode 100755 autogen.sh create mode 100644 config.h.in create mode 100755 configure create mode 100644 configure.ac create mode 100644 depcomp create mode 100644 distros/Makefile.am create mode 100644 distros/Makefile.in create mode 100644 doc/FIM.TXT create mode 100644 doc/FIM.html create mode 100644 doc/Makefile.am create mode 100644 doc/Makefile.in create mode 100644 doc/doctags.c create mode 100644 doc/fim-stylesheet.css create mode 100644 doc/fim.man create mode 100644 doc/fim.man.html create mode 100644 doc/fimgs.man create mode 100644 doc/fimgs.man.html create mode 100644 doc/fimrc.man create mode 100644 doc/fimrc.man.html create mode 100755 doc/vim2html.pl create mode 100755 install-sh create mode 100644 media/fim.png create mode 100644 media/image.jpg create mode 100644 media/image.png create mode 100755 missing create mode 100644 scripts/Makefile.am create mode 100644 scripts/Makefile.in create mode 100644 scripts/example/oneline.fim create mode 100755 scripts/maintenance/configure-brute-check.sh create mode 100755 scripts/maintenance/configure-live.sh create mode 100755 scripts/maintenance/configure-minimal.sh create mode 100755 scripts/maintenance/configure-noscripting.sh create mode 100755 scripts/maintenance/configure-only-fb-mini.sh create mode 100755 scripts/maintenance/cron-build.sh.in create mode 100644 scripts/maintenance/cron-rsync.sh.in create mode 100644 scripts/maintenance/cron-svndump.pl.in create mode 100755 scripts/maintenance/htmlbody.awk create mode 100644 scripts/maintenance/remote-build.sh.in create mode 100755 scripts/maintenance/yacc2grammar.awk create mode 100644 scripts/maintenance/yacc2grammar.h create mode 100644 scripts/rc/fimrc.eog create mode 100644 scripts/rc/fimrc.gqview create mode 100644 scripts/rc/fimrc.kuickshow create mode 100644 scripts/rc/fimrc.lazy create mode 100755 scripts/tests/font.sh create mode 100644 scripts/tests/maxlenscript.fim create mode 100755 scripts/tests/sanity.fim create mode 100755 scripts/tests/version.sh create mode 100755 scripts/utilities/fimscan.sh create mode 100644 scripts/utilities/screenshot.sh create mode 100644 src/AADevice.cpp create mode 100644 src/AADevice.h create mode 100644 src/Arg.cpp create mode 100644 src/Arg.h create mode 100644 src/Benchmarkable.h create mode 100644 src/Browser.cpp create mode 100644 src/Browser.h create mode 100644 src/CACADevice.cpp create mode 100644 src/CACADevice.h create mode 100644 src/Cache.cpp create mode 100644 src/Cache.h create mode 100644 src/Command.cpp create mode 100644 src/Command.h create mode 100644 src/CommandConsole-cmd.cpp create mode 100644 src/CommandConsole-help.cpp create mode 100644 src/CommandConsole-init.cpp create mode 100644 src/CommandConsole-var.cpp create mode 100644 src/CommandConsole.cpp create mode 100644 src/CommandConsole.h create mode 100644 src/DebugConsole.cpp create mode 100644 src/DebugConsole.h create mode 100644 src/DisplayDevice.cpp create mode 100644 src/DisplayDevice.h create mode 100644 src/DummyDisplayDevice.h create mode 100644 src/FbiStuff.cpp create mode 100644 src/FbiStuff.h create mode 100644 src/FbiStuffBit1.cpp create mode 100644 src/FbiStuffBit24.cpp create mode 100644 src/FbiStuffBmp.cpp create mode 100644 src/FbiStuffDjvu.cpp create mode 100644 src/FbiStuffFbtools.cpp create mode 100644 src/FbiStuffFbtools.h create mode 100644 src/FbiStuffGif.cpp create mode 100644 src/FbiStuffJasPer.cpp create mode 100644 src/FbiStuffJpeg.cpp create mode 100644 src/FbiStuffList.h create mode 100644 src/FbiStuffLoader.cpp create mode 100644 src/FbiStuffLoader.h create mode 100644 src/FbiStuffMagick.cpp create mode 100644 src/FbiStuffMatrixMarket.cpp create mode 100644 src/FbiStuffPcx.cpp create mode 100644 src/FbiStuffPdf.cpp create mode 100644 src/FbiStuffPng.cpp create mode 100644 src/FbiStuffPpm.cpp create mode 100644 src/FbiStuffPs.cpp create mode 100644 src/FbiStuffText.cpp create mode 100644 src/FbiStuffTiff.cpp create mode 100644 src/FbiStuffXyz.cpp create mode 100644 src/FimWindow.cpp create mode 100644 src/FimWindow.h create mode 100644 src/FontServer.cpp create mode 100644 src/FontServer.h create mode 100644 src/FramebufferDevice.cpp create mode 100644 src/FramebufferDevice.h create mode 100644 src/Image.cpp create mode 100644 src/Image.h create mode 100644 src/Imlib2Device.cpp create mode 100644 src/Imlib2Device.h create mode 100644 src/Makefile.am create mode 100644 src/Makefile.in create mode 100644 src/Namespace.cpp create mode 100644 src/Namespace.h create mode 100644 src/SDLDevice.cpp create mode 100644 src/SDLDevice.h create mode 100644 src/Var.cpp create mode 100644 src/Var.h create mode 100644 src/Viewport.cpp create mode 100644 src/Viewport.h create mode 100644 src/b2ba.c create mode 100644 src/common.cpp create mode 100644 src/common.h create mode 100644 src/defaultConfiguration.cpp create mode 100644 src/default_font_byte_array.h create mode 100644 src/default_icon_byte_array.h create mode 100644 src/examples.h create mode 100644 src/fim.cpp create mode 100644 src/fim.h create mode 100644 src/fim_limits.h create mode 100644 src/fim_plugin.cpp create mode 100644 src/fim_plugin.h create mode 100644 src/fim_stream.cpp create mode 100644 src/fim_stream.h create mode 100644 src/fim_string.cpp create mode 100644 src/fim_string.h create mode 100644 src/fim_types.h create mode 100644 src/fim_wrappers.h create mode 100755 src/fimgs create mode 100644 src/fimrc create mode 100644 src/grammar.h create mode 100644 src/help-acm.cpp create mode 100644 src/help.cpp create mode 100644 src/interpreter.cpp create mode 100644 src/lex.h create mode 100644 src/lex.lex create mode 100644 src/readline.cpp create mode 100644 src/readline.h create mode 100644 src/regex.c create mode 100644 src/testdir/Makefile create mode 100644 src/testdir/test1.in create mode 100644 src/testdir/test1.ok create mode 100644 src/testdir/test10.in create mode 100644 src/testdir/test10.ok create mode 100644 src/testdir/test11.in create mode 100644 src/testdir/test11.ok create mode 100644 src/testdir/test12.in create mode 100644 src/testdir/test12.ok create mode 100644 src/testdir/test13.in create mode 100644 src/testdir/test13.ok create mode 100644 src/testdir/test14.in create mode 100644 src/testdir/test14.ok create mode 100644 src/testdir/test15.in create mode 100644 src/testdir/test15.ok create mode 100644 src/testdir/test16.in create mode 100644 src/testdir/test16.ok create mode 100644 src/testdir/test2.in create mode 100644 src/testdir/test2.ok create mode 100644 src/testdir/test3.in create mode 100644 src/testdir/test3.ok create mode 100644 src/testdir/test4.in create mode 100644 src/testdir/test4.ok create mode 100644 src/testdir/test5.in create mode 100644 src/testdir/test5.ok create mode 100644 src/testdir/test6.in create mode 100644 src/testdir/test6.ok create mode 100644 src/testdir/test7.in create mode 100644 src/testdir/test7.ok create mode 100644 src/testdir/test8.in create mode 100644 src/testdir/test8.ok create mode 100644 src/testdir/test9.in create mode 100644 src/testdir/test9.ok create mode 100644 src/testsuite/config/unix.exp create mode 100644 src/testsuite/fim.test/fim.exp create mode 100644 src/version.h create mode 100644 src/yacc.ypp create mode 100644 var/fonts/Lat15-Terminus16.psf diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..c7e0124 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,7 @@ +FIM - Fbi IMproved was conceived and coded by : + Michele Martone + +FIM extends the original code and functionality of : +FBI - FrameBuffer Image viewer, by + Gerd Knorr + diff --git a/BUGS b/BUGS new file mode 100644 index 0000000..64f1b30 --- /dev/null +++ b/BUGS @@ -0,0 +1,124 @@ +$LastChangedDate: 2015-01-31 17:25:11 +0100 (Sat, 31 Jan 2015) $ + +==== BUG REPORTING + +For sending a bug report, please drop me an email with a subject line beginning with '[FIM]'. +Contact information is in the doc/FIM.TXT file, or in the bottom of this file. + +Please DO NOT dare sending bug reports about installation unless you have read the INSTALL +file and you are sure all the dependencies on your system have been resolved. + +For example "[FIM] problems with resolution 457x3778" would be a good, informative +subject for me. + +When submitting a bug report, please follow the following rules: + + - be as much informative as possible when describing your experience. + - make a report about the current environment: + ( make ; make report ) 2>&1 | gzip > fim.`date +%Y%m%d%H%M`.log.gz + and send me the created .tgz file + - please give me information about the exact way you experienced the problem + - please give me information about the resolution/video mode you are working with; + from the bash shell, execute the following and send me the output: + ( for f in /sys/class/graphics/fb0/* ; do echo $f ; cat $f ; done ) + - please send me the config.log file, too (especially if it is a build bug). + it is of vital importance! + (the config.log file is created by the configure script when you run the ./configure script) + - if you are using an ad hoc method for installing (say, the ebuild for the Gentoo Linux ), + consider sending the logfile created and named in the error messages. + + +==== CORE DEBUGGING + + Consider debugging with gdb or letting me do this for you! + by running + + $ ulimit -S -c unlimited + + before Fim, in the case Fim should crash, it will generate a file called 'core'. + That file, if sent to me (but contact me before sending, because it could be big!), + will be helpful for debugging Fim and discover the causes of the crash. + + p.s.: please compile the code configuring in this way: + ( use ./configure --help='-O0 -ggdb' ) + and don't forget to send me the executable file, too :) + +==== CONTACT + +You can mail your report to dezperado_FOobAr_autistici_Baz_org, by replacing _FOobAr_ +with a '@' and _Baz_ with a '.'. + +==== KNOWN BUGS + +20150131 in aalib mode PageUp / PageDown do not seem to work. +20150123 + + When in framebuffer mode, never, for ANY reason, press C-z (^Z) with the + intention of putting fim in the background. It will blind your console and + allow only blind typing, which is a very dangerous situation! + +20110603 Window splitting is disabled. + +==== MINOR ISSUES + +20091208 if fim is configured to take input from piped xfig (as xfig-3.2.5b), it could be - passively - subject to + xfig's buffer overflow on files like: + 0 1 2 3 + 4 + 1 2 3 4 5 6 7 ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ + ( see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=559274 + and http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=5;filename=xfig_poc.f;att=1;bug=559274) + As long as xfig (fig2dev) is accessed through the popen() system call, there will be no harm to fim from xfig crash. +20091015 In 16 bit graphics mode, some lines which should be white actually look blue (seems not fim' fault; happens on both on ARM and x86) +20091013 fim -i < file.pdf # does not work +20091009 fim does not support 1,2,4 bit modes +20090328 problems with --std=c++98 in legacy src/FbiStuffJpeg.cpp code (now commented) +20070919 while command suffers from being not interruptible in some cases (when the image is small and not 'panable') +20070912 Debugging it with the framebuffer under gdb hangs the console (even with -p). +20070904 problems could occur with the commands giving output when no std::cout << "" is returned soon after (see Commandconsole.cpp mehods for this..) +20071128 tried: + Linux host 2.6.19-gentoo-r5 #1 SMP Mon Sep 24 15:08:36 CEST 2007 ppc 7447A, altivec supported PowerBook5,4 GNU/Linux + and gave problems with the PAGE_MASK macro, originally in /linux/include/asm-i386/page.h :) + +20080504 Seems like running the aalib driver under screen maps -3072 units down the arrow keys. + I do not see this problem in aalib under ssh. +20080127 Under screen, Fim behaves well but it doesn't handle well console switching: + after a console switch, it doesn't redraw the image if not triggered to do so. +20080106 keys 'Insert,Cancel' are not recognized in the commandline mode. + This issue will be fixed after the fbi core will be cleaned up and revised. +20070811 On CENTOS 64 bit, i reported linking problems : -ltermcap is required, too. + I Don't know exactly how to fix this issue. +2007* Bugs shared with fbi, not fully solved: + - do not switch console or interrupt the program while it is busy: it could hang your console + and force you to make tricks to get back the terminal (like typing blindly through consoles, + or trying to get to some X instance via ALT-F7-like sequences, or even restart the computer), + and blind typing could be dangerous, if you do now know what you are doing! + +==== OUTSTANDING FIXED ISSUES + +20110602 fim versions before svn version r373 segfault in 32 bit framebuffer mode, on 64 bit builds + +==== FIXED FBI/FBGS ORIGINATING BUGS + + Replaced popen with pipe calls : http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=422034, in rev. 213. + + Original typo in fbgsh : http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2006-3119 fixed following the + patch indicated on http://bugs.gentoo.org/show_bug.cgi?id=141684 : + + -gs -dSAVER -dNOPAUSE -dBATCH + +gs -dSAFER -dNOPAUSE -dBATCH + + It could let a PostScript file execute evil code, according to the advisory. + + +==== UNFIXED EXTERNALLY ORIGINATING BUGS + +20090329 On my debian box's aalib, the ASCII art driver leaks 224 bytes of memory. +Actually, it happens the same when compiling aalib-1.4.0's aafire.c program against debian aalib +and running it in console mode (no X). +After clean aalib recompilation, these problems vanish. + +==== SOLVED ISSUES + +20110712 in sdl (x11) mode, when fim is spawned in a non-terminal environment, the readline mode does not work in the proper way. detecting this situation may be helpful to disable the readline mode at all in these cases, until a readline-centric fix is found. (seems fixed with r688) + diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..6727098 --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..548c2a6 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,3822 @@ +2015-01-20 08:03 dezperado + + * NEWS, doc/fim.man, src/fim.cpp: added a --autowindow switch to + adapt window size to picture size. + +2015-01-19 22:02 dezperado + + * src/Browser.cpp: enforcing reorientation after before scaling. + +2015-01-19 20:21 dezperado + + * src/Browser.cpp, src/SDLDevice.cpp: on "display 'resize'", will + space for status line only if status line verbosity is on. + +2015-01-19 19:58 dezperado + + * src/SDLDevice.cpp: setting also resizeable window and mouse + pointer active as default for SDL. + +2015-01-19 19:34 dezperado + + * src/SDLDevice.cpp, src/fimrc: added a missing check after the SDL + window resize. + +2015-01-19 19:01 dezperado + + * NEWS, src/Browser.cpp, src/CommandConsole.cpp, src/SDLDevice.cpp, + src/fimrc: added a "display 'resize'" to resize the SDL window. + default SDL mode is windowed now. + default 'C-w' key will resize the SDL window to the original + image size. + default 'W' key will resize the SDL window to the image size. + if unspecified, the initial window size will be half of the + screen. + +2015-01-19 00:27 dezperado + + * NEWS, TODO, doc/fim.man, doc/fimrc.man, src/Browser.cpp, + src/Image.cpp, src/fim.cpp: --load-image-descriptions-file will + override the comment eventually directly read from the file. + +2015-01-18 23:45 dezperado + + * NEWS, src/Browser.cpp, src/Browser.h, src/CommandConsole.cpp, + src/fim.h, src/fimrc: when repeating searching with repeat_last, + will use last direction. + '?' key is now assigned to backward search. + default 'C-p' key is now assigned to repeat last backward search. + +2015-01-18 12:37 dezperado + + * src/readline.cpp: directing the output stream of readline to + /dev/null: it seems like for some reason rl_erase_empty_line + emits a newline after e.g.: ":". + +2015-01-18 11:53 dezperado + + * src/CommandConsole.cpp, src/SDLDevice.cpp: when dumping selected + filenames will not emit the first newline to stdout anymore, but + to stderr instead. + +2015-01-18 11:39 dezperado + + * src/Makefile.am, src/SDLDevice.cpp, + src/default_icon_byte_array.h: will display a (hardcoded) icon + when running in SDL mode. + +2015-01-18 09:31 dezperado + + * src/CommandConsole-cmd.cpp, src/CommandConsole.cpp, + src/CommandConsole.h, src/fim.h: avoiding command console buffer + pollution after a search. + +2015-01-18 00:58 dezperado + + * NEWS, doc/fimrc.man, src/CommandConsole-cmd.cpp, + src/CommandConsole.cpp, src/CommandConsole.h, src/fim.h: Added + the 'descload' command. + +2015-01-17 14:47 dezperado + + * NEWS, src/CommandConsole-init.cpp, src/CommandConsole.cpp, + src/readline.cpp, src/readline.h: overwriting rl_instream with a + bogus stream for the situations when no stdin causes readline() + to fail (e.g.: invoking fim from an X menu). + +2015-01-17 13:28 dezperado + + * src/CommandConsole.cpp: when attempting entering in command line + mode with no stdin (e.g. fim < /dev/null), instead of cowardly + exiting the program, just displaying a message. + +2015-01-17 11:27 dezperado + + * configure.ac, doc/fimrc.man, src/CACADevice.cpp, + src/CACADevice.h: resuscicated the partial libcaca driver based + device to compile. before making it working, shall migrate to the + 1.0 interface. + +2015-01-17 10:02 dezperado + + * NEWS, src/fimrc: key r is bound to 'rotate90', key R to + 'rotate270', both in trunk and 0.4. + +2015-01-17 09:22 dezperado + + * src/help.cpp: had forgotten one (this) line of text in the + previous commit. + +2015-01-17 09:21 dezperado + + * NEWS, doc/fimrc.man, src/Viewport.cpp, src/fim.h: added a + _comment_over_image variable and the capability of displaying + comment/description text over the image. + +2015-01-17 08:53 dezperado + + * NEWS, doc/fim.man, src/Image.h, src/fim.cpp: Added a + --image-descriptions-file-separator option to specify an + arbitrary separator character to --load-image-descriptions-file. + +2015-01-13 23:10 dezperado + + * doc/fim.man, src/Image.h, src/fim.cpp: added a + --read-from-stdin-elds option to allow endline delimiters + specification in the filenames text. + --load-image-descriptions-file will now associate to basename. + corresponding documentation updates. + +2015-01-13 22:13 dezperado + + * src/fim.cpp: replacing read_one_file_from_stdin with an enum. + +2014-12-11 00:10 dezperado + + * NEWS, doc/fim.man, doc/fimrc.man, src/Browser.cpp, + src/CommandConsole.cpp, src/fim.cpp, src/fim.h, src/help.cpp: + introduced --no-stat-push, which sets _preload_checks=0 before + files push'ing. + +2014-12-09 21:41 dezperado + + * NEWS, doc/fim.man, doc/fimrc.man, src/Browser.cpp, + src/common.cpp, src/common.h, src/fim.cpp, src/fim.h, src/fimrc, + src/help.cpp: stat() checking of files on load can be disabled + with _preload_checks. + commented out the still unused append_to_file function. + terminal clear term code (commented) for future use. + +2014-12-07 17:55 dezperado + + * src/Image.cpp: In a check to prevent the ? expando from working + in case of empty variable. + +2014-12-07 14:16 dezperado + + * NEWS, src/Image.cpp, src/fim.h: introduced special image variable + expandos. + +2014-12-07 13:17 dezperado + + * src/FbiStuff.cpp, src/FbiStuff.h, src/FbiStuffJpeg.cpp, + src/FbiStuffLoader.h, src/Image.cpp, src/fim.h: EXIF tags will + make it into the Image's Namespace. + +2014-12-06 13:48 dezperado + + * NEWS, src/Browser.cpp: a rudimentary mechanism for search (and + jump) on image descriptions. + +2014-12-06 13:10 dezperado + + * doc/fim.man, src/CommandConsole.h, src/fim.cpp: In the man file + will not indent anymore the long options. + +2014-12-06 12:58 dezperado + + * NEWS, doc/fim.man, src/CommandConsole.cpp, src/CommandConsole.h, + src/Image.cpp, src/Image.h, src/fim.cpp, src/fim.h: Implemented + an experimental --load-image-descriptions-file function. + +2014-12-04 18:46 dezperado + + * NEWS, doc/fimrc.man, src/Browser.cpp, src/CommandConsole.cpp, + src/CommandConsole.h, src/fim.h, src/fimrc, src/help.cpp: + introduced _re_search_opts to allow regexp searches on basename + (default) or full pathname. + +2014-12-04 18:34 dezperado + + * src/common.cpp: using strrchr in fim_basename_of(). + +2014-12-03 22:22 dezperado + + * NEWS, doc/fim.man, src/Browser.cpp, src/Browser.h, src/fim.cpp: + added --sort program switch; then --sort-basename and its + internal "sort 'b'". + +2014-11-30 18:19 dezperado + + * README, var/Makefile, var/index.html.in: update of the www stuff + +2014-11-30 16:46 dezperado + + * NEWS, doc/fim.man, doc/fimrc.man, src/Browser.cpp, src/fim.h, + src/fimrc, src/help.cpp: jump back and forth from the last viewed + image with the ' key and the _lastfileindex variable. + +2014-11-30 12:03 dezperado + + * NEWS, README, THANKS, TODO, configure.ac, src/FbiStuffPcx.cpp, + src/Makefile.am: Now supporting PCX files reading thanks to code + contributed by Mohammed Isam. + +2014-11-30 11:21 dezperado + + * NEWS, TODO, configure.ac, src/FbiStuff.cpp: made the configure + output a little more informative/readable/compact. + added .tar.gz to the (sic!) hardcoded libarchive handled + extensions. + +2014-11-30 10:29 dezperado + + * NEWS, TODO, configure.ac, src/FbiStuffBmp.cpp, src/Makefile.am: + introduced the ability to disable BMP file support with + --disable-bmp. + +2014-11-30 00:44 dezperado + + * configure.ac, src/FbiStuffXyz.cpp: Added a --enable-xyz switch to + enable the bogus xyz sample format decoder. + +2014-11-29 14:37 dezperado + + * src/FbiStuffJasPer.cpp: svn ps svn:keywords LastChangedDate + src/FbiStuffJasPer.cpp + +2014-11-29 14:35 dezperado + + * src/FbiStuffJasPer.cpp: ooops: removed a hardcoded '#define + FIM_WITH_LIBJASPER 1'. + +2014-11-29 14:14 dezperado + + * NEWS, TODO, configure.ac, src/FbiStuffJasPer.cpp, + src/Makefile.am: A first, experimental JPEG-2000 support via + JasPer. + +2014-11-29 14:09 dezperado + + * src/FbiStuffXyz.cpp: Got rid of a risky conversion in + FbiStuffXyz.cpp. + +2014-11-29 00:04 dezperado + + * TODO, src/CommandConsole-cmd.cpp, src/CommandConsole-help.cpp, + src/CommandConsole-init.cpp, src/CommandConsole.cpp, + src/FbiStuff.cpp, src/Image.cpp, src/Viewport.cpp, + src/defaultConfiguration.cpp, src/fim.cpp, src/fim.h, + src/readline.cpp: enabled the code to be compiled with + -std=gnu++11. + +2014-11-28 22:49 dezperado + + * TODO, src/CommandConsole.cpp, src/FbiStuffJpeg.cpp, + src/Image.cpp: Using snprintf instead of sprintf in accepting the + 'desc' string. + Thinking about the future of JPEG/EXIF and background loaders. + +2014-11-27 19:45 dezperado + + * src/Image.cpp: Fixing a segfault case. + +2014-11-27 09:34 dezperado + + * doc/fimrc.man, src/fim.h, src/fimrc, src/help.cpp: yesterday + forgot to version this change of defaults. C-k binding (comments + display) and a nice (nicer than %v) _want_caption_status are now + the default. + +2014-11-26 20:28 dezperado + + * doc/fimrc.man, src/Image.cpp, src/fim.h: added two variables + (_use_exiftool,_exiftool_comment) that respectively control and + use exiftool's capabilities. + +2014-11-26 20:17 dezperado + + * TODO, configure.ac, src/Image.cpp: added an exiftool interface, + which can be activated via --enable-exiftool and updates the + _comment variable with output from exiftool. + +2014-11-25 22:55 dezperado + + * src/Image.cpp: Builds without FIM_WANT_CUSTOM_INFO_STATUS_BAR set + were broken. Fix. + +2014-11-24 10:13 dezperado + + * src/Browser.cpp, src/fim.h, src/help.cpp: _display_status_fmt is + now a customizable format string. + +2014-11-23 02:50 dezperado + + * src/Image.cpp: the last commit used to show a quantity to be zero + in the format string function. fix. + +2014-11-23 01:53 dezperado + + * src/FbiStuffJpeg.cpp: A few changes in the (non active) libexif + code. + +2014-11-23 01:52 dezperado + + * TODO, doc/fimrc.man, src/Image.cpp, src/fim.h, src/fimrc, + src/help.cpp: Now the caption as well can be set to a custom + format string. + +2014-11-23 01:28 dezperado + + * TODO, src/CommandConsole.cpp, src/Image.cpp, src/Image.h, + src/help.cpp: generalized a bit the custom info string mechanism + and enabling it for the window caption. + +2014-11-23 01:25 dezperado + + * src/Image.cpp, src/Image.h: made a few Image accessors const. + +2014-11-23 00:17 dezperado + + * doc/fimrc.man, src/CommandConsole.cpp, src/Namespace.cpp, + src/Namespace.h, src/fim.h: FIM_VID_WANT_CAPTION_STATUS now + allows specification of a custom fixed string. + +2014-11-22 22:45 dezperado + + * src/Browser.cpp, src/fim.h, src/help.cpp: introduced an + experimental FIM_VID_DISPLAY_STATUS_FMT variable. + +2014-11-22 22:25 dezperado + + * src/Browser.cpp, src/common.cpp, src/common.h, src/fim.h: an + internal experimental switch for optionally displaying basename + of displayed filenames (instead of full path) in the status bar. + +2014-11-20 11:45 dezperado + + * TODO, doc/FIM.TXT: Added mention to FbiStuffXyz.cpp to the FAQ. + +2014-11-19 22:53 dezperado + + * TODO, src/FbiStuffXyz.cpp, src/Makefile.am: A working sample file + format decoder example (disabled). + +2014-11-19 22:49 dezperado + + * src/FbiStuffXyz.cpp: Introducing a sample file format decoder + source, FbiStuffXyz.cpp . + +2014-11-17 18:50 dezperado + + * src/Image.cpp: for some weird reason the scaling routine used to + display a notice about prefetching... got rid of this. + +2014-11-17 18:47 dezperado + + * src/Image.cpp: an ugly way to force the proper status display + after prefetch after load. + +2014-11-17 18:22 dezperado + + * src/FbiStuff.cpp, src/FbiStuffBit1.cpp, src/FbiStuffBit24.cpp, + src/FbiStuffBmp.cpp, src/FbiStuffDjvu.cpp, src/FbiStuffGif.cpp, + src/FbiStuffJpeg.cpp, src/FbiStuffMatrixMarket.cpp, + src/FbiStuffPdf.cpp, src/FbiStuffPng.cpp, src/FbiStuffPpm.cpp, + src/FbiStuffPs.cpp, src/FbiStuffText.cpp, src/FbiStuffTiff.cpp, + src/FbiStuffUFRaw.cpp, src/FontServer.cpp, src/fim_wrappers.h: + may have improved alignment properties (towards this end + fim_calloc still needs a revamp) of a few allocatable structs, + with changes like e.g.: + - h = (struct jpeg_state *)fim_calloc(sizeof(*h),1); + + h = (struct jpeg_state *)fim_calloc(1,sizeof(*h)); + +2014-11-17 18:05 dezperado + + * src/CommandConsole.cpp, src/FramebufferDevice.cpp, + src/common.cpp, src/fim_wrappers.h: introduced a handy macro + 'fim_stralloc'. + +2014-11-17 08:03 dezperado + + * src/SDLDevice.cpp: four SDL hardcoded bindings for mouse wheel + and extra buttons. + +2014-11-16 22:16 dezperado + + * TODO, src/CommandConsole.cpp, src/FbiStuffJpeg.cpp, + src/FbiStuffPng.cpp, src/Image.cpp: added (in a rather quick, + incomplete and dirty way) a way to display JPEG (and, not anymore + the laconical "Exif" reminder) and PNG comments, via the %k + specifier for _info_fmt_str. + +2014-11-16 22:13 dezperado + + * README, configure.ac, doc/FIM.TXT, + scripts/maintenance/cron-rsync.sh.in: First commit on the + Savannah SVN repository. + Changes to accommodate transition from + http://code.autistici.org/svn/fim/trunk/ + to + http://svn.savannah.nongnu.org/svn/fbi-improved/ + +2014-09-24 23:23 dezperado + + * NEWS, configure.ac: the configure script use to advertise a + non-existent `make fim' target. eliminated this. (missing target + noticed by Arturo Rinaldi). + +2014-09-14 19:04 dezperado + + * NEWS, src/SDLDevice.cpp, src/Viewport.cpp, src/Viewport.h, + src/fim.h: wrote a mouse-driven image panning functionality for + sdl (non active by default). + bugfix to Viewport::pan_left and Viewport::pan_right. + +2014-09-01 17:41 dezperado + + * TODO, src/fim.cpp: Updated the mention to _scale_style=' ' in + branches/0.4 . + +2014-09-01 17:24 dezperado + + * TODO, doc/fim.man, doc/fimrc.man, src/fim.cpp: fixed + documentation note about _scale_style and changed the hardcoded + default memory cache occupation limit. + +2014-08-31 10:44 dezperado + + * NEWS, src/Cache.cpp, src/fim.h: The viewport info / position + cache will now be freed slightly independently from images; after + the triggering of a (for now) hardcoded cache size limit + threshold. + +2014-08-31 01:14 dezperado + + * TODO, src/Cache.cpp, src/fim.h, src/fimrc, src/help.cpp: + Effectively activated the max cached memory (_max_cached_memory) + cache eviction mechanism. + +2014-08-30 12:43 dezperado + + * src/FbiStuffMagick.cpp, src/Viewport.cpp, src/fim.cpp: Fix to + when a single, non-decodeable file is (unsuccessfully) attempted + to be loaded. + Extended (or rather, resuscitated) the workaround for + libGraphicsMagick failing in rendering txt files. + +2014-08-30 08:31 dezperado + + * src/Browser.cpp, src/Cache.cpp, src/CommandConsole.cpp, + src/DebugConsole.cpp, src/DebugConsole.h, src/FimWindow.cpp, + src/Namespace.h, src/SDLDevice.cpp, src/Viewport.cpp, src/fim.h: + Adjusting to respect the proper classes members initialization + order. + +2014-08-29 23:47 dezperado + + * NEWS, TODO, src/Browser.cpp, src/Cache.cpp, src/Cache.h, + src/Viewport.cpp, src/Viewport.h, src/fim.h: Implemented a first, + rudimentary 'viewport' cache. + +2014-08-29 21:42 dezperado + + * src/Browser.cpp: Small readability fixes of Browser methods code. + +2014-08-29 20:50 dezperado + + * Makefile.am, THANKS, configure.ac, doc/Makefile.am, + scripts/Makefile.am, scripts/tests/font.sh, src/Makefile.am: + Adapted the trunk to the last two revisions of 0.4. + Removed a couple of spurious lines from a script in 0.4. + +2014-07-23 20:30 dezperado + + * src/Makefile.am: Better notation in the Makefile.am. + +2014-04-08 07:18 dezperado + + * src/FbiStuff.cpp: avoiding using a pipe with libarchive. + +2014-04-07 22:43 dezperado + + * configure.ac, src/FbiStuff.cpp: preliminary, unfinished toy + interfacing with libarchive. + +2014-04-05 20:35 dezperado + + * configure.ac, src/FbiStuff.cpp, src/FbiStuffUFRaw.cpp: initial + experimental support for decoding files with ufraw. + +2013-12-12 20:43 dezperado + + * src/Browser.cpp: ghost patch for proof-of-concept testing of + sort-by-date possibility. + +2013-12-12 20:15 dezperado + + * NEWS, TODO, configure.ac: changed librsb library detection. + +2013-11-07 22:37 dezperado + + * TODO, src/AADevice.cpp, src/CommandConsole.cpp, + src/FramebufferDevice.cpp, src/fim.h: fixes for build broken + --disable-scripting. however, `make tests' fails so more is + needed. + +2013-11-07 21:57 dezperado + + * TODO, doc/fimrc.man, src/CommandConsole-init.cpp, + src/CommandConsole.cpp, src/CommandConsole.h, src/fim.h, + src/help.cpp: cleaning up a little CommandConsole internals. + +2013-11-07 20:27 dezperado + + * src/Browser.cpp, src/CommandConsole-init.cpp, + src/CommandConsole.cpp, src/FimWindow.cpp, src/fim.h: introduced + macro "FIM_AUTOCMD_EXEC autocmd_exec", active only if + FIM_AUTOCMDS is defined (thus saving much #ifdef/#endif code). + +2013-11-07 19:55 dezperado + + * TODO, src/Browser.cpp, src/Browser.h: introduced backward regexp + based search for regexp_goto. got rid of regexp_goto_next (merged + in regexp_goto). + +2013-11-06 20:52 dezperado + + * NEWS, src/FbiStuff.cpp, src/fim_types.h: with gcc, declaring the + scaling functions pointers as __restrict__'ed, resulting in a + slightly (e.g. I see 10% here) faster scaling code. + +2013-11-06 18:33 dezperado + + * src/AADevice.cpp, src/AADevice.h, src/Arg.cpp, src/Arg.h, + src/Benchmarkable.h, src/Browser.h, src/CACADevice.cpp, + src/CACADevice.h, src/Cache.h, src/Command.h, + src/CommandConsole.cpp, src/CommandConsole.h, + src/DebugConsole.cpp, src/DebugConsole.h, src/DisplayDevice.cpp, + src/DisplayDevice.h, src/DummyDisplayDevice.h, src/FimWindow.cpp, + src/FimWindow.h, src/FramebufferDevice.h, src/Image.cpp, + src/Image.h, src/Imlib2Device.h, src/Namespace.h, + src/SDLDevice.h, src/Var.h, src/Viewport.cpp, src/Viewport.h, + src/fim_string.cpp, src/fim_string.h: (except for + FramebufferDevice) moving a lot of method definitions from the + header to the respective cpp file. + () -> (void) in the headers method declarations. + +2013-11-06 17:43 dezperado + + * src/Namespace.cpp, src/Namespace.h, src/Var.cpp, src/Var.h, + src/grammar.h: easing printout of Var and Namespace instances. + added an option to Namespace's get variables method. + +2013-11-02 22:35 dezperado + + * src/Namespace.cpp, src/Namespace.h: introduced a preprocessor + symbol (for now undefined) to disable CommandConsole existence + requirement in Namespace... + +2013-11-01 18:01 dezperado + + * src/Browser.cpp, src/Browser.h, src/Cache.cpp, + src/DebugConsole.h, src/FimWindow.cpp, src/Image.cpp, + src/Namespace.cpp, src/Namespace.h, src/Viewport.cpp, src/fim.h: + working to decouple Namespace from CommandConsole. + +2013-11-01 16:43 dezperado + + * TODO, src/CommandConsole-var.cpp, src/CommandConsole.h, + src/Makefile.am, src/Namespace.cpp, src/Namespace.h: + CommandConsole now extends Namespace. + moved Namespace.cpp's CommandConsole:: stuff to new + CommandConsole-var.cpp. + and of course, "svn ps svn:keywords LastChangedDate + src/CommandConsole-var.cpp" + +2013-11-01 15:18 dezperado + + * configure.ac, src/FontServer.cpp, src/FontServer.h, + src/FramebufferDevice.h: + :%s/FIM_X_DISPLAY_MISSING/FIM_USE_X11_FONTS/g + (inverted preprocessor conditionals consequently) + +2013-11-01 15:13 dezperado + + * src/Makefile.am, src/common.cpp, src/fim.h, src/fim_string.cpp, + src/fim_string.h, src/string.cpp, src/string.h: string.h -> + fim_string.h + string.cpp -> fim_string.cpp + +2013-11-01 15:07 dezperado + + * src/CommandConsole-cmd.cpp, src/CommandConsole-help.cpp, + src/Var.cpp, src/Var.h, src/fim.cpp: moved the help db-related + methods of Var to separate functions. + +2013-10-30 17:17 dezperado + + * src/AADevice.cpp, src/Browser.cpp, src/CACADevice.cpp, + src/Cache.cpp, src/CommandConsole-cmd.cpp, + src/CommandConsole-help.cpp, src/CommandConsole-init.cpp, + src/CommandConsole.cpp, src/DebugConsole.cpp, + src/DisplayDevice.cpp, src/FbiStuff.cpp, src/FbiStuffLoader.cpp, + src/FbiStuffMagick.cpp, src/FbiStuffPs.cpp, src/FimWindow.cpp, + src/FontServer.cpp, src/FramebufferDevice.cpp, src/Image.cpp, + src/Imlib2Device.cpp, src/Namespace.cpp, src/SDLDevice.cpp, + src/Var.cpp, src/Viewport.cpp, src/common.cpp, src/fim.cpp, + src/readline.cpp, src/string.cpp: sed -i 's/() *$/(void)/g' *.cpp + sed -i 's/() *const *$/(void)const/g' *.cpp + and some fixes where that was not correct. + +2013-10-30 17:08 dezperado + + * src/AADevice.h, src/Browser.h, src/CACADevice.h, src/Cache.h, + src/CommandConsole.h, src/DebugConsole.h, src/DisplayDevice.h, + src/FbiStuff.h, src/FbiStuffLoader.h, src/FimWindow.h, + src/FontServer.h, src/FramebufferDevice.h, src/Image.h, + src/Imlib2Device.h, src/SDLDevice.h, src/Viewport.h, + src/common.h, src/readline.h, src/string.h: petty substitution of + '();' with '(void);' in method/function declarations/definitions + in *.h files. + +2013-10-30 16:59 dezperado + + * NEWS, src/AADevice.cpp, src/AADevice.h, src/DisplayDevice.h, + src/DummyDisplayDevice.h, src/FramebufferDevice.cpp, + src/FramebufferDevice.h, src/Imlib2Device.cpp, + src/Imlib2Device.h, src/SDLDevice.cpp, src/SDLDevice.h, + src/Viewport.cpp: the status bar will not always cover image + space. + +2013-10-30 16:06 dezperado + + * doc/fim.man, src/fim.cpp: removed an obsolete documentation line. + +2013-10-26 13:18 dezperado + + * src/FbiStuff.cpp: allocating pixelmaps through the newly + introduced fim_pm_alloc (I forgot this file in last commit). + +2013-10-26 13:17 dezperado + + * src/Image.cpp, src/common.cpp, src/common.h: allocating pixelmaps + through the newly introduced fim_pm_alloc. + +2013-10-26 10:34 dezperado + + * src/FbiStuffPng.cpp: fix to the png code according to new + versions: assuming no definition (only declaration) of + png_structp. + tested with PNG_LIBPNG_VER 10249 and 10606. + +2013-10-26 09:47 dezperado + + * NEWS, TODO, src/FbiStuffGif.cpp: the previous fix to + FbiStuffGif.cpp was insufficient: this should be (tested with + 5.0.5 and 4.1); trunk and 0.4 branch. + update to NEWS. + +2013-10-25 16:04 dezperado + + * src/FbiStuffGif.cpp: a change to fix effects of removal of + PrintGifError since giflib-4.2, still keeping backward + compatibility. + +2013-10-22 17:25 dezperado + + * src/FbiStuff.cpp, src/SDLDevice.cpp, src/fim.h: bypassing a + possible bug in sdl image display when invoking SDL_UpperBlit + with extra large images (0.4 branch, trunk). + readability changes in trunk. + byte_size of mipmap type correction in trunk. + +2013-10-20 19:02 dezperado + + * doc/fimrc.man, src/fimrc: commented the window-related aliases in + the default fimrc. + added a binding of 'H' to to-image-height scaling. + +2013-10-20 18:30 dezperado + + * src/Browser.cpp, src/Viewport.cpp, src/Viewport.h, src/fimrc: + beefed the align functionality by enbling left/right and adding + left,right,top,bottom,center default aliases, as well as binding + 'c' to the center alignment. + +2013-10-20 17:56 dezperado + + * doc/fimrc.man, src/Browser.cpp, src/Image.cpp, src/Viewport.cpp, + src/Viewport.h, src/fim.h, src/help.cpp: enabled image centering + on redisplay (this may be a problem so it shall be reviewed). + added %c specifier for centering information. + +2013-10-20 15:45 dezperado + + * src/Browser.cpp, src/Cache.cpp, src/CommandConsole.cpp, + src/DebugConsole.cpp, src/FimWindow.cpp, src/Image.cpp, + src/Imlib2Device.cpp, src/Viewport.cpp, src/fim.cpp, src/fimrc, + src/lex.lex: introduced default key bindings for ^ and $. apart + from this, only readability changes. + +2013-10-20 15:04 dezperado + + * src/Browser.cpp, src/common.h, src/fim.h, src/lex.lex: fixed a + bug (repeated input of '$' line leading to hopping images back). + +2013-10-19 21:11 dezperado + + * doc/fimrc.man, src/Image.cpp, src/fim.h, src/help.cpp: added %m + specifier for getting mipmap mem info. + +2013-10-19 20:33 dezperado + + * NEWS, src/Cache.cpp, src/FbiStuff.cpp, src/FbiStuff.h, + src/FbiStuffMatrixMarket.cpp, src/Image.cpp, src/Image.h, + src/fim.h, src/help.cpp: completed and activated mip map + mechanism. + +2013-10-19 12:19 dezperado + + * src/FbiStuff.cpp, src/FbiStuff.h, src/FbiStuffLoader.h: declaring + as const the arguments of many pixel manipulating functions. + +2013-10-19 11:19 dezperado + + * src/Browser.cpp, src/Browser.h, src/Cache.cpp, src/Cache.h, + src/Image.cpp, src/Image.h, src/Viewport.cpp, src/fim.h: + introduced commandConsole.browser_.cache_.dummy_img_ . + +2013-10-19 08:23 dezperado + + * src/Browser.cpp, src/Browser.h, src/Viewport.cpp, src/fim.h: + petty optimizations; code readability changes; in + browser/vieweport. + +2013-10-19 06:53 dezperado + + * src/Image.cpp, src/Image.h: an enum to express rotation values. + +2013-10-18 22:29 dezperado + + * configure.ac, src/CommandConsole.cpp, src/Image.cpp, src/Image.h, + src/common.cpp, src/common.h, src/fim.h: formatting changes + + return pruning + conditional GB/PG support in fim_snprintf_XB. + +2013-10-18 21:46 dezperado + + * NEWS, doc/fim.man, doc/fimrc.man, src/Browser.cpp, src/Browser.h, + src/Cache.cpp, src/Cache.h, src/CommandConsole.cpp, + src/CommandConsole.h, src/DebugConsole.cpp, src/DebugConsole.h, + src/FimWindow.cpp, src/FimWindow.h, src/Image.cpp, src/Image.h, + src/Namespace.h, src/Viewport.cpp, src/Viewport.h, src/fim.h, + src/help.cpp: introduced %C and %T specifiers to get memory usage + info. + +2013-10-15 16:41 dezperado + + * VERSION, configure.ac, src/Browser.cpp, src/Cache.cpp, + src/FramebufferDevice.cpp, src/Namespace.cpp: mostly code + readability measures and extra 'return' statements pruning. + +2013-10-14 21:08 dezperado + + * NEWS, README, configure.ac, src/AADevice.cpp, src/Browser.cpp, + src/Cache.cpp, src/CommandConsole.cpp, src/DisplayDevice.cpp, + src/FbiStuff.cpp, src/FramebufferDevice.cpp, src/Namespace.cpp, + src/SDLDevice.cpp, src/fim.cpp: cleaning up the code; mainly + making it more readable. + +2013-10-12 16:54 dezperado + + * INSTALL, README, configure.ac, + scripts/maintenance/yacc2grammar.awk, src/Makefile.am, + src/b2ba.c, src/fim.cpp, src/fimgs: modest README update, with + Debian install info. + removed INSTALL file. + corrected some dates/version information. + Imlib2 configure reporting and makefile fixes. + adapting an awk script to mawk (we were using only gawk, until + now). + +2013-10-12 14:31 dezperado + + * configure.ac: updating configure.ac for autoconf-2.69. + +2013-10-11 15:44 dezperado + + * ChangeLog, NEWS, doc/fimrc.man, src/fim.h, src/help.cpp: better + documentation string for the status bar format string. + changelog update. + +2013-10-10 22:15 dezperado + + * src/FbiStuffText.cpp, src/Image.cpp: fixing the 0-byte corner + case in the --as-text rendering mode; refining the memory/file + occupation s + tatus bar text printing code to display either B,KB,MB, or GB + alongside with the number. + +2013-10-10 18:52 dezperado + + * README: restoring README tainted in last commit. + +2013-10-10 18:43 dezperado + + * README, configure.ac, doc/fim.man, doc/fimrc.man, + src/FbiStuff.cpp, src/FbiStuffText.cpp, src/FontServer.cpp, + src/FontServer.h, src/Makefile.am, src/fim.cpp, src/fim.h, + src/help.cpp: implemented a for-fun --as-text mode; that is, + rendering printable text of files (almost) as in a text file + viewer. + +2013-10-10 16:39 dezperado + + * TODO, configure.ac, src/Image.cpp, src/fim.h, src/help.cpp: + introduced the --enable-custom-status-bar configure option to + enable printf-like customizable status bar info. + +2013-10-09 22:42 dezperado + + * TODO, doc/fim.man, src/CommandConsole.cpp, src/Imlib2Device.cpp, + src/fim.h: leftovers of some tests for future work. + +2013-10-09 22:37 dezperado + + * src/FbiStuffPdf.cpp, src/testdir/test7.in: minor modifications + for my poppler-0.24 installatio. + change to a test case: I'm unsure whether this is correct. + +2013-09-02 18:56 dezperado + + * src/AADevice.cpp, src/Cache.cpp, src/CommandConsole-cmd.cpp, + src/CommandConsole-help.cpp, src/CommandConsole.cpp, + src/FbiStuffBmp.cpp, src/FbiStuffJpeg.cpp, src/FbiStuffPdf.cpp, + src/fim.cpp: comment changes. + +2013-07-11 12:58 dezperado + + * src/FramebufferDevice.h: fixed a bug in which in 16 bit mode + lines and text were displayed in the wrong colour (one byte was + being written to pixel memory instead of two). + +2013-07-04 21:07 dezperado + + * src/AADevice.h, src/Arg.h, src/Benchmarkable.h, src/Browser.h, + src/CACADevice.h, src/Cache.h, src/Command.h, + src/CommandConsole.h, src/DebugConsole.h, src/DisplayDevice.h, + src/DummyDisplayDevice.h, src/FbiStuff.h, src/FbiStuffFbtools.h, + src/FbiStuffList.h, src/FbiStuffLoader.h, src/FimWindow.h, + src/FontServer.h, src/FramebufferDevice.h, src/Image.h, + src/Imlib2Device.h, src/Namespace.h, src/SDLDevice.cpp, + src/SDLDevice.h, src/Var.h, src/Viewport.cpp, src/Viewport.h, + src/common.h, src/fim.h, src/fim_limits.h, src/fim_plugin.h, + src/fim_stream.h, src/fim_types.h, src/fim_wrappers.h, src/lex.h, + src/readline.cpp, src/readline.h, src/string.cpp, src/string.h: + putting commented preprocessor symbol information after every + #endif and #else, for the remaining *.cpp and *.h files, third + round. + +2013-07-04 19:56 dezperado + + * src/DebugConsole.cpp, src/DisplayDevice.cpp, src/FbiStuff.cpp, + src/FbiStuffBit1.cpp, src/FbiStuffBit24.cpp, src/FbiStuffBmp.cpp, + src/FbiStuffFbtools.cpp, src/FbiStuffJpeg.cpp, + src/FbiStuffLoader.cpp, src/FbiStuffMagick.cpp, + src/FbiStuffPdf.cpp, src/FbiStuffPng.cpp, src/FbiStuffPpm.cpp, + src/FbiStuffTiff.cpp, src/FimWindow.cpp, src/FontServer.cpp, + src/FramebufferDevice.cpp, src/Image.cpp, src/Imlib2Device.cpp, + src/Makefile.am, src/Namespace.cpp, src/fim.cpp, + src/fim_plugin.cpp, src/interpreter.cpp: putting commented + preprocessor symbol information after every #endif and #else, for + many *.cpp files, second round. + +2013-07-04 17:38 dezperado + + * src/AADevice.cpp, src/Browser.cpp, src/CACADevice.cpp, + src/Cache.cpp, src/Command.cpp, src/CommandConsole-cmd.cpp, + src/CommandConsole-help.cpp, src/CommandConsole-init.cpp, + src/CommandConsole.cpp, src/common.cpp: putting commented + preprocessor symbol information after every #endif and #else, for + each [ABCc]*cpp file. + +2013-07-04 09:28 dezperado + + * NEWS, doc/fim.man, doc/fimrc.man, src/Browser.cpp, src/Browser.h, + src/fim.cpp: using seeding before random shuffling. + differentiating --random from --random-no-seed. + +2013-06-20 11:23 dezperado + + * src/Browser.cpp: restoring Browser.cpp: previous commit's change + was unintented. + +2013-06-20 11:21 dezperado + + * src/Browser.cpp, src/FbiStuff.cpp, src/FbiStuffBmp.cpp, + src/FbiStuffJpeg.cpp, src/FbiStuffPng.cpp, src/FbiStuffPpm.cpp, + src/Image.cpp, src/common.cpp, src/common.h, src/fim.h, + src/help.cpp: first changes towards the integration of zlib, for + reading transparently gz-compressed files. + +2013-05-20 10:28 dezperado + + * NEWS, TODO, src/AADevice.cpp, src/AADevice.h, src/Browser.cpp, + src/CommandConsole-cmd.cpp, src/CommandConsole-init.cpp, + src/CommandConsole.cpp, src/common.cpp: formatting/readability + oriented code changes. + +2013-05-11 13:28 dezperado + + * src/CommandConsole.cpp, src/Image.cpp, src/fim.h, src/help.cpp: + implemented a custom image info string functionality (off by + default). + +2013-05-01 20:40 dezperado + + * TODO, src/Image.cpp, src/Image.h, src/fim.h: first sketch of + support for image file size and memory occupation display (off by + default). + +2013-04-27 07:50 dezperado + + * src/Browser.cpp, src/SDLDevice.cpp, src/fim.h: just readability + changes. + +2013-04-26 22:38 dezperado + + * TODO, src/CommandConsole.cpp, src/DisplayDevice.cpp: just + readability changes. + +2013-04-09 17:09 dezperado + + * src/DisplayDevice.cpp: Added Brian Murray's suggested patch to + use sleep() when !isatty(stdin) in + DisplayDevice::catchInteractiveCommand. + +2013-04-07 20:43 dezperado + + * src/AADevice.cpp, src/Browser.cpp, src/CommandConsole-cmd.cpp, + src/CommandConsole.cpp, src/FbiStuff.cpp, src/FbiStuffBit24.cpp, + src/FbiStuffDjvu.cpp, src/FbiStuffJpeg.cpp, src/FbiStuffPdf.cpp, + src/FimWindow.cpp, src/FontServer.cpp, src/Image.cpp, + src/Imlib2Device.cpp, src/SDLDevice.cpp, src/Viewport.cpp, + src/common.cpp, src/fim.h, src/interpreter.cpp, src/readline.cpp, + src/string.cpp: several minor language standard adherence fixes. + in two cases, fixed if-if-else branch ambiguities. + in one case, preventing an uninitialized variable from being + used. + +2013-03-31 17:31 dezperado + + * ChangeLog, NEWS, configure.ac, src/FbiStuffPdf.cpp: patch for + POPPLER_VERSION_MINOR>=22. + updating to NEWS and ChangeLog. + +2013-03-22 23:05 dezperado + + * doc/fim.man, src/AADevice.cpp, src/AADevice.h, + src/CommandConsole-cmd.cpp, src/CommandConsole-init.cpp, + src/fim.cpp: extended the AADevice as well to get reinit options. + +2013-03-22 20:08 dezperado + + * configure.ac, distros/Makefile.am, src/FbiStuffMatrixMarket.cpp, + src/FramebufferDevice.cpp: fix to wrong rule in makefile. + update of configure.ac librsb-related doc string, and matrix + rendering code. + comment typo fix. + +2012-12-26 15:13 dezperado + + * src/FbiStuffMatrixMarket.cpp, src/fimgs: adapting to the new + rsb.h interface. + added 'shopt -s nocasematch' to fimgs. + +2012-12-25 00:33 dezperado + + * src/FbiStuffMatrixMarket.cpp: updated way of invoking + rsb_util_get_matrix_dimensions + +2012-08-10 23:51 dezperado + + * Makefile.am, TODO, configure.ac, src/FbiStuffJpeg.cpp: slightly + better jpeglib errors handling. + configure typo fix. + TODO notes. + using 'ulimit' from within Makefile testing. + +2012-08-04 12:02 dezperado + + * doc/fimrc.man, src/Image.cpp: trunk: less stringent rules in + inner desaturate() and negate() options in Image class. + man page update. + +2012-08-04 11:38 dezperado + + * TODO, doc/fimrc.man, src/Browser.cpp, src/Browser.h, + src/CommandConsole.cpp, src/Image.cpp, src/Image.h, + src/Viewport.cpp, src/fim.h, src/fimrc, src/help.cpp: trunk: + introduced a 'desaturate' command, and implemented bindings for + image desaturation and negation. + +2012-07-21 12:30 dezperado + + * src/FbiStuffPs.cpp: in the ps decoder, inverted r and b channels. + +2012-07-18 20:30 dezperado + + * BUGS, INSTALL.TXT, README, TODO, configure.ac, debian/control, + distros/fedora/fim.spec, doc/fim.man, src/fim.cpp, src/fimrc, + var/index.html.in: implementing Justin B Rye's (debian + Bug#679622) suggestions about english for documentation and + metadata. + +2012-07-18 18:44 dezperado + + * TODO, src/FbiStuffPdf.cpp: trunk: minimal hack to allow build + with poppler 0.20.2 (that is, update to new poppler's API (though + it's difficult to compile-time chck whether using an older + poppler version because of missing appropriate preprocessor + symbols)). + +2012-03-08 11:54 dezperado + + * doc/fim.man, src/fim.h: trunk: the imlib2 device was not in the + list of the ones available in the man page and help output. + +2012-03-02 14:19 dezperado + + * src/FbiStuff.cpp, src/common.cpp, src/common.h: trunk: empty + regular files will not be given graphicsmagick as a loader (this + shall be fixed in version 1.3.13 of graphicsmagick) + +2012-02-11 00:27 dezperado + + * configure.ac, scripts/Makefile.am: trunk: + adding the font.sh script to the list of distributed files. + configure modification to allow (cut-down) static builds. + +2012-02-10 23:47 dezperado + + * Makefile.am, TODO, scripts/tests/version.sh, + src/testdir/Makefile: trunk: adjusted some error reporting + printout. + +2012-02-10 23:41 dezperado + + * Makefile.am, scripts/tests/font.sh: trunk: adding a script for + testing (basics) of font handling. + +2012-01-29 16:08 dezperado + + * TODO, src/FbiStuff.cpp: notes in the TODO. + when scaling to 1, will use copy instead of scaling. + +2011-12-17 17:36 dezperado + + * src/FbiStuffMatrixMarket.cpp: trunk: changed the call to librsb + responsible for matrix rendering (adapted to the new API). + +2011-11-06 10:22 dezperado + + * configure.ac: configure fix: better `svnversion` parsing, and + some more commentary to a configure option. + +2011-11-06 09:19 dezperado + + * src/FontServer.cpp: added + /usr/lib/kbd/consolefonts/lat9-16.psf.gz to the list of default + fonts. + +2011-11-05 22:07 dezperado + + * doc/fim.man: man page update according to last commit. + +2011-11-05 21:56 dezperado + + * configure.ac, src/FontServer.cpp, src/Makefile.am, src/fim.h: + configure options to specify a custom font to hardcode ar build + time (--custom-hardcoded-consolefont), or a custom font to check + for as first in the fonts list (--default-consolefont). + +2011-11-04 16:29 dezperado + + * Makefile.am, NEWS, README, configure.ac, doc/fim.man, + src/FontServer.cpp, src/Makefile.am, src/b2ba.c, + src/default_font_byte_array.h, src/fim.cpp, src/fim.h, var/fonts, + var/fonts/Lat15-Terminus16.psf: added a new, valuable feature: + that of a hardcoded font file. + this enables font display on non-Linux or + non-consolefonts-equipped setups. + added the appropriate copyright notice for the font file (in the + README). + +2011-11-01 12:33 dezperado + + * src/FontServer.cpp: on bad magic numbers found, the console font + loading mechanism did not probe the remaining fonts in the + supplied list. fixed this. + +2011-10-04 22:23 dezperado + + * src/Imlib2Device.cpp: the imlib2 stub code does not hand loops + now while reporting input. + +2011-10-04 22:13 dezperado + + * src/CommandConsole-init.cpp, src/Imlib2Device.cpp, + src/Imlib2Device.h: enabling basic fullscreen mode to the imlib2 + device. + +2011-10-03 20:56 dezperado + + * src/Imlib2Device.cpp, src/fim.h: the imlib2/X input system + recognize most of the useful keys. + preventing from updating the caption (since the status line is + active by default, for now) in imlib2 mode. + +2011-10-02 19:53 dezperado + + * src/CommandConsole-init.cpp, src/Imlib2Device.cpp, + src/Imlib2Device.h, src/fim.cpp, src/fim.h, src/readline.cpp: the + imlib2 fim visualization device is not yet complete, but has its + main features working. + +2011-10-02 19:30 dezperado + + * src/SDLDevice.cpp: typo fix to the previous commit. + +2011-10-02 19:23 dezperado + + * src/SDLDevice.cpp: minifix to the fill_rect function of SDL. + +2011-10-01 10:28 dezperado + + * src/Imlib2Device.cpp, src/Imlib2Device.h: actually, the previous + commit did not contain the Imlib2Device (so, it won't build, + either). + +2011-10-01 10:24 dezperado + + * configure.ac, src/CommandConsole-init.cpp, src/FontServer.cpp, + src/FontServer.h, src/FramebufferDevice.h, src/SDLDevice.cpp, + src/fim.cpp, src/fim.h: configure fixes for imlib. + empty (stub) source files for an imlib-based display device. + corrected using a symbolic return value in the sdl device code. + renamed X_DISPLAY_MISSING to FIM_X_DISPLAY_MISSING, as it clashes + with non-fim X code. + +2011-10-01 10:10 dezperado + + * src/AADevice.cpp, src/Command.h, src/CommandConsole-init.cpp, + src/CommandConsole.cpp, src/CommandConsole.h, src/FimWindow.cpp, + src/FimWindow.h, src/Makefile.am, src/Viewport.cpp, + src/Viewport.h, src/Window.cpp, src/Window.h, src/fim.h: renaming + Window to FimWindow (also sources). + +2011-10-01 08:46 dezperado + + * configure.ac: adapted the configure script to recognize imlib2. + +2011-09-24 08:56 dezperado + + * TODO, src/FbiStuff.cpp, src/common.cpp: update (or let's say, + fix) to the is_file function. + in some mipmap computing code (still inactive, though). + TODO massive update. + +2011-09-21 21:22 dezperado + + * src/FbiStuff.cpp, src/Makefile.am, src/fim.h, src/fim_plugin.cpp, + src/fim_plugin.h: writing an embryonic version of what shall be a + plugin interface for fim, featuring an opencv-based example. + +2011-09-18 18:58 dezperado + + * doc/fim.man, doc/fimrc.man, src/CommandConsole-help.cpp, + src/FbiStuffFbtools.cpp, src/fim.cpp, src/fim.h: doc fixes: + documented signal-triggered return code; man pages references are + now underlined, in the fim/fimrc man pages. + +2011-09-18 16:27 dezperado + + * src/SDLDevice.cpp: using function SDL_UpperBlit in SDL driver's + common, unmirrored, unflipped display case. + +2011-09-17 22:20 dezperado + + * src/CommandConsole-help.cpp, src/common.cpp, src/common.h, + src/fim.cpp: slight code changes for reducing total code size. + +2011-09-17 21:17 dezperado + + * TODO, scripts/Makefile.am, + scripts/maintenance/configure-minimal.sh, + scripts/maintenance/configure-only-fb-mini.sh, + src/CommandConsole-cmd.cpp, src/CommandConsole-init.cpp, + src/FbiStuffBit1.cpp, src/FbiStuffBit24.cpp, src/fim.cpp: in two + new configure wrapper scripts; one for a minimal build, another + for a fb-only one. + fixes to work well with the fimrc disabled (it was handled + wrong). + fixes to not compile the bitmap rendering code at all, if + deselected. + misc (related) compilation fixes. + +2011-09-17 20:15 dezperado + + * configure.ac, scripts/maintenance/configure-live.sh, + src/CommandConsole.cpp: added a configure option to disable + fim_history file load/save. + updated the live configure wrapper script. + +2011-09-17 09:55 dezperado + + * src/FbiStuffMatrixMarket.cpp: fix to the matrix market decoder: + detecting invalid (negative) matrix sizes. + still need a memory exhaustion prevention check. + +2011-09-12 23:40 dezperado + + * src/FbiStuffMagick.cpp: circumventing libgraphicsmagick's bug + #3408130: NULL pointer referencing while loading an empty + *.txt/*.text file. + +2011-09-10 14:04 dezperado + + * src/AADevice.cpp, src/AADevice.h, src/DisplayDevice.cpp, + src/DisplayDevice.h, src/DummyDisplayDevice.h, src/SDLDevice.cpp, + src/SDLDevice.h, src/fim_types.h: more strictness and typedef + based diversification of different integer types. + +2011-09-10 13:28 dezperado + + * src/AADevice.cpp, src/AADevice.h, src/CommandConsole.cpp, + src/CommandConsole.h, src/DisplayDevice.cpp, src/DisplayDevice.h, + src/FramebufferDevice.cpp, src/Image.cpp, src/SDLDevice.cpp, + src/SDLDevice.h, src/Viewport.cpp, src/Window.cpp, src/fim.h, + src/fim_stream.cpp, src/fim_stream.h, src/fim_types.h: extending + the use of fim_err_t, fim_int, and introduced an enum for redraw + states and an int typedef. + +2011-09-10 12:48 dezperado + + * src/DebugConsole.cpp, src/DebugConsole.h: enforcing use of + fim_err_t in the DebugConsole class. + +2011-09-10 10:47 dezperado + + * src/AADevice.cpp, src/Browser.cpp, src/CommandConsole-cmd.cpp, + src/CommandConsole-init.cpp, src/CommandConsole.cpp, + src/DebugConsole.cpp, src/FbiStuffBmp.cpp, src/FbiStuffDjvu.cpp, + src/FramebufferDevice.cpp, src/SDLDevice.cpp, src/common.cpp, + src/fim.cpp, src/yacc.ypp: :%s/char/fim_char_t/gc + in more files. + +2011-09-10 10:38 dezperado + + * src/CACADevice.h, src/DisplayDevice.cpp, src/FontServer.cpp, + src/defaultConfiguration.cpp, src/examples.h, src/fim.cpp, + src/fim.h, src/fim_stream.cpp, src/fim_stream.h, src/lex.h, + src/lex.lex, src/readline.cpp, src/string.cpp, src/string.h: + :%s/char/fim_char_t/gc + in more files. + +2011-09-10 10:23 dezperado + + * src/CommandConsole.cpp, src/CommandConsole.h, src/DebugConsole.h, + src/FbiStuffList.h, src/FontServer.h, src/FramebufferDevice.cpp, + src/FramebufferDevice.h, src/Makefile.am, src/Var.h, + src/Viewport.cpp, src/Viewport.h, src/grammar.h, src/readline.h: + enforcing the use of fim_char_t in further source files. + +2011-09-10 10:04 dezperado + + * src/FbiStuff.cpp, src/FbiStuff.h, src/FbiStuffBit1.cpp, + src/FbiStuffBit24.cpp, src/FbiStuffBmp.cpp, src/FbiStuffDjvu.cpp, + src/FbiStuffGif.cpp, src/FbiStuffJpeg.cpp, src/FbiStuffLoader.h, + src/FbiStuffMagick.cpp, src/FbiStuffMatrixMarket.cpp, + src/FbiStuffPdf.cpp, src/FbiStuffPng.cpp, src/FbiStuffPpm.cpp, + src/FbiStuffPs.cpp, src/FbiStuffTiff.cpp, src/Image.cpp, + src/Image.h: enforcing the use of fim_char_t in the image decoder + sources. + changed the decoder init function pointer signature to const + char. + +2011-09-10 09:39 dezperado + + * src/DebugConsole.cpp, src/DebugConsole.h, src/FbiStuffBit1.cpp, + src/FbiStuffBmp.cpp, src/FbiStuffDjvu.cpp, src/FbiStuffGif.cpp, + src/FbiStuffJpeg.cpp, src/FbiStuffLoader.cpp, + src/FbiStuffLoader.h, src/FbiStuffMatrixMarket.cpp, + src/FbiStuffPdf.cpp, src/FbiStuffPpm.cpp, src/FbiStuffPs.cpp, + src/FbiStuffTiff.cpp, src/FontServer.h, + src/FramebufferDevice.cpp, src/Image.cpp, src/fim_stream.cpp, + src/fim_stream.h, src/readline.cpp: :%s/unsigned + char/fim_byte_t/gc + in more files. + +2011-09-10 09:17 dezperado + + * src/FbiStuff.cpp, src/FbiStuff.h, src/common.cpp: + :%s/\/fim_char_t/gc + :%s/unsigned char/fim_byte_t/gc + in FbiStuff.{h,cpp} + and some type change in internal buffers in common.c. + +2011-09-10 09:03 dezperado + + * src/common.cpp, src/common.h, src/fim_types.h: + :%s/\/fim_char_t/gc + :%s/unsigned char/fim_byte_t/gc + in common.{h,cpp} + fim_.*_t are no more in namespace fim (for now). + +2011-09-09 20:40 dezperado + + * src/AADevice.cpp, src/AADevice.h, src/FontServer.cpp, + src/FramebufferDevice.cpp, src/FramebufferDevice.h, + src/SDLDevice.cpp, src/SDLDevice.h: enforcing more type + strictness, especially in drawing devices code. + +2011-09-09 20:14 dezperado + + * src/CommandConsole-help.cpp, src/CommandConsole.cpp, + src/CommandConsole.h, src/Namespace.cpp, src/Namespace.h, + src/fim.cpp, src/fim_types.h: enforcing more type strictness, + especially in Namespace & co. + +2011-09-09 19:54 dezperado + + * src/Browser.cpp, src/Browser.h, src/CommandConsole.cpp, + src/CommandConsole.h, src/fim.cpp, src/interpreter.cpp, + src/readline.cpp, src/readline.h: enforcing type safety, + especially for fim_int, fim_char_t. + +2011-09-04 14:02 dezperado + + * configure.ac, src/FbiStuff.cpp, src/common.cpp, src/common.h, + src/fim.h, src/fim_types.h: implementing an alternate file + buffering method, based on fmemopen (not activating it yet, + though). + configure check for fmemopen. + +2011-09-04 13:49 dezperado + + * src/fim.cpp: in the previous commit forgot a conditional check, + leading to an infinite read wait for an image in stdin. + +2011-09-04 13:44 dezperado + + * src/fim.cpp: the file load from stdin is postponed after config + loading, now. + +2011-09-04 11:01 dezperado + + * doc/fimrc.man, src/FbiStuff.cpp, src/fim.h, src/help.cpp: in a + new user variable to have more information over the file load + process. + +2011-09-04 10:31 dezperado + + * NEWS, src/Var.h, src/grammar.h: in the last commit, forgot to add + the NEWS and the Var.h modifications. + +2011-09-04 10:27 dezperado + + * doc/fim.man, doc/fimrc.man, src/Var.cpp, src/fim.cpp, + src/interpreter.cpp, src/lex.lex, src/testdir/test1.in, + src/testdir/test1.ok, src/yacc.ypp: language modifications: + implemented bitwise OR and AND (| and &) operators. + documentation fix (backtick to tick). + bitwise OR/AND test case in. + +2011-09-01 19:28 dezperado + + * doc/fim.man, src/CommandConsole-init.cpp, src/CommandConsole.cpp, + src/CommandConsole.h, src/fim.cpp, src/fim.h, src/fim_types.h: + introduced a separate type for program error codes, documenting + them in the man page, and using them in the code. + +2011-08-31 23:17 dezperado + + * doc/fim.man, doc/fimrc.man, src/CommandConsole.cpp, src/fim.cpp: + documenting the return status code of the program. + slight update to the 'quit' command documentation. + +2011-08-31 22:55 dezperado + + * src/SDLDevice.cpp, src/testdir/Makefile, src/testdir/test15.in, + src/testdir/test16.in, src/testdir/test16.ok: in a new (rather + brittle) test for testing the dir load capability. + some more verbosity for the sdl code. + +2011-08-28 12:43 dezperado + + * src/AADevice.cpp, src/FbiStuff.cpp, src/FbiStuffBit1.cpp, + src/FbiStuffBit24.cpp, src/FbiStuffMagick.cpp, + src/FramebufferDevice.cpp, src/Makefile.am, src/SDLDevice.cpp, + src/fim.h, src/fim_wrappers.h: bzero -> fim_bzero in all sources. + introduced a header file with wrappers to bzero & co. + set some missing svn ps. + +2011-08-28 11:55 dezperado + + * src/Browser.cpp, src/FbiStuffMagick.cpp: some more error handling + with the graphicsmagick file loader. + a bit of more potential efficiency when pushing files. + +2011-08-28 01:23 dezperado + + * src/CommandConsole-init.cpp, src/CommandConsole.cpp, + src/CommandConsole.h, src/FbiStuff.cpp, src/Image.cpp: mainly + cosmetics (macro preprocessor symbols instead of constants) & + related changes. + +2011-08-28 00:54 dezperado + + * src/Benchmarkable.h, src/CommandConsole-init.cpp, + src/CommandConsole.h, src/DisplayDevice.cpp, src/DisplayDevice.h, + src/Makefile.am, src/common.cpp, src/fim.h, src/fim_types.h, + src/string.cpp, src/string.h: generalized the per-object + benchmarking code by introducing a specialized interface. + +2011-08-27 13:35 dezperado + + * src/FbiStuff.cpp, src/fim.h, src/help.cpp: introduced a + user-accessible variable to get the last loaded image loader + string. + +2011-08-21 11:17 dezperado + + * Makefile.am, configure.ac, doc/fim.man, doc/fimrc.man, + src/fim.cpp, src/fim.h, src/help.cpp: documentation oriented + fixes: the previous revision did not compile well. + now using environment variables substitution in the Makefile + while generating man pages. + +2011-08-21 10:24 dezperado + + * configure.ac, doc/fim.man, src/fim.cpp, src/fim.h: miscellaneous + documentation fixes, especially with constant strings. + +2011-08-20 10:17 dezperado + + * src/DebugConsole.cpp, src/FbiStuffBmp.cpp, + src/FramebufferDevice.cpp, src/SDLDevice.cpp, src/fim_types.h: + substituting memset with fim_memset. + removed a duplicate typedef from a header file. + substituting numerical constants with a symbolic macro for a char + buffer size. + +2011-08-20 10:04 dezperado + + * src/CACADevice.cpp, src/FbiStuff.cpp, src/FbiStuffBit1.cpp, + src/FbiStuffBit24.cpp, src/FbiStuffBmp.cpp, + src/FbiStuffFbtools.cpp, src/FbiStuffGif.cpp, + src/FbiStuffJpeg.cpp, src/FbiStuffLoader.cpp, + src/FbiStuffPng.cpp, src/FbiStuffPpm.cpp, src/FbiStuffTiff.cpp, + src/FontServer.cpp, src/FramebufferDevice.cpp, src/SDLDevice.cpp, + src/fim.h, src/fim_limits.h, src/string.cpp: substituting + memset(x,0,y) calls with fim_bzero(x,y) calls (boiling down to + memset(x,0,y)). + +2011-08-20 09:44 dezperado + + * TODO, VERSION, src/DisplayDevice.cpp, src/FbiStuff.cpp, + src/FbiStuffJpeg.cpp, src/FbiStuffPdf.cpp, src/FbiStuffTiff.cpp, + src/FramebufferDevice.cpp, src/Makefile.am, src/fim.h, + src/fim_limits.h, src/fim_types.h, src/readline.cpp, + src/string.cpp: moved basic type definitions to a separate header + file. + added an include file with type inquiry macros. + substituted several numerical constants with preprocessor + symbols. + added fim_types.h to the Makefile.am (it was missing, by + accident). + +2011-08-20 08:44 dezperado + + * configure.ac, src/FbiStuff.cpp, src/fim.h: loader string + specification can be disabled at build time, now. + +2011-08-20 08:32 dezperado + + * configure.ac, src/FbiStuff.cpp, src/fim.cpp, src/fim.h: the raw + bits rendering feature is compile time optional now. + +2011-08-20 08:15 dezperado + + * src/FbiStuff.cpp: some temporary code for a future full probing + file loader. + moved an image converting loop to a separate function. + +2011-08-18 07:43 dezperado + + * TODO, src/FbiStuff.cpp: bugfix: the only zero-mlen-signature + loader took precedence; now it does not anymore. + +2011-08-17 22:30 dezperado + + * TODO, doc/fimrc.man, src/FbiStuff.cpp, src/FbiStuffList.h, + src/FbiStuffLoader.cpp, src/FbiStuffLoader.h, src/fim.cpp, + src/fim.h, src/help.cpp: introduced a variable to force a + particular file loader. + -V output will list available file loaders. + dox update. + +2011-08-17 22:20 dezperado + + * src/FbiStuffBit1.cpp, src/FbiStuffBit24.cpp, + src/FbiStuffMatrixMarket.cpp, src/FbiStuffPng.cpp, + src/FbiStuffPpm.cpp, src/FbiStuffTiff.cpp: renamed the file + loader constant strings, so each loader has a unique name now, + without spaces in it. + code readability fix in FbiStuffPng.cpp. + +2011-08-17 22:16 dezperado + + * src/FbiStuffGif.cpp: opening gifs from stdin seems to cause + DGifOpenFileHandle=NULL: an extra check for this case. + +2011-08-17 17:50 dezperado + + * configure.ac, src/FbiStuffMagick.cpp, src/Makefile.am, + src/fim_types.h: a first interfacing to the GraphicsMagick + library (for loading files). + +2011-08-11 22:11 dezperado + + * ChangeLog, doc/Makefile.am: specified the right fimrc man section + in Makefile.am. + +2011-08-11 21:57 dezperado + + * ChangeLog, doc/fimrc.man: updated fimrc.man. + ChangeLog update. + +2011-08-11 21:28 dezperado + + * BUGS, README, TODO, VERSION, scripts/Makefile.am, + src/Browser.cpp, src/Browser.h, src/CommandConsole-help.cpp: + setting VERSION again to 0.3-beta. + added the 'list clear' command. + man fimrc goes to man section 5, not 1. + including the yacc -> grammar script and header file. + README update (thanks Marco). + notes + +2011-07-12 09:14 dezperado + + * doc/fimrc.man, src/fim.h, src/readline.cpp: the previous fix was + flawed, too, so we restrict the Esc based approach to sdl only. + +2011-07-12 08:44 dezperado + + * doc/fimrc.man, src/CommandConsole-help.cpp, + src/CommandConsole.cpp, src/fim.h, src/readline.cpp, + src/readline.h: workaround to the ESC inconvenience in non-sdl + mode: one may press the ESC key twice (introduced a trivial state + machine). + +2011-07-12 07:59 dezperado + + * THANKS, TODO, doc/fimrc.man, src/CommandConsole-help.cpp, + src/fimrc, src/readline.cpp: the previos esc-exits-readline + change introduced a problem: in framebuffer mode, arrows (among + others) are emitted as sequence of keys, the first of which is + the ESC char. therefore the arrows did emit an ESC key, exiting + the command line. + fixing limiting the esc-exits-readline do SDL mode only. + a real fix would encompass a state machine and interpretation of + sequences of input chars, but this is a major feature. + changed the order in the THANKS file. + docs update. + minor fimrc changes. + +2011-07-11 09:30 dezperado + + * doc/fimrc.man, src/CommandConsole-help.cpp, src/readline.cpp: + re-enabling windowed mode x11 input by using native aalib input + routines. + doc fixes + +2011-07-11 09:24 dezperado + + * ChangeLog, TODO, doc/fimrc.man, src/CommandConsole-help.cpp, + src/fim.h, src/readline.cpp: the Esc key will now both clear and + terminate command line mode. + +2011-07-11 00:14 dezperado + + * doc/fimrc.man, src/Browser.cpp, src/Viewport.cpp, src/Viewport.h, + src/fim.cpp, src/fim.h, src/fimrc: added a further scaling style: + 'b', scaling like 'a' when image is bigger than screen size. + invoking fim with no options will display a very short, two lines + help message. + +2011-07-10 23:21 dezperado + + * Makefile.am, TODO, src/SDLDevice.cpp, src/fim.h: makefile fix. + space binding works again. + +2011-07-10 12:39 dezperado + + * ChangeLog, Makefile.am, NEWS, configure.ac, doc/Makefile.am, + src/Makefile.am: some comments fixes in makefiles and + documentation. changelog/news update. + +2011-07-10 11:09 dezperado + + * Makefile.am, configure.ac, doc/Makefile.am, doc/fimrc.man, + src/Makefile.am: introducing variables for external utilities's + path used in the makefiles, and configure checks to detect the + proper path. + +2011-07-10 10:26 dezperado + + * src/Makefile.am: a horrible hack to bypass the isatty + redeclaration in flex, using sed. + +2011-07-09 17:45 dezperado + + * src/DisplayDevice.h, src/Makefile.am, src/lex.lex: trying to + bypass the flex isatty bug. + +2011-07-06 00:03 dezperado + + * src/Image.cpp: bypassing a certain error condition throwing an + exception on failed image cloning; instead, setting the image + invalid flag. + +2011-07-05 21:12 dezperado + + * doc/fimrc.man, src/CommandConsole.cpp, src/DisplayDevice.h, + src/SDLDevice.cpp, src/SDLDevice.h, src/fim.h, src/fimrc, + src/help.cpp: in a hack to allow control of window caption (and + display there the command/status line). + +2011-07-02 08:33 dezperado + + * ChangeLog, doc/Makefile.am, var/index.html.in: www page update. + doc (man -> html) generation fix in the makefile. + +2011-07-02 08:01 dezperado + + * doc/fimrc.man, src/CommandConsole.cpp, src/CommandConsole.h, + src/SDLDevice.cpp, src/defaultConfiguration.cpp: updating the + symbol keys table also after sdl initialization. + +2011-07-02 00:20 dezperado + + * ChangeLog, README, TODO, VERSION, configure.ac, doc/FIM.TXT, + src/CommandConsole.cpp, src/FramebufferDevice.cpp, + src/Makefile.am, src/fim.cpp, src/fim.h, src/fimrc, + src/interpreter.cpp, src/readline.cpp, var/Makefile, + var/index.html.in: updated VERSION. + by default, trying to avoid floating point exceptions. + verbose keys will prefix 0x to hex key dump. + indenting ifdefs and removed a double include in + src/FramebufferDevice.cpp. + with cd-and-readdir, will exit on empty dir. + fix to avoid unwanted readline-triggered echoing in sdl mode. + some new default bindings. + hardcoded fimrc will accept backslashes (although the language + has still some problems with them). + changelog update. + doc fix. + +2011-06-29 14:19 dezperado + + * TODO, doc/fimrc.man, src/FbiStuffBit1.cpp, src/FbiStuffBit24.cpp, + src/FbiStuffDjvu.cpp, src/FbiStuffPdf.cpp, src/FbiStuffPs.cpp, + src/fim.h, src/help.cpp: introduced two variables to control + djvu,pdf,ps rendering dpi as well as bit-based image width. + +2011-06-28 09:41 dezperado + + * TODO, src/Browser.cpp, src/fim.h, src/testdir/test8.in, + src/testdir/test8.ok: enriched the 'goto' test case. fixes to + 'goto'. + +2011-06-22 12:06 dezperado + + * TODO, doc/fimrc.man, src/Browser.cpp, src/Browser.h, + src/Cache.cpp, src/CommandConsole.cpp, src/Image.cpp, + src/Image.h, src/fim.h, src/fimrc, src/help.cpp, + src/testdir/test7.in, src/testdir/test7.ok: a horrible, + untellable hack to make the cache and multipage features look as + they both work together. + +2011-06-21 22:08 dezperado + + * doc/fimrc.man, src/fimrc: typo fix: the default fimrc had an + outdated 'repeat_last' binding. + p.s.: the previous commit adopted the usage of command tokens for + the --cd-and-readdir option. + +2011-06-21 21:37 dezperado + + * TODO, doc/fim.man, src/CommandConsole-cmd.cpp, + src/CommandConsole-init.cpp, src/CommandConsole.cpp, + src/CommandConsole.h, src/SDLDevice.cpp, src/fim.cpp, + src/readline.cpp: restricting terminal control to the framebuffer + driver only. + replacing the quit() from inside the interactive loop with a much + more elegant goto. + irrelevant code and dox fixes. + +2011-06-21 11:26 dezperado + + * NEWS, doc/fimrc.man, src/AADevice.cpp, src/SDLDevice.cpp, + src/fimrc: fix: sdl did not reinitialize mouse cursor display on + reinit. + fix: sdl did not handle CTRL + key in a correct manner. + fix: sdl/aa did not update the screen size variables on resize. + fix: the fullscreen toggle key commands are collapsed in a single + one (F11) + +2011-06-21 10:32 dezperado + + * TODO, doc/fimrc.man, src/AADevice.cpp, src/AADevice.h, + src/DisplayDevice.cpp, src/DisplayDevice.h, src/SDLDevice.cpp, + src/SDLDevice.h, src/fimrc, src/readline.cpp: in sdl mode, + consulting the 'best available' video mode when resizing to 0 0. + introduced wait-based input mode in sdl (no more pollingb). + enabled F1..F12 keys in sdl. + introduced handy key bindings for toggle fullscreen sdl. + +2011-06-21 08:38 dezperado + + * TODO, doc/fim.man, src/CommandConsole.cpp, src/SDLDevice.cpp, + src/fim.cpp: added a --no-commandline command switch. + implemented redisplaying (so, rescaling) on window resize. + +2011-06-20 16:09 dezperado + + * TODO, doc/fim.man, doc/fimrc.man, src/Browser.cpp, src/Browser.h, + src/CommandConsole-cmd.cpp, src/CommandConsole.cpp, + src/CommandConsole.h, src/common.cpp, src/common.h, src/fim.cpp, + src/fim.h: added a --cd-and-readdir option. + added a basedir command. + +2011-06-20 13:11 dezperado + + * TODO, src/fim.h, src/fimrc: unified _device_string to the command + line switch strings. + +2011-06-20 13:07 dezperado + + * NEWS, TODO, configure.ac, doc/fim.man, doc/fimrc.man, + src/Browser.cpp, src/CommandConsole-cmd.cpp, src/Makefile.am, + src/defaultConfiguration.cpp, src/fim.cpp, src/fim.h, + src/help.cpp: enabling loading of files from a supplied + directory. + change to che 'cd' command: now it will support change to a + file's dir. + +2011-06-19 14:50 dezperado + + * TODO, src/readline.cpp: bugfix: readline hooks for + option-furnished sdl specification did not activate. + +2011-06-19 14:21 dezperado + + * TODO, doc/fim.man, doc/fimrc.man, src/Browser.cpp, + src/CommandConsole.cpp, src/CommandConsole.h, + src/DisplayDevice.h, src/SDLDevice.cpp, src/SDLDevice.h, + src/fim.cpp: allowing command line triggered display reinit. + doc fixes. + a bugfix in the man dumping code. + +2011-06-18 09:14 dezperado + + * TODO, doc/fim.man, src/AADevice.cpp, src/CommandConsole-init.cpp, + src/DebugConsole.cpp, src/SDLDevice.cpp, src/SDLDevice.h, + src/fim.cpp: fixing oddities (output console not showing up) + related to resizing, in aa and sdl modes (enforcing a minimal + size). + doc fixes. + +2011-06-18 01:16 dezperado + + * TODO, src/AADevice.cpp, src/CommandConsole.cpp, + src/DebugConsole.cpp, src/SDLDevice.cpp: adapted both the sdl and + aa modes to support any window size (aa will revert on zero, + though). + +2011-06-17 23:17 dezperado + + * TODO, src/AADevice.cpp, src/CommandConsole.cpp, + src/CommandConsole.h, src/SDLDevice.cpp: taking the common code + subset in aa/sdl's resizing code in a separate routine. + +2011-06-17 20:44 dezperado + + * TODO, src/AADevice.cpp: inserted some (deactivated) code using aa + facilities for character proportion detection (but aa fails + guessing). + notes. + +2011-06-17 20:28 dezperado + + * TODO, src/AADevice.cpp, src/AADevice.h, src/DisplayDevice.cpp: + utterly horrible hack allowing the window resize in aalib + windowed mode. + +2011-06-17 19:44 dezperado + + * doc/fim.man, src/CommandConsole.h, src/DisplayDevice.cpp, + src/DisplayDevice.h, src/SDLDevice.cpp, src/SDLDevice.h, + src/Window.cpp, src/Window.h, src/fim.cpp, src/fim.h: utterly + horrible hack allowing the window resize in SDL windowed mode. + +2011-06-16 11:42 dezperado + + * Makefile.am, TODO, doc/Makefile.am, doc/fim.man, doc/fimrc.man, + src/Browser.cpp, src/CommandConsole-help.cpp, + src/CommandConsole.cpp, src/Viewport.cpp, + src/defaultConfiguration.cpp, src/fim.cpp, src/fim.h, src/fimgs, + src/help.cpp: forcing some variables to have some strict values + to be effective. + reactivated and documented some debug variables. + documented several internal variables. + cleaning up the minimal hardcoded config file. + added an USAGE section in man fim. + misc automake and doc fixes. + TODO file re-sorting and cleanup. + +2011-06-16 00:54 dezperado + + * TODO, doc/fimrc.man, src/CommandConsole-help.cpp, + src/Makefile.am, src/examples.h, src/fim.h, src/help-acm.cpp, + src/help.cpp: adding three auto-generated files. + automake fixes. + doc fixes: documenting the existing autocommands. + +2011-06-15 17:23 dezperado + + * TODO, doc/fimrc.man, src/Browser.cpp, src/Browser.h, + src/CommandConsole.cpp, src/common.cpp, src/common.h, src/fim.h, + src/yacc.ypp: got rid of fcmd_scale_multiply, + fcmd_scale_increment, fcmd_scale_factor_grow, + fcmd_scale_factor_increase, fcmd_scale_factor_decrease, + fcmd_scale_factor_shrink. + renamed set_console_mode to set_commandline_mode. + heavy fixes to the 'scale' implementation (impacting the parser) + +2011-06-15 11:46 dezperado + + * TODO, doc/fimrc.man, src/Browser.cpp, src/CommandConsole.cpp, + src/defaultConfiguration.cpp, src/fim.h: inhibited a number of + obsolete scale commands, and replacing them with aliases. + doc update. + +2011-06-15 11:09 dezperado + + * TODO, src/Browser.cpp, src/defaultConfiguration.cpp, src/fim.cpp, + src/fim.h: enriching the 'scale' command parser, in this way + obsoleting some scale factors manipulating commands. + +2011-06-15 10:07 dezperado + + * doc/fimrc.man, src/CommandConsole.cpp, src/fim.h: commands are + now listed in sorted order, in the man page. + +2011-06-15 09:49 dezperado + + * Makefile.am, TODO, doc/fim.man, doc/fimrc.man, src/Browser.cpp, + src/Browser.h, src/CommandConsole.cpp, src/CommandConsole.h, + src/Image.cpp, src/defaultConfiguration.cpp, src/fim.h: renamed + the internal alias command. + deleted obsolete *next* machinery. + documentation updates for the goto command. + some new preprocessor macros for aliases. + documenting hardcoded aliases. + a test case for the status returning quit. + +2011-06-14 22:53 dezperado + + * TODO, doc/fimrc.man, src/CommandConsole-cmd.cpp, + src/CommandConsole.cpp, src/CommandConsole.h, src/fim.h, + src/testdir/test1.in, src/testdir/test13.in, + src/testdir/test3.in, src/testdir/test4.in, src/testdir/test5.in, + src/testdir/test6.in, src/testdir/test6.ok, src/testdir/test7.in: + removed the 'return' command. functionality now absolved by + 'quit' + +2011-06-14 22:08 dezperado + + * TODO, src/Browser.cpp, src/Browser.h, src/CommandConsole.cpp, + src/defaultConfiguration.cpp, src/fim.cpp, src/fim.h, src/fimrc: + making aliases out of the next_picture, prev_picture, next_image, + prev_image commands. + +2011-06-14 21:31 dezperado + + * src/Browser.cpp, src/Browser.h, src/CommandConsole.cpp, + src/defaultConfiguration.cpp, src/fim.h, src/fimrc, + src/testdir/test14.ok: shortening definition, but still + preserving operation of 'next'/'prev' commands (now hardcoded + aliases). + +2011-06-14 20:46 dezperado + + * TODO, doc/fimrc.man, src/Browser.cpp, src/Browser.h, + src/Image.cpp, src/Image.h, src/fim.h, src/fimrc, + src/testdir/test8.in: empowering an inner "goto" function. + fimrc fix. + +2011-06-13 11:31 dezperado + + * TODO, src/SDLDevice.cpp: bugfix to the sdl resolution + specification reading mechanism: it used to lead to segfaults + with bad specification strings. + +2011-06-13 11:02 dezperado + + * TODO, configure.ac, doc/fim.man, doc/fimrc.man, src/Browser.cpp, + src/CommandConsole-init.cpp, src/CommandConsole.cpp, + src/DebugConsole.cpp, src/FbiStuff.cpp, src/Var.h, + src/defaultConfiguration.cpp, src/fim.cpp, src/fim.h, src/fimrc: + introducing stricter value requirements on of some on-off integer + variables. + introduced a FIM_VID_VERSION variable. + introduced a FIM_WANT_HISTORY preprocessor switch for history + load/save. + introduce a fim_int typedef, to be extended in use. + introduced --no-history-save,--no-history-load,--no-history + command switches. + --version will print out the readline library version. + yacc/bison checks (with no implication) in the configure. + added a --no-auto-scale switch. + doc fixes and TODO cleanup. + +2011-06-13 00:56 dezperado + + * Makefile.am, TODO, doc/fim.man, doc/fimrc.man, + src/CommandConsole.cpp, src/CommandConsole.h, + src/defaultConfiguration.cpp, src/fim.cpp, src/fim.h: introduced + the --no-internal-config switch. + coherence fixes to a manual section listing common keys. + +2011-06-12 23:41 dezperado + + * VERSION, doc/fim.man, src/AADevice.cpp, src/AADevice.h, + src/CACADevice.cpp, src/CACADevice.h, src/CommandConsole-cmd.cpp, + src/CommandConsole-init.cpp, src/CommandConsole.cpp, + src/CommandConsole.h, src/DisplayDevice.h, + src/DummyDisplayDevice.h, src/FramebufferDevice.h, + src/SDLDevice.cpp, src/SDLDevice.h, src/defaultConfiguration.cpp, + src/fim.cpp, src/fim.h: batch identifier change: key_bindings -> + sym_keys; inverse_key_bindings -> key_syms. + doc fixes. + +2011-06-12 22:59 dezperado + + * TODO, doc/fimrc.man, src/Browser.cpp, src/Browser.h, + src/CommandConsole.cpp, src/common.cpp, src/common.h, src/fim.h, + src/fimrc, src/readline.cpp, src/readline.h, src/yacc.ypp: + regexp_goto,regexp_goto_next commands are now collapsed in the + goto command. + renamed last_regex to last_regexp_. + +2011-06-12 19:55 dezperado + + * TODO, doc/fimrc.man, src/Browser.cpp, src/Browser.h, + src/CommandConsole-cmd.cpp, src/CommandConsole.cpp, + src/CommandConsole.h, src/fim.h, src/fimrc: collapsed the + files,mark,unmark commands as subcommands of the list command. + +2011-06-12 19:30 dezperado + + * TODO, doc/fimrc.man, src/Browser.cpp, src/Browser.h, + src/CommandConsole.cpp, src/fim.h, src/fimrc: collapsed + align_top,align_bottom to the single align command. + +2011-06-12 18:57 dezperado + + * TODO, doc/fimrc.man, src/CommandConsole-cmd.cpp, + src/CommandConsole.cpp, src/CommandConsole.h, src/fim.cpp, + src/fim.h, src/fimrc: collapsed the *recording* commands into a + single 'recording' command. + +2011-06-12 18:01 dezperado + + * TODO, doc/fimrc.man, src/Browser.cpp, src/Browser.h, + src/CommandConsole.cpp, src/fim.h, src/fimrc, + src/testdir/test13.in: collapsed the pop,push,remove commands + into the list command + +2011-06-12 17:12 dezperado + + * TODO, src/Browser.cpp, src/Browser.h, src/CommandConsole-cmd.cpp, + src/CommandConsole-init.cpp, src/CommandConsole.cpp, + src/CommandConsole.h, src/Window.cpp, src/Window.h: prepending + with 'fcmd_' all the remaining command routine identifiers. + +2011-06-12 16:47 dezperado + + * src/CommandConsole-cmd.cpp, src/CommandConsole.cpp, + src/CommandConsole.h: prepending all fim command routines names + with 'fcmd_', for the CommandConsole class. + +2011-06-12 16:04 dezperado + + * TODO, src/CommandConsole-cmd.cpp, src/CommandConsole-init.cpp, + src/CommandConsole.cpp, src/CommandConsole.h, src/fim.h: renamed + execute(char*,bool,bool) to execute_internal(char*,flags), for a + more flexible execution specification. + +2011-06-12 15:16 dezperado + + * TODO, src/Browser.cpp, src/Browser.h, src/Cache.cpp, + src/CommandConsole-cmd.cpp, src/CommandConsole-init.cpp, + src/CommandConsole.cpp, src/FbiStuff.cpp, src/Image.cpp, + src/Var.cpp, src/common.cpp, src/fim.cpp, src/string.cpp: + enforcing the use of the FIM_CNS_EMPTY_STRING macro instead of + the "" constant. + +2011-06-12 15:04 dezperado + + * TODO, doc/fimrc.man, src/Browser.cpp, src/Browser.h, + src/CommandConsole.cpp, src/fim.h, src/fimrc: collapsed the + random_shuffle, sort, and reverse commands as subcommands of the + list command. + dox fixes. + +2011-06-12 14:25 dezperado + + * TODO, doc/fim.man, doc/fimrc.man, src/CommandConsole-help.cpp, + src/CommandConsole.cpp, src/fim.cpp, src/fim.h, src/fimrc: + introduced a variable for the control of autocompletion. + doc typo fix. + +2011-06-12 12:40 dezperado + + * TODO, doc/fim.man, doc/fimrc.man, src/defaultConfiguration.cpp, + src/fim.cpp, src/fim.h, src/fim_stream.cpp, src/fim_stream.h, + src/fimrc, src/testdir/test13.in, src/testdir/test7.in, + src/testdir/test8.in: no more aliases defined by fim defaults + before any config. + prepended with _ even more internal variables, and commented them + more. + adapted the tests suite consequently. + some more support for other streams in the fim_stream class. + doc fixes. + +2011-06-12 00:07 dezperado + + * src/Browser.cpp, src/Browser.h, src/CommandConsole.cpp, + src/fim.h: enforcing FIM_WANT_SINGLE_PAN_COMMAND by removing + redundant, dead code. + +2011-06-11 23:57 dezperado + + * doc/fimrc.man, src/Browser.cpp, src/Browser.h, + src/CommandConsole.cpp, src/fim.h: removing + FIM_WANT_SINGLE_SCALE_COMMAND and enforcing a single scaling + command. + doc fixes. + +2011-06-11 23:49 dezperado + + * TODO, doc/fimrc.man, src/CommandConsole-cmd.cpp, + src/CommandConsole.cpp, src/fim.h, src/fimrc: removed the double + 'info' command registration. + documented the 'set' command. + fimrc fixes. + +2011-06-11 23:07 dezperado + + * TODO, doc/fimrc.man, src/defaultConfiguration.cpp, src/fim.h, + src/fimrc: prepending an underscore (_) to a number of internal + variables. + +2011-06-11 21:42 dezperado + + * TODO, doc/fim.man, doc/fimrc.man, src/CommandConsole-cmd.cpp, + src/CommandConsole-init.cpp, src/CommandConsole.cpp, + src/CommandConsole.h, src/fim.cpp, src/fim.h, src/fimrc: added a + -C (--execute-commands-early) switch for adding commands to + execute before any config. + renamed by prepending with underscore some fim variables. + fixed a critical bug in the 'return' command (used to segfault). + now on, the fimrc will set (internal) variables only if not + already set. + doc/notes update. + +2011-06-10 21:33 dezperado + + * Makefile.am, doc/fimgs.man, + scripts/maintenance/buildbot-master.cfg.sample, src/fimgs: an + update to the fimgs script and man file. + update to the buildbot master config file (doing 'make clean' + now). + makefile fix. + +2011-06-10 18:45 dezperado + + * TODO, doc/fim.man, doc/fimrc.man, src/CommandConsole.cpp, + src/defaultConfiguration.cpp, src/fim.h, src/fimrc: doc fixes for + the pan command. + the pan aliases are now declared in the fimrc. + some obsolete variables are now undeclared and ready for removal. + cleanup in the fimrc. + documented the --autoheight fim command option (added in the + previous commit). + documented the _scale_style variable. + +2011-06-10 18:07 dezperado + + * src/defaultConfiguration.cpp, src/fim.cpp, src/fim.h, src/fimrc: + the hardcoded fimrc (and the code) will now use a single variable + for the user preferred scaling option. + renamed some other variable, some cleanup in the fimrc. + +2011-06-10 17:11 dezperado + + * TODO, doc/fimrc.man, src/Browser.cpp, src/Browser.h, + src/CommandConsole.cpp, src/fim.h, src/testdir/Makefile, + src/testdir/test14.ok: gracefully replaced three commands with + three aliases and some more interpretation of scaling specifiers. + +2011-06-10 13:40 dezperado + + * TODO, doc/fim.man, doc/fimrc.man, src/Browser.cpp, src/Browser.h, + src/Viewport.cpp, src/Viewport.h, src/fim.cpp, src/fim.h, + src/fimrc: the new panning code is active by default now. + updated the scroll* commands to use the new panning code. + disabled the aalib fix: it seems obsolete, now. + some key rebindings. + +2011-06-10 12:34 dezperado + + * TODO, doc/fimrc.man, src/Browser.cpp, src/Browser.h, + src/CommandConsole.cpp, src/FramebufferDevice.cpp, + src/FramebufferDevice.h, src/Viewport.cpp, src/Viewport.h, + src/fim.h: introduced a single panning function, interpreting the + % specifier. + +2011-06-09 19:20 dezperado + + * TODO, doc/fimrc.man, src/Browser.cpp, src/CommandConsole.cpp: + implemented the % specifier interpretation in the goto command. + +2011-06-09 13:45 dezperado + + * TODO, configure.ac, doc/fim.man, doc/fimgs.man, src/fim.cpp: + minor doc fixes: the config line will be displayed in --version; + stdin handling docs. + +2011-06-03 09:06 dezperado + + * BUGS, NEWS, VERSION, src/CommandConsole.cpp, + src/CommandConsole.h, src/Window.cpp, src/Window.h: fixed the + missing command replacing in addCommand. + temporarily disabling the internal windowing splitting. + +2011-06-02 18:28 dezperado + + * BUGS, ChangeLog, Makefile.am, NEWS, README, VERSION, doc/FIM.TXT, + doc/Makefile.am, doc/fim.man, doc/fimrc.man, src/fim.cpp, + src/fim.h, var/Makefile, var/index.html.in, var/www/fim.css: + massive documentation update: www page/scripts, man pages, + FIM.TXT, ChangeLog, etc. + +2011-06-02 12:23 dezperado + + * configure.ac, src/FbiStuffPdf.cpp, src/fim.cpp, src/fimrc: + implemented a hack for viewing (one-page) pdf files from stdin + (poppler needs seekable files (with filenames)) on /proc-equipped + systems. + some doc typo fixes. + +2011-06-01 23:33 dezperado + + * README, TODO, configure.ac, doc/fimrc.man, + src/CommandConsole-cmd.cpp, src/CommandConsole.cpp, + src/CommandConsole.h, src/Image.cpp, src/fim.cpp: enabling back + the 'pread' command, which reads images from a piped descriptor. + docfixes. + +2011-06-01 21:33 dezperado + + * TODO, src/FramebufferDevice.cpp, src/FramebufferDevice.h: fix to + a serious bug: 32 bit framebuffer mode used to segfault on 64 bit + builds. + +2011-05-31 22:43 dezperado + + * TODO, doc/fim.man, doc/fimrc.man, src/CommandConsole.cpp, + src/CommandConsole.h, src/fim.cpp, src/fim.h: implemented a + trivial slideshow command switch. + doc fies. + +2011-05-31 22:07 dezperado + + * README, TODO, src/FramebufferDevice.cpp, src/FramebufferDevice.h: + removed a spurios class member, thus eliminating an useless + compilation warning. + +2011-05-30 00:31 dezperado + + * TODO, configure.ac, doc/FIM.TXT, doc/fim.man, src/fim.cpp: + documentation oriented updates. + +2011-05-29 23:32 dezperado + + * Makefile.am, configure.ac, doc/fim.man, doc/fimrc.man, + src/CommandConsole-cmd.cpp, src/CommandConsole-init.cpp, + src/CommandConsole.cpp, src/FbiStuff.cpp, src/fim.cpp, src/fim.h, + src/fimrc, src/testdir/Makefile: honouring /etc/fimrc loading. + cd implies pwd and update of the PWD variable. + introduced new autocommands. + updating the no-configuration command switches (an applying in + the test suite). + the hardcoded config now comes first, before the /etc/fimrc file. + the ~/.fimrc config file now comes after /etc/fimrc. + avoiding double loading of the hardcoded config. + fixed the getopt string: the 'f:' option was missing. + added a --no-etc-rc-file switch. + corrected the semantics of the -f option. + checking for failure after the lexer allocation. + doc update. + configure update, in the matrix marked switch handling. + +2011-05-29 13:01 dezperado + + * TODO, doc/fim.man, doc/fimrc.man, src/CommandConsole-init.cpp, + src/CommandConsole.cpp, src/CommandConsole.h, src/FbiStuff.cpp, + src/fim.cpp, src/fim.h: set up a autocommand keywords, to + correctly handle command line options which imply autocommands + (e.g.: --offset). + +2011-05-29 11:38 dezperado + + * TODO, doc/fim.man, src/DisplayDevice.cpp, src/FontServer.cpp, + src/FontServer.h, src/FramebufferDevice.cpp, src/fim.cpp, + src/fim.h: the SDL driver will now be fully affected by font + selection mechanism, just as the framebuffer driver does. + auto-documenting the font search path. + doc/man fixes. + +2011-05-28 12:48 dezperado + + * configure.ac, src/FbiStuffMatrixMarket.cpp: the matrix market + renderer is active again (if `configure`d). + +2011-05-28 11:50 dezperado + + * TODO, doc/fimrc.man, src/CommandConsole-cmd.cpp, + src/CommandConsole.cpp, src/CommandConsole.h, src/Makefile.am, + src/fim.h, src/fimrc: fixed the bound keys dumpout problem. + added functionality to allow binding commands to raw keys. + +2011-05-28 09:57 dezperado + + * TODO, doc/fimrc.man, src/FbiStuff.cpp, src/Image.cpp, src/fim.h, + src/fimrc: introduced a variable, so the user may turn off + external decoding of an unknown image file by piping it through + an external program. + +2011-05-28 09:30 dezperado + + * TODO, configure.ac, doc/fimrc.man, scripts/Makefile.am, + src/CommandConsole-cmd.cpp, src/CommandConsole.cpp, + src/CommandConsole.h, src/FbiStuffFbtools.cpp, + src/FramebufferDevice.cpp, src/fim.h, src/fimrc: small makefile + (distributing some more files) and configure (checking for some + headers) fixes. + added an 'unmark' command. + +2011-05-23 18:39 dezperado + + * doc/fim.man, doc/fimrc.man, src/CommandConsole-help.cpp, + src/CommandConsole-init.cpp, src/CommandConsole.cpp, src/fim.cpp, + src/fim.h: set up a hack for producing man documention for the + "window" command. + the -V version string will print also versions of jpg,png,gif + libraries, as declared in their headers. + doc updates. + +2011-05-23 12:51 dezperado + + * AUTHORS, BUGS, COPYING, ChangeLog, autogen.sh, configure.ac, + debian/watch, doc/FIM.TXT, doc/Makefile.am, doc/Makefile.old, + doc/doctags.c, doc/fim.man, doc/fimgs.man, doc/fimrc.man, + doc/vim2html.pl, scripts/benchmark.sh, src/AADevice.cpp, + src/AADevice.h, src/Arg.cpp, src/Arg.h, src/Browser.cpp, + src/Browser.h, src/CACADevice.cpp, src/CACADevice.h, + src/Cache.cpp, src/Cache.h, src/Command.cpp, src/Command.h, + src/CommandConsole-cmd.cpp, src/CommandConsole-help.cpp, + src/CommandConsole-init.cpp, src/CommandConsole.cpp, + src/CommandConsole.h, src/DebugConsole.cpp, src/DebugConsole.h, + src/DisplayDevice.cpp, src/DisplayDevice.h, + src/DummyDisplayDevice.h, src/FbiStuff.cpp, src/FbiStuff.h, + src/FbiStuffBit1.cpp, src/FbiStuffBit24.cpp, src/FbiStuffBmp.cpp, + src/FbiStuffDjvu.cpp, src/FbiStuffFbtools.cpp, + src/FbiStuffFbtools.h, src/FbiStuffGif.cpp, src/FbiStuffJpeg.cpp, + src/FbiStuffList.h, src/FbiStuffLoader.cpp, src/FbiStuffLoader.h, + src/FbiStuffMatrixMarket.cpp, src/FbiStuffPdf.cpp, + src/FbiStuffPng.cpp, src/FbiStuffPpm.cpp, src/FbiStuffPs.cpp, + src/FbiStuffTiff.cpp, src/FontServer.cpp, src/FontServer.h, + src/FramebufferDevice.cpp, src/FramebufferDevice.h, + src/Image.cpp, src/Image.h, src/Namespace.cpp, src/Namespace.h, + src/SDLDevice.cpp, src/SDLDevice.h, src/Var.cpp, src/Var.h, + src/Viewport.cpp, src/Viewport.h, src/Window.cpp, src/Window.h, + src/common.cpp, src/common.h, src/defaultConfiguration.cpp, + src/fim.cpp, src/fim.h, src/fim_stream.cpp, src/fim_stream.h, + src/grammar.h, src/interpreter.cpp, src/lex.h, src/readline.cpp, + src/readline.h, src/string.cpp, src/string.h: substituting svn + property LastChangedDate with property Id. + +2011-05-23 11:46 dezperado + + * TODO, doc/fim.man, doc/fimrc.man, src/CommandConsole-cmd.cpp, + src/CommandConsole-help.cpp, src/CommandConsole.cpp, src/fim.cpp, + src/fim.h: fixing many documentation strings, also using + preprocessor substring symbols. + man update. + +2011-05-22 22:47 dezperado + + * TODO, doc/fimrc.man, src/CommandConsole-cmd.cpp, + src/CommandConsole-init.cpp, src/CommandConsole.cpp, src/fim.h: + making variables accessible from within the help system. + +2011-05-22 17:56 dezperado + + * src/CommandConsole.cpp, src/Namespace.cpp, src/Namespace.h, + src/fim.h, src/readline.cpp, src/string.h: enabling + autocompletion of individual namespace-prefixed variables. + std::string -> fim::string constructor compatibility. + +2011-05-22 14:39 dezperado + + * TODO, src/CommandConsole-cmd.cpp, src/CommandConsole.cpp, + src/CommandConsole.h, src/common.cpp, src/common.h, + src/readline.cpp, src/readline.h: the autocompletion mechanism + won't autocomplete strings with filename proposals unless double + quoted. + on the other hand, a double quote will be proposed for + autocompletion, when autocompleting the empty string. + +2011-05-22 13:35 dezperado + + * src/string.cpp: bugfix to the regexp substitution function. + +2011-05-17 16:48 dezperado + + * BUGS, TODO, doc/fim.man, doc/fimrc.man, + src/CommandConsole-help.cpp, src/CommandConsole.cpp, src/fim.cpp, + src/fimrc: documenting fim commands. + adding the default hardcoded fimrc inline in fimrc.man. + updated the short fim description in fim.man. + +2011-05-17 15:53 dezperado + + * src/fimrc, src/testdir/test12.in, src/testdir/test7.in: fix to + the failing tests: the test cases had to be updated to use a now + renamed variable. + +2011-05-17 15:34 dezperado + + * Makefile.am, TODO, doc/fim.man, doc/fimrc.man, scripts/example, + scripts/example/oneline.fim, src/CommandConsole-help.cpp, + src/CommandConsole-init.cpp, src/Makefile.am, src/fim.cpp, + src/fim.h, src/grammar.h: documenting the internal variables. + misc documentation fixes. + seems like a bug was introduced, inducing test 7 to fail. shall + fix this soon. + +2011-05-17 13:17 dezperado + + * doc/fimrc.man, src/CommandConsole-help.cpp, src/yacc.ypp: did + some swaps in the grammar specification, in order to make grammar + documentation more understandable. + doc updates. + +2011-05-17 12:59 dezperado + + * configure.ac, doc/fimrc.man, src/CommandConsole-help.cpp, + src/Makefile.am, src/lex.lex, src/yacc.ypp: renamed a number of + grammar elements to be more understandable in plain english. + more textual descriptions of the fim language. + +2011-05-17 09:49 dezperado + + * doc/fimrc.man, scripts/maintenance/yacc2grammar.awk, + scripts/maintenance/yacc2grammar.h, src/CommandConsole-help.cpp, + src/Makefile.am, src/fim.cpp: set up a dirty hack to document the + fim grammar in fimrc.man. + +2011-05-16 13:16 dezperado + + * src/CommandConsole-init.cpp: smarter error reporting on failed + video device initialization. + +2011-05-16 13:08 dezperado + + * TODO, doc/fim.man, src/CommandConsole-init.cpp, + src/SDLDevice.cpp, src/SDLDevice.h, src/fim.cpp, src/fim.h: + enabling case insensitive device string specification. + allowing the user to specify mouse hide/show in sdl mode. + doc updates. + +2011-05-16 12:16 dezperado + + * TODO, configure.ac, doc/fim.man, src/FbiStuff.cpp, + src/SDLDevice.cpp, src/fim.cpp, src/fim.h: using more macro + constants in the man generation code. + the SDL driver will print program version in the window title. + doc/notes fixes. + +2011-05-15 20:53 dezperado + + * doc/FIM.TXT, doc/fim.man, src/Cache.cpp, + src/CommandConsole-init.cpp, src/CommandConsole.cpp, + src/CommandConsole.h, src/FramebufferDevice.cpp, + src/FramebufferDevice.h, src/SDLDevice.cpp, src/SDLDevice.h, + src/fim.cpp, src/fim.h: added an extension for specifying + resolution in sdl mode. + added some support for debugging in the cache code. + support for the quit button in windowed sdl mode. + docs update. + +2011-05-15 17:53 dezperado + + * src/CommandConsole.cpp, src/SDLDevice.cpp: enabling key repeat in + sdl mode. + fixing interruption of iterated commands in sdl mode. + +2011-05-15 13:17 dezperado + + * src/CommandConsole.cpp, src/fim.h, src/yacc.ypp: fix to the + expression parsing code: forgot to include the unquoted float as + a case. + using symbols for commands in the yacc.ypp file. + +2011-05-15 12:38 dezperado + + * TODO, src/lex.lex, src/yacc.ypp: fixed the broken [+-*]{number} + syntax. + +2011-05-15 11:21 dezperado + + * src/fim.cpp, src/fim.h, src/fim_stream.cpp, src/fim_stream.h, + src/readline.cpp: avoiding the redeclaration of a fim_stream in + each source file. + on the way of enhancing fim_stream by adding state to it. + +2011-05-15 10:20 dezperado + + * TODO, src/CommandConsole.cpp, src/fim.h: fix to a problem + occurring in sdl mode when iterating commands. + +2011-05-14 22:17 dezperado + + * src/common.cpp, src/string.cpp: fix to the regexp-based + substitution code (it had a severe bug). + fix to the escaping code (for /bin/sh) when handling the + apostrophe. + +2011-05-11 13:17 dezperado + + * src/DisplayDevice.cpp: the console rows variable will now affect + also the console background clearing code. + +2011-05-11 12:50 dezperado + + * src/CommandConsole-cmd.cpp, src/common.cpp, src/common.h: in a + basic shell escaping of strings passed to popen(). + +2011-05-09 00:47 dezperado + + * configure.ac: in an initial configure switch to ease static + compilation. + +2011-05-08 00:26 dezperado + + * doc/fimrc.man, src/CommandConsole-help.cpp, src/fim.cpp, + src/fim.h: typo fix in the manual generation code; using more + defined constants now. + +2011-05-08 00:21 dezperado + + * src/CommandConsole-init.cpp: typo fix for the no-scripting case. + +2011-05-07 23:53 dezperado + + * Makefile.am, doc/fim.man, src/CommandConsole-help.cpp: in a + makefile rule for regenerating both the fim/fimrc man pages. + updated doc/fim.man accordingly. + +2011-05-07 23:46 dezperado + + * src/fim.cpp: fim is now able to print its own man page with + complete and up-to-date information. + +2011-05-07 22:52 dezperado + + * src/fim.cpp, src/fim.h, src/string.cpp, src/string.h: fim is now + able to print its own man page with almost complete information. + added a from-char constructor to our string class. + +2011-05-07 20:21 dezperado + + * TODO, src/Browser.cpp, src/CommandConsole-cmd.cpp, + src/CommandConsole-help.cpp, src/CommandConsole.cpp, + src/Image.cpp, src/Namespace.cpp, src/Window.cpp, src/fim.cpp, + src/fim.h: instead of "", returning FIM_CNS_EMPTY_RESULT in many + string returning functions. + +2011-05-07 19:33 dezperado + + * src/FbiStuff.cpp, src/FbiStuffBit1.cpp, src/FbiStuffBit24.cpp, + src/FbiStuffBmp.cpp, src/FbiStuffDjvu.cpp, src/FbiStuffGif.cpp, + src/FbiStuffJpeg.cpp, src/FbiStuffLoader.cpp, + src/FbiStuffLoader.h, src/FbiStuffMatrixMarket.cpp, + src/FbiStuffPdf.cpp, src/FbiStuffPng.cpp, src/FbiStuffPpm.cpp, + src/FbiStuffPs.cpp, src/FbiStuffTiff.cpp, + src/FramebufferDevice.cpp, src/FramebufferDevice.h, src/fim.cpp, + src/fim.h: prepended 'fim_' to some global labels. + using fim_char_t in place of unsigned char in a number of places. + +2011-05-07 15:50 dezperado + + * TODO, doc/fim.man, doc/fimrc.man, src/Browser.h, + src/CommandConsole-help.cpp, src/fim.cpp, src/fim.h: the random + shuffle switch will now trigger right after filelist loading. + the default -h mode is now 'short'; added a --help=d + (descriptive) mode for the short info version. + +2011-05-07 14:52 dezperado + + * TODO, doc/Makefile.am, doc/fim.man, doc/fimrc.man, + src/CommandConsole-help.cpp: man pages update. + in a new man page: fimrc.man, which is auto-generated. + +2011-05-07 14:21 dezperado + + * doc/FIM.TXT, src/CommandConsole.cpp, src/FramebufferDevice.cpp, + src/fim.cpp, src/fim.h, src/fimrc: introducing some more symbols + for built-in commands. + renamed bottom_align and top_align respectively to align_bottom + and align_top. + +2011-05-07 13:34 dezperado + + * src/Browser.cpp, src/Browser.h, src/CommandConsole.cpp, + src/fim.cpp, src/fim.h: implemented "reverse" and "shuffle" + commands. + enabled the -u/--random switch. + +2011-05-07 13:14 dezperado + + * src/CommandConsole-cmd.cpp, src/CommandConsole-help.cpp, + src/CommandConsole.cpp, src/CommandConsole.h, src/Makefile.am, + src/Var.cpp, src/Var.h, src/fim.cpp, src/fim.h: introducing troff + output with the --dump-reference-help=man switch. + moving help-related dumping methods to a separate file. + +2011-05-07 12:16 dezperado + + * TODO, src/fim.cpp: introducing self-documented fim command + switches. + +2011-05-07 00:01 dezperado + + * src/Browser.cpp, src/CommandConsole.cpp, src/CommandConsole.h, + src/Image.cpp, src/Image.h, src/fim.h: some further fix with + proper type declarations. + +2011-05-06 23:14 dezperado + + * src/Viewport.cpp, src/Viewport.h, src/Window.cpp, src/Window.h: + introducing the use of specific types further in classes + Viewport, Window. + +2011-05-06 17:51 dezperado + + * src/Image.cpp, src/Image.h, src/Viewport.cpp, src/Viewport.h, + src/Window.cpp, src/fim.h: introducing the use of specific types + in classes Image, Viewport, Window. + +2011-05-06 17:06 dezperado + + * src/FramebufferDevice.cpp, src/SDLDevice.cpp, src/SDLDevice.h, + src/fim.h: bugfix: signed values were read where unsigned were + needed. + privatized some members of the SDLDevice class. + fim_coo_t is signed again now (for no particular reason, though). + +2011-05-06 16:17 dezperado + + * src/AADevice.cpp, src/AADevice.h, src/CACADevice.cpp, + src/CACADevice.h, src/DebugConsole.cpp, src/DebugConsole.h, + src/DisplayDevice.cpp, src/DisplayDevice.h, + src/DummyDisplayDevice.h, src/FramebufferDevice.cpp, + src/FramebufferDevice.h, src/SDLDevice.cpp, src/SDLDevice.h, + src/fim.h: adopting usage of fim_char_t and fim_err_t in more + methods of DisplayDevice classes. + +2011-05-06 14:45 dezperado + + * src/AADevice.cpp, src/AADevice.h, src/CACADevice.cpp, + src/CACADevice.h, src/CommandConsole-init.cpp, + src/CommandConsole.cpp, src/DebugConsole.cpp, src/DebugConsole.h, + src/DisplayDevice.cpp, src/DisplayDevice.h, + src/DummyDisplayDevice.h, src/FontServer.cpp, src/FontServer.h, + src/FramebufferDevice.cpp, src/FramebufferDevice.h, + src/SDLDevice.cpp, src/SDLDevice.h, src/fim.h: adopting usage of + fim_char_t and fim_err_t in a number of DisplayDevice classes + methods. + +2011-05-06 13:24 dezperado + + * TODO, configure.ac, src/CommandConsole.cpp, src/FbiStuff.cpp, + src/FontServer.cpp, src/FramebufferDevice.cpp, src/SDLDevice.cpp, + src/common.cpp, src/common.h, src/fim.cpp, src/fim.h, + src/lex.lex: introduced fim_perror, and reacting to errno status. + +2011-05-03 16:39 dezperado + + * TODO, src/DebugConsole.cpp, src/fimrc: scrolling the console + won't cycle around. + +2011-05-03 16:13 dezperado + + * TODO, src/CommandConsole.cpp, src/Namespace.cpp, src/fim.cpp, + src/fim.h, src/interpreter.cpp: introducing and using + FIM_SYM_ENDL and some other symbols. + +2011-05-03 15:49 dezperado + + * src/CommandConsole-cmd.cpp, src/DisplayDevice.cpp, + src/Namespace.cpp, src/Viewport.cpp, src/fim.cpp: fix to the + previous commit. + +2011-05-03 15:24 dezperado + + * src/CommandConsole-init.cpp, src/CommandConsole.cpp, + src/CommandConsole.h, src/defaultConfiguration.cpp: enforcing the + new member variable name rule in class CommandConsole. + +2011-05-03 15:01 dezperado + + * src/Command.h, src/CommandConsole.cpp: enforcing the new member + variable name rule in class Command. + +2011-05-03 14:48 dezperado + + * src/Arg.h, src/Cache.cpp, src/Cache.h, src/CommandConsole.cpp: + enforcing the new member variable name rule in class Var. + comments in Cache.cpp/Cache.h. + +2011-05-03 14:45 dezperado + + * src/Cache.cpp, src/Cache.h: enforcing the new member variable + name rule in class Cache. + +2011-05-03 14:41 dezperado + + * src/DebugConsole.cpp, src/DebugConsole.h, + src/FramebufferDevice.cpp: enforcing the new member variable name + rule in class DebugConsole. + +2011-05-03 14:29 dezperado + + * src/SDLDevice.cpp, src/SDLDevice.h: enforcing the new member + variable name rule in class SDLDevice. + +2011-05-03 14:18 dezperado + + * src/AADevice.cpp, src/AADevice.h: enforcing the new member + variable name rule in class AADevice. + +2011-05-03 14:05 dezperado + + * src/FramebufferDevice.cpp, src/FramebufferDevice.h: enforcing the + new member variable name rule in class FramebufferDevice. + +2011-05-03 13:24 dezperado + + * src/AADevice.cpp, src/CommandConsole-init.cpp, + src/CommandConsole.cpp, src/CommandConsole.h, + src/DebugConsole.cpp, src/DisplayDevice.cpp, src/DisplayDevice.h, + src/FbiStuff.cpp, src/FbiStuffLoader.h, src/FontServer.cpp, + src/FramebufferDevice.cpp, src/FramebufferDevice.h, + src/Image.cpp, src/SDLDevice.cpp, src/SDLDevice.h, + src/Viewport.cpp, src/Window.cpp: enforcing the new member + variable name rule in class DisplayDevice and nearby. + +2011-05-03 12:44 dezperado + + * src/Window.cpp, src/Window.h: enforcing the new member variable + name rule in class Window. + +2011-05-03 12:31 dezperado + + * src/Image.cpp, src/Image.h, src/Viewport.cpp: enforcing the new + member variable name rule in class Image. + +2011-05-03 12:10 dezperado + + * src/CommandConsole-cmd.cpp, src/CommandConsole-init.cpp, + src/CommandConsole.cpp, src/CommandConsole.h, + src/DebugConsole.cpp, src/DisplayDevice.cpp, src/FbiStuff.cpp, + src/Image.cpp, src/Viewport.cpp, src/Viewport.h, src/Window.cpp, + src/readline.cpp: enforcing the new member variable name rule in + classes Viewport and partially for CommandConsole. + +2011-05-03 11:49 dezperado + + * src/Browser.cpp, src/Browser.h, src/Viewport.cpp, src/fim.cpp: + enforcing the new member variable name rule in class Browser. + +2011-05-03 11:29 dezperado + + * src/CommandConsole.cpp, src/CommandConsole.h, src/Namespace.cpp, + src/Namespace.h: enforcing the new member variable name rule in + classes Namespace and partially for CommandConsole. + +2011-05-03 11:06 dezperado + + * TODO, src/Browser.cpp, src/CommandConsole.cpp, src/Image.cpp, + src/Namespace.cpp, src/Namespace.h, src/Viewport.cpp, + src/Window.cpp, src/fim.h: the help will now include a variables + list comprehending scoped variables. + +2011-05-01 14:40 dezperado + + * src/CommandConsole-cmd.cpp, src/fim.h: an internal variable will + hold the output of each system() execution. + +2011-05-01 13:46 dezperado + + * src/DebugConsole.cpp, src/fim.h, src/fimrc: the first logged + output console line is a specific banner, now. + when the output console is active, PageUp/PageDown keys will + scroll it, instead of advancing images (fimrc fix for this). + +2011-05-01 11:25 dezperado + + * configure.ac, scripts/maintenance/configure-noscripting.sh, + src/AADevice.cpp, src/AADevice.h, src/CommandConsole-cmd.cpp, + src/CommandConsole-init.cpp, src/CommandConsole.cpp, + src/CommandConsole.h, src/DebugConsole.cpp, src/DebugConsole.h, + src/DisplayDevice.cpp, src/DisplayDevice.h, + src/DummyDisplayDevice.h, src/FramebufferDevice.cpp, + src/FramebufferDevice.h, src/SDLDevice.cpp, src/SDLDevice.h: in a + configure switch for enabling/disabling the output console + feature. + +2011-05-01 00:46 dezperado + + * src/AADevice.h, src/DisplayDevice.h, src/SDLDevice.cpp, + src/SDLDevice.h: fixing some signatures. did not solve the ctrl-p + problem in sdl. + +2011-04-30 22:49 dezperado + + * src/SDLDevice.cpp, src/fim.h: in sdl mode, set up an experimental + functionality of n/b/q keys triggered by left/right/middle mouse + keys. + +2011-04-30 21:07 dezperado + + * src/AADevice.cpp, src/AADevice.h, src/DebugConsole.cpp, + src/SDLDevice.cpp, src/SDLDevice.h: bugfix: the sdl/aa get_input + function had a wrong signature, resulting in using the wrong + input function when in sdl/aa mode. + +2011-04-30 17:19 dezperado + + * configure.ac, scripts/maintenance/configure-noscripting.sh, + src/CommandConsole-cmd.cpp, src/CommandConsole-init.cpp, + src/CommandConsole.cpp, src/CommandConsole.h, src/fim.cpp, + src/fim.h: in a configure switch for disabling scripting + (--disable-scripting). + disabling even more code for this case (still not functional). + +2011-04-30 16:50 dezperado + + * configure.ac, src/CommandConsole-cmd.cpp, src/CommandConsole.cpp, + src/CommandConsole.h, src/fim.h: in a configure switch for + enabling/disabling the mark-and-dump feature. + +2011-04-30 16:22 dezperado + + * scripts/maintenance/configure-noscripting.sh, + src/CommandConsole-cmd.cpp, src/CommandConsole.cpp, + src/CommandConsole.h, src/fim.h: in a script for the + configure/build of fim with scripting disabled. + fixing codes for segfault in this case. + the code is not fully functional in this way, though. + +2011-04-30 11:53 dezperado + + * scripts/maintenance/configure-live.sh, + scripts/maintenance/live-test.sh: two maintenance scripts to + configure, build, and test fim for live systems. + +2011-04-30 11:40 dezperado + + * TODO, src/FbiStuffJpeg.cpp, src/fimrc: some ongoing work on exif + support (not active now, though). + +2011-04-16 14:02 dezperado + + * src/FramebufferDevice.cpp: fix for the cases when using the + framebuffer and the fix line length value does not coincide with + the length of the current line. + +2011-04-16 13:06 dezperado + + * TODO, doc/FIM.TXT, doc/fim.man, src/CommandConsole-cmd.cpp, + src/CommandConsole.cpp, src/DebugConsole.cpp, + src/DummyDisplayDevice.h, src/Image.cpp, src/fim.h: introduced + the FIM_WANT_MILDLY_VERBOSE_DUMB_CONSOLE and + FIM_WANT_OVERLY_VERBOSE_DUMB_CONSOLE inner features and dumb + console fixes. + 'system' fim command will execute a single popen() invocation, + now. + setting the i:filename inner variable. + documentation fixes and notes. + +2011-01-29 02:41 dezperado + + * src/Browser.cpp, src/CommandConsole-cmd.cpp, + src/CommandConsole.cpp, src/DebugConsole.cpp, + src/FbiStuffBit24.cpp, src/FbiStuffDjvu.cpp, + src/FbiStuffMatrixMarket.cpp, src/FbiStuffPpm.cpp, + src/FbiStuffTiff.cpp, src/FramebufferDevice.cpp, src/Image.cpp, + src/Namespace.cpp, src/Namespace.h, src/common.cpp, + src/defaultConfiguration.cpp, src/fim.h, src/fim_stream.cpp: + producing more symbols for handling strings and constants, and + applying throughout the code, again. + introducing some "goto" instead of returning too often. + fixed some duplicate return case. + removed an old, useless array allocation in the tiff driver. + +2011-01-28 20:09 dezperado + + * src/CommandConsole-init.cpp, src/CommandConsole.cpp, + src/common.cpp, src/defaultConfiguration.cpp, src/fim.h: + producing more symbols for handling strings and constants, and + applying throughout the code. + +2011-01-26 18:33 dezperado + + * src/Browser.cpp, src/CommandConsole-cmd.cpp, + src/CommandConsole.cpp, src/Namespace.cpp: using the autocommand + tokens, language keywords, and constants throughout the code. + +2011-01-26 18:31 dezperado + + * configure.ac, src/fim.h: configure: fix of a wrong check (for + libexif). + the fim.h now lists tokens, constants, values for many + autocommands, variables, key names, etc. + +2010-12-11 14:44 dezperado + + * src/FbiStuffPng.cpp: using png_set_expand_gray_1_2_4_to_8 if + PNG_LIBPNG_VER>=10209, instead of png_set_gray_1_2_4_to_8. + thanks to mark g. for pointing our the related compilation + problem. + +2010-11-01 12:57 dezperado + + * src/CommandConsole-init.cpp, src/CommandConsole.cpp, + src/Image.cpp, src/Makefile.am, src/fimrc: bugfix to the previous + possible NULL pointer in Image.cpp. + moved the default fimrc inclusion to a new file, for faster + build-and-fix cycles. + setting the third field of alias declarations (help string) in + the fimrc. + +2010-10-31 17:24 dezperado + + * src/FbiStuffJpeg.cpp, src/FbiStuffLoader.cpp, src/Image.cpp, + src/fim.h: now on, the i:comment variable will get set if a + comment field is found in an image file. + +2010-10-30 14:26 dezperado + + * configure.ac, src/FbiStuffJpeg.cpp: detecting libexif in the + configure, and waking up some exif-reading routine. + +2010-10-07 16:18 dezperado + + * TODO, src/CommandConsole-cmd.cpp, src/CommandConsole.cpp, + src/CommandConsole.h: fixed the bug/flaw noticed by Jakub Wilk. + bug description: "fim shows "H - Help" in the status line. + However, as far as I can see, the H key is not bound to + anything.". in Debian, nkown as Bug#599337. + removed a smiley from a help message. + +2010-01-31 13:07 dezperado + + * src/Command.h, src/CommandConsole.cpp, src/CommandConsole.h, + src/DisplayDevice.cpp, src/DisplayDevice.h, src/SDLDevice.cpp, + src/SDLDevice.h, src/fim.h, src/readline.cpp: applying the use of + the typedef keyword in place of int's, whenever possible. + +2010-01-21 02:11 dezperado + + * src/DebugConsole.cpp: George Danchev's patch for + http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=564233. + damn strchr. + +2009-12-21 17:26 dezperado + + * configure.ac, src/CommandConsole.cpp, src/FontServer.cpp, + src/fim.h: added a configure switch for + --enable-scan-consolefonts. + fixed a typo in FontServer.cpp from the previous commit. + s/_POSIX_PATH_MAX/FIM_PATH_MAX + +2009-12-21 17:10 dezperado + + * TODO, configure.ac, src/Browser.cpp, src/Browser.h, + src/FontServer.cpp, src/common.cpp, src/common.h, src/fim.h: in a + mechanism for consolefont search. + +2009-12-13 00:03 dezperado + + * configure.ac, debian/control, debian/fim.substvars, + debian/substvars, src/FbiStuff.cpp, src/FbiStuffBit1.cpp, + src/FbiStuffBit24.cpp, src/FbiStuffBmp.cpp, src/FbiStuffDjvu.cpp, + src/FbiStuffGif.cpp, src/FbiStuffJpeg.cpp, src/FbiStuffPdf.cpp, + src/FbiStuffPng.cpp, src/FbiStuffPpm.cpp, src/FbiStuffPs.cpp, + src/FbiStuffTiff.cpp: commented static initializers, as they are + an invalid construct for -pedantic switch, with g++-4.4. + +2009-12-09 00:19 dezperado + + * src/readline.cpp: when pressing TAB after typing something at the + prompt, the console will print some suggestions. + +2009-12-08 23:45 dezperado + + * src/CommandConsole-cmd.cpp, src/CommandConsole.cpp, + src/DebugConsole.cpp, src/FbiStuff.cpp, src/FbiStuffBit1.cpp, + src/FbiStuffBit24.cpp, src/FbiStuffBmp.cpp, src/FbiStuffDjvu.cpp, + src/FbiStuffGif.cpp, src/FbiStuffJpeg.cpp, + src/FbiStuffLoader.cpp, src/FbiStuffMatrixMarket.cpp, + src/FbiStuffPdf.cpp, src/FbiStuffPng.cpp, src/FbiStuffPpm.cpp, + src/FbiStuffPs.cpp, src/FbiStuffTiff.cpp, src/FontServer.cpp, + src/FramebufferDevice.cpp, src/common.cpp, src/fim.cpp, + src/fim.h, src/lex.lex, src/readline.cpp, src/string.h, + src/yacc.ypp: s/calloc/fim_calloc + s/malloc/fim_malloc + s/free/fim_free + some day we may decide to wrap more around these symbols. + +2009-12-08 23:05 dezperado + + * BUGS, INSTALL, TODO, src/DebugConsole.cpp, src/DebugConsole.h, + src/FbiStuffMatrixMarket.cpp, src/SDLDevice.cpp, src/fimgs: fimgs + will get files with https:// and ssh: schema. + a compiler happiness fix. + mentioned a xfig bug (not impacting on fim :-), and TODO. + +2009-10-15 19:34 dezperado + + * src/FramebufferDevice.cpp: typo + +2009-10-15 17:32 dezperado + + * BUGS, TODO, doc/fim.man, src/FramebufferDevice.cpp: fixed what it + seemed a bad off-boundaries array write. + doc fixes. + 16 bpp blue bug reported. + +2009-10-14 21:05 dezperado + + * BUGS, Makefile.am, README, TODO, config.h.in, configure.ac, + doc/FIM.TXT, doc/fim.man, scripts/tests/version.sh, src/fim.cpp: + a new (hopefully temporary) testing script. + supported input file formats dumped with --version. + doc updates and fixes. + man page fixes. + removed config.h.in from svn. + +2009-10-10 23:09 dezperado + + * src/FramebufferDevice.cpp: minipatch for systems with no + PAGE_MASK in standard headers. + +2009-10-10 11:57 dezperado + + * TODO, config.h.in, src/CommandConsole-cmd.cpp, + src/CommandConsole.cpp, src/Makefile.am: split a piece of + CommandConsole.cpp - this file is way too big for compilation on + PDA's. + +2009-10-10 09:24 dezperado + + * BUGS, src/SDLDevice.cpp: lame programming error in the previous + commit + +2009-10-09 00:17 dezperado + + * BUGS, src/SDLDevice.cpp: 8,16,24,32 bit support for SDL driver. + +2009-10-08 17:53 dezperado + + * BUGS, THANKS, src/CommandConsole.cpp, src/DisplayDevice.cpp, + src/FontServer.cpp, src/FramebufferDevice.cpp, src/fim.cpp, + src/fim.h: in a THANKS file (finally!). + small fixes. + +2009-10-07 15:08 dezperado + + * configure.ac, src/Image.cpp, src/Image.h, src/fim.h: configure + fix. + introducing some typedef's. + +2009-10-06 07:11 dezperado + + * NEWS, TODO, src/Browser.cpp, src/Browser.h, + src/CommandConsole.cpp, src/Image.cpp, src/Image.h, + src/Viewport.cpp, src/fim.h, src/fimrc: introduced the + experimental 'negate' feature, to view ebooks with less monitor + power (white on black) + +2009-09-29 17:42 dezperado + + * TODO, src/fimgs: the scriptfimgs needs some adjustment. + +2009-08-30 10:15 dezperado + + * doc/fim.man, src/CommandConsole.cpp, src/DisplayDevice.cpp, + src/FramebufferDevice.cpp, src/FramebufferDevice.h, src/fim.cpp, + src/fim.h: in a -S option for sanity-check. + +2009-08-20 14:18 dezperado + + * TODO, config.h.in, configure.ac, src/CommandConsole.cpp, + src/DisplayDevice.cpp, src/DisplayDevice.h, + src/FbiStuffMatrixMarket.cpp, src/fim.cpp: in a minibenchmark. + configure fixes. + notes. + shorter svn revision info. + +2009-06-13 18:51 dezperado + + * BUGS, TODO, debian/changelog, debian/menu.ex, src/AADevice.cpp, + src/AADevice.h, src/readline.cpp: this version is currently under + review at http://ftp-master.debian.org/ + +2009-05-31 21:07 dezperado + + * TODO, scripts/maintenance/mkfimbuildbots.sh, + src/CommandConsole.cpp, src/FbiStuffMatrixMarket.cpp, + src/string.h, src/testdir/test9.in: fixing borderline cases. + unalias "-a" added. + safe NULL string construction. + +2009-05-30 21:55 dezperado + + * scripts/maintenance/buildbot-master.cfg.sample, + scripts/maintenance/mkfimbuildbots.sh: in a script for buildbot + slaves creation on a compile farm. + in a sample buildbot master config file. + +2009-05-30 21:20 dezperado + + * TODO, configure.ac, src/FbiStuffMatrixMarket.cpp, + src/Makefile.am: it is possible to view matrix market files + (experimentally) + +2009-05-27 17:30 dezperado + + * TODO, src/testdir/Makefile: the tests shall perform under the + dumb interface now. + +2009-05-25 00:13 dezperado + + * TODO, doc/FIM.TXT, src/AADevice.cpp, src/FbiStuff.cpp, + src/Viewport.cpp, src/testdir/test12.in, src/testdir/test14.in, + src/testdir/test7.in, src/testdir/test7.ok: fixing fim integrity + testing with aalib and dumb (for compile farms). + +2009-05-20 22:04 dezperado + + * TODO, config.h.in, configure.ac, doc/fim.man, src/Browser.cpp, + src/CommandConsole.cpp, src/FbiStuff.cpp, src/FbiStuffJpeg.cpp, + src/Image.cpp, src/Image.h, src/common.cpp, src/common.h, + src/fim.cpp, src/fim.h, src/fimrc, src/lex.lex: fim will read + block devices, too. + corrected some preprocessor checks. + in FIM_VID_OPEN_OFFSET and FIM_VID_SEEK_MAGIC variables for + seeking files prior to probing/opening them. + hex interpretation in strings now. + --offset option in. + fixes in the jpeg loader. + fim_atof did not manage negative numbers. now it does. + some unused functions in. + +2009-04-28 22:15 dezperado + + * Makefile.am, var/Makefile: makefile fixes for site and info + uploading. + +2009-04-28 21:28 dezperado + + * configure.ac, doc/Makefile.am, src/FbiStuffFbtools.cpp, + src/FbiStuffList.h, src/FbiStuffLoader.cpp, src/Var.cpp, + src/string.cpp: fixes in the configure script. + fixes in the code, for portability. + +2009-04-26 14:34 dezperado + + * TODO, config.h.in, configure.ac, src/FontServer.cpp, + src/Makefile.am: cleaning up the Makefile.am file. + added some console fonts for ubuntu 10. + +2009-04-19 11:22 dezperado + + * Makefile.am, README, TODO, src/CommandConsole.cpp, + src/CommandConsole.h, src/Makefile.am, src/fim.cpp, + src/testdir/Makefile, src/testdir/test15.in, + src/testdir/test15.ok, var/Makefile, + var/www/fim-shot-aa-mini.png, var/www/fim-shot-aa.png, + var/www/fim-shot-fb-mini.png, var/www/fim-shot-fb.png: in four + web page screenshots. + in a recording test stub. + many small fixes. + +2009-04-18 21:09 dezperado + + * src/Command.h, src/CommandConsole.cpp, src/Makefile.am, + src/fim.h, src/fimrc, src/testdir/Makefile, + src/testdir/test14.in, src/testdir/test14.ok: two fim internals + debugging variables in. + a new test in. + fixing console displaying control. + +2009-04-18 15:16 dezperado + + * TODO, src/CommandConsole.cpp, src/CommandConsole.h, + src/FramebufferDevice.cpp, src/FramebufferDevice.h, src/fim.cpp, + src/fim.h: almost nothing + +2009-04-17 16:22 dezperado + + * configure.ac: sam's configure suggestions + +2009-04-12 20:38 dezperado + + * TODO, config.h.in, configure.ac, src/Browser.cpp, + src/CommandConsole.cpp, src/CommandConsole.h, + src/DebugConsole.cpp, src/FbiStuffFbtools.cpp, + src/FramebufferDevice.cpp, src/FramebufferDevice.h, + src/Makefile.am, src/common.cpp, src/common.h, src/fim.cpp, + src/fim.h, src/yacc.ypp: tweaks to build the beast on darwin and + bsd + +2009-04-04 13:33 dezperado + + * TODO, src/CommandConsole.cpp: fix with dummy device + +2009-04-04 09:29 dezperado + + * Makefile.am, TODO, configure.ac, src/Makefile.am, src/testsuite, + src/testsuite/config, src/testsuite/config/unix.exp, + src/testsuite/fim.test, src/testsuite/fim.test/fim.exp: in stubs + for dejagnu + +2009-04-03 22:26 dezperado + + * BUGS, README, TODO, src/AADevice.cpp, src/AADevice.h, + src/DisplayDevice.h, src/DummyDisplayDevice.h, + src/FramebufferDevice.cpp, src/FramebufferDevice.h, + src/SDLDevice.cpp, src/SDLDevice.h, src/readline.cpp: improved + the aalib input + +2009-04-01 11:37 dezperado + + * src/AADevice.cpp, src/CommandConsole.cpp: fixes. + +2009-04-01 07:58 dezperado + + * TODO, src/AADevice.cpp, src/AADevice.h, src/CommandConsole.cpp, + src/readline.cpp: putting in fim aa native input, (although aa + interface is somewhat poor compared to sdl) + +2009-03-31 21:39 dezperado + + * src/Browser.cpp, src/CommandConsole.cpp, src/CommandConsole.h, + src/FbiStuffFbtools.cpp, src/FramebufferDevice.cpp, src/Var.h, + src/common.cpp, src/string.h, src/testdir/Makefile, + src/testdir/test12.in, src/testdir/test12.ok, + src/testdir/test13.in, src/testdir/test13.ok: asymmetric scaling + test in. + browser test in. + enforcing "C" locale now (so, preventing locale-related bugs). + failed device initializations won't block the terminal echo + state. + +2009-03-29 17:32 dezperado + + * BUGS, src/Cache.cpp, src/Cache.h, src/CommandConsole.cpp, + src/Window.cpp: finalization fixes: the tests perform with no + memory leak at all. + +2009-03-29 15:36 dezperado + + * src/AADevice.cpp, src/AADevice.h, src/CommandConsole.cpp, + src/DisplayDevice.cpp, src/DisplayDevice.h, + src/FramebufferDevice.cpp, src/SDLDevice.cpp, src/fim.cpp, + src/string.cpp: got rid of some more small memory leaks. + +2009-03-29 13:48 dezperado + + * BUGS, TODO, src/AADevice.cpp, src/AADevice.h, + src/CommandConsole.cpp, src/CommandConsole.h, + src/FbiStuffJpeg.cpp, src/FramebufferDevice.cpp, + src/FramebufferDevice.h, src/Var.h, src/Window.cpp, src/Window.h, + src/fim.cpp, src/interpreter.cpp, src/lex.h, + src/testdir/Makefile, src/yacc.ypp: fixed memory leak in legacy + fbi code (font handling). + fixed memory leak in parser code. + fixing other small memory leaks (initalization/finalization + related) + +2009-03-28 15:31 dezperado + + * src/Browser.cpp, src/CommandConsole.h, src/FramebufferDevice.cpp, + src/Namespace.cpp, src/Namespace.h, src/Var.h, src/Viewport.cpp, + src/common.cpp, src/common.h, src/fim.cpp, src/interpreter.cpp, + src/lex.lex, src/testdir/Makefile, src/testdir/test10.in, + src/testdir/test10.ok, src/testdir/test11.in, + src/testdir/test11.ok, src/testdir/test2.in, + src/testdir/test2.ok, src/testdir/test3.in, src/testdir/test3.ok, + src/testdir/test4.in, src/testdir/test7.in, src/testdir/test9.in, + src/testdir/test9.ok: debugging the guts of fim's language. + implemented the gcd and babylonian sqrt as test programs. + replaced atof with a locale clean function. + +2009-03-26 21:48 dezperado + + * src/CommandConsole.cpp, src/CommandConsole.h, src/Namespace.cpp, + src/Namespace.h, src/Var.h, src/interpreter.cpp, + src/testdir/Makefile, src/testdir/test9.in, src/testdir/test9.ok: + debugging the language core with the radioactive rabbit : IT + WORKS! + +2009-03-25 22:09 dezperado + + * README, src/testdir/Makefile, src/testdir/test8.in, + src/testdir/test8.ok: in a new image viewer info and a new test + script. + +2009-03-18 10:51 dezperado + + * Makefile.am, README, TODO, src/testdir/Makefile, + src/testdir/test8.in, src/testdir/test8.ok: in a new test for + file browsing. + +2009-03-18 00:24 dezperado + + * src/Image.cpp, src/testdir/test7.in, src/testdir/test7.ok: in a + new small test. tried pork and oink. urgh! + +2009-03-06 00:12 dezperado + + * README, TODO, config.h.in, configure.ac, debian/README.Debian, + debian/control, debian/copyright, debian/fim.doc-base.EX, + debian/postinst.ex, debian/postrm.ex, debian/preinst.ex, + debian/prerm.ex, debian/watch, debian/watch.ex, + src/FbiStuffBit1.cpp, src/FbiStuffBit24.cpp, + src/FbiStuffDjvu.cpp, src/FbiStuffPdf.cpp, src/FbiStuffPs.cpp, + src/SDLDevice.cpp, src/fim.cpp: debinizing fixes. + +2009-02-27 20:54 dezperado + + * debian/.control.swo, debian/.rules.swo: ups + +2009-02-27 20:53 dezperado + + * TODO, debian, debian/.control.swo, debian/.rules.swo, + debian/README.Debian, debian/changelog, debian/compat, + debian/control, debian/copyright, debian/dirs, debian/docs, + debian/files, debian/fim.doc-base.EX, debian/fim.substvars, + debian/menu.ex, debian/postinst.ex, debian/postrm.ex, + debian/preinst.ex, debian/prerm.ex, debian/rules, + debian/substvars, debian/watch.ex: debianizing + +2009-02-26 21:23 dezperado + + * TODO, configure.ac, scripts/maintenance/cron-build.sh.in, + scripts/maintenance/cron-rsync.sh.in, + scripts/maintenance/cron-svndump.pl.in, + scripts/maintenance/remote-build.sh.in, src/CommandConsole.cpp, + src/fim.h, src/testdir/Makefile: in some maintenance backup + scripts. + in two new variables and a failing test. + +2009-02-25 02:47 dezperado + + * Makefile.am, VERSION, configure.ac, doc/Makefile.am, doc/fim.man, + doc/fimgs.man, src/fim.cpp: debianizing fim through lintian. + +2009-02-22 23:12 dezperado + + * src/FontServer.cpp, src/FramebufferDevice.cpp: fixed legacy fbi + missing malloc checks + +2009-02-22 22:56 dezperado + + * TODO, configure.ac: pentium4 optimization at configure time. + +2009-02-22 21:40 dezperado + + * BUGS, src/Browser.cpp, var/index.html.in: solved the FILE NONFILE + prev loop bug. + +2009-02-21 23:39 dezperado + + * BUGS, scripts/maintenance/configure-brute-check.sh, + src/Browser.h, src/CommandConsole.cpp, src/FbiStuff.cpp, + src/FbiStuffBit1.cpp, src/FbiStuffPng.cpp, + src/FramebufferDevice.cpp, src/Image.cpp, src/Makefile.am, + src/Var.cpp, src/Var.h, src/defaultConfiguration.cpp, + src/fim.cpp, src/fim.h, src/interpreter.cpp: fixes for pedantic + and obscure ./configure setups compilation. + enriched the --dump-reference-help output with a variables + description.. + +2009-02-21 14:59 dezperado + + * scripts/Makefile.am: typo + +2009-02-21 14:56 dezperado + + * BUGS, README, configure.ac, doc/FIM.TXT, scripts/Makefile.am, + scripts/maintenance/configure-brute-check.sh, src/Browser.cpp, + src/CommandConsole.cpp, src/CommandConsole.h, + src/DisplayDevice.cpp, src/FbiStuff.cpp, src/FbiStuffFbtools.cpp, + src/Namespace.cpp, src/Viewport.cpp, src/common.cpp, + src/common.h, src/fim.cpp: in a script to brute-check the + ./configure script. + documented. + fied nonwindowed fim for compilation. + +2009-02-21 01:15 dezperado + + * BUGS, Makefile.am, NEWS, README, TODO, scripts/Makefile.am, + scripts/utilities/screenshot.sh, src/AADevice.cpp, + src/CommandConsole.cpp, src/CommandConsole.h, src/FbiStuff.cpp, + src/FbiStuff.h, src/FbiStuffBit1.cpp, src/FbiStuffBit24.cpp, + src/FontServer.cpp, src/Makefile.am, src/Var.h, src/fim.cpp, + src/fim.h, var/Makefile, var/index.html.in, var/www/fim.css: + started working on the --dump-reference-help switch. + replaced popen with execlp calls when opening files (solves a fbi + vuln.). + fixed typos in macro names. + replaced stat calls with fseek. + fixed aa driver wrong textual console line width. + introduced a shell script for coordinated reference fim + screenshots. + restyled the fim web page. + +2009-02-18 00:42 dezperado + + * var/Makefile, var/index.html.in, var/www, var/www/fim.css: + pedantry + +2009-02-18 00:14 dezperado + + * ChangeLog, Makefile.am, NEWS, TODO, VERSION, distros/Makefile.am, + doc/Makefile.am, doc/fim.man, src/FbiStuff.cpp, var, + var/Makefile, var/index.html.in: changelog mangling, fim website + generation and update machinery. + +2009-02-15 17:53 dezperado + + * src/Browser.cpp, src/FbiStuff.cpp, src/FbiStuffBit1.cpp, + src/FbiStuffBit24.cpp, src/FbiStuffBmp.cpp, src/FbiStuffGif.cpp, + src/FbiStuffJpeg.cpp, src/FbiStuffLoader.cpp, + src/FbiStuffPng.cpp, src/FbiStuffPpm.cpp, src/FbiStuffTiff.cpp, + src/FontServer.cpp, src/FramebufferDevice.cpp: A safing malloc + and calloc's raid in FbiStuff*pp. + +2009-02-15 16:56 dezperado + + * BUGS, TODO, media/multipage, media/multipage/Makefile, + media/multipage/sample.tex, src/Browser.cpp, src/Cache.cpp, + src/CommandConsole.cpp, src/DisplayDevice.cpp, + src/FbiStuffPpm.cpp, src/Image.cpp, src/Image.h, src/fim.cpp, + src/string.cpp, src/string.h: fixed some 64 bit related issues. + added multipage test documents. + new bug identified (unsolved). + solved a multipage browsing related bug. + +2009-02-13 21:07 dezperado + + * src/Browser.cpp, src/Cache.cpp, src/CommandConsole.cpp, + src/FramebufferDevice.cpp, src/Image.cpp, src/Viewport.cpp, + src/Window.cpp, src/defaultConfiguration.cpp, src/fim.cpp, + src/fim.h: massive replace of strings with preprocessor symbols + for fim language variables identifiers. + soon documentation for each variable will be declared along with + its symbol definition. + +2009-02-13 20:16 dezperado + + * src/CommandConsole.cpp, src/common.cpp: fixes + +2009-02-13 00:52 dezperado + + * INSTALL, INSTALL.TXT, Makefile.am, README, TODO, config.h.in, + configure.ac, doc/fim.man, + scripts/maintenance/remote-build.sh.in, src/AADevice.cpp, + src/CommandConsole.cpp, src/CommandConsole.h, + src/DisplayDevice.h, src/FbiStuff.cpp, src/FbiStuffGif.cpp, + src/FontServer.cpp, src/FontServer.h, src/FramebufferDevice.cpp, + src/FramebufferDevice.h, src/common.cpp, src/common.h, + src/fim.cpp, src/fim.h: Cleaned up some fim vars access. + introduced fim_getenv, and constantized some dangerous char* + legacy pointers. + introduced the simple remote-build.sh script. + the non standard INSTALL file was replaced by the GNU INSTALL. + +2009-01-21 12:38 dezperado + + * distros/gentoo/media-gfx/fim/fim-0.3-beta.ebuild, + doc/Makefile.am: manhtml will not be absolutely necessary to + build docs.. + +2009-01-14 14:39 dezperado + + * TODO, src/defaultConfiguration.cpp: swapped PageDown and PageUp + key codes for the framebuffer/console driver. + +2009-01-10 11:13 dezperado + + * Makefile.am, README, TODO, configure.ac, + scripts/tests/sanity.fim, src/AADevice.h, src/Arg.h, + src/Browser.cpp, src/Browser.h, src/CACADevice.h, src/Cache.h, + src/Command.h, src/CommandConsole.cpp, src/CommandConsole.h, + src/DebugConsole.cpp, src/DebugConsole.h, src/DisplayDevice.h, + src/DummyDisplayDevice.h, src/FbiStuff.cpp, src/FbiStuff.h, + src/FbiStuffFbtools.cpp, src/FbiStuffFbtools.h, + src/FbiStuffList.h, src/FbiStuffLoader.h, src/FbiStuffPdf.cpp, + src/FontServer.h, src/FramebufferDevice.cpp, + src/FramebufferDevice.h, src/Image.cpp, src/Image.h, + src/Namespace.h, src/SDLDevice.cpp, src/SDLDevice.h, src/Var.h, + src/Viewport.h, src/Window.h, src/common.h, src/fim.cpp, + src/fim.h, src/fim_stream.h, src/fimrc, src/string.h, + src/testdir, src/testdir/Makefile, src/testdir/test1.in, + src/testdir/test1.ok, src/testdir/test2.in, src/testdir/test2.ok, + src/testdir/test3.in, src/testdir/test3.ok, src/testdir/test4.in, + src/testdir/test4.ok, src/testdir/test5.in, src/testdir/test5.ok, + src/testdir/test6.in, src/testdir/test6.ok: Introduced vim-like + language testing. + Renamed a bunch of preprocessor symbols. + +2009-01-04 00:11 dezperado + + * TODO, src/Browser.cpp, src/Browser.h, src/CommandConsole.cpp, + src/FbiStuffPdf.cpp, src/Image.cpp, src/Image.h, src/fimrc: A + little smarter multipage document browsing. + Fixed rgb swap in pdf renderer. + +2009-01-03 23:42 dezperado + + * doc/fim.man, src/FbiStuff.cpp, src/FbiStuffBit1.cpp, + src/FbiStuffBit24.cpp, src/Makefile.am, src/fim.cpp, src/fim.h: + Adapted the --binary option switch to let the user specify 1 + pixel per bit binary file display. + +2009-01-03 14:45 dezperado + + * TODO, doc/fim.man, src/Browser.cpp, src/FbiStuff.cpp, + src/FbiStuffBit24.cpp, src/Makefile.am, src/fim.cpp, src/fim.h: + Added the -b (--binary) option to view as a 24 bpp pixelmap any + input file. + Trimmed two extra _ in Browser.cpp. + +2009-01-03 13:13 dezperado + + * src/Browser.cpp, src/Cache.cpp: images filenames failing + prefetching wil be removed from the image list now. the prefetch + is autocommand-capable + +2009-01-01 16:34 dezperado + + * INSTALL, README, config.h.in, configure.ac, src/FbiStuffDjvu.cpp, + src/FbiStuffPdf.cpp, src/FbiStuffPs.cpp, src/SDLDevice.cpp, + src/common.cpp, src/fim.h, src/readline.cpp: introduced a hack to + make work arrow keys in the sdl/readline driver. + doc fixes. + +2008-12-30 17:10 dezperado + + * NEWS, README, TODO: docs update + +2008-12-30 16:57 dezperado + + * src/FbiStuffDjvu.cpp, src/FbiStuffPdf.cpp, src/FbiStuffPs.cpp: + inhibited stdin multipage document reading (for libraries + intrinsic inabilities to handle this, and the need of a + workaround). + +2008-12-30 16:37 dezperado + + * src/Browser.cpp, src/Browser.h, src/Cache.cpp, src/Cache.h, + src/CommandConsole.cpp, src/CommandConsole.h, src/Image.cpp, + src/Viewport.cpp, src/fim.cpp, src/fim.h, src/fimrc: fixes for + cache behaviour and prefetching. + +2008-12-30 01:47 dezperado + + * TODO, src/AADevice.h, src/Arg.cpp, src/Browser.cpp, + src/Browser.h, src/Cache.cpp, src/Cache.h, src/Command.cpp, + src/CommandConsole.cpp, src/CommandConsole.h, + src/DebugConsole.cpp, src/DebugConsole.h, src/DisplayDevice.cpp, + src/DisplayDevice.h, src/DummyDisplayDevice.h, src/FbiStuff.cpp, + src/FbiStuffTiff.cpp, src/FontServer.cpp, + src/FramebufferDevice.cpp, src/FramebufferDevice.h, + src/Image.cpp, src/Image.h, src/SDLDevice.cpp, src/SDLDevice.h, + src/Viewport.cpp, src/Viewport.h, src/Window.cpp, + src/defaultConfiguration.cpp, src/fim.cpp, src/fim.h, + src/string.cpp: pushing code cleanup and fixes : trimmed out some + troublesome extern declarators (not all, though). + +2008-12-28 16:58 dezperado + + * TODO, src/CommandConsole.cpp, src/CommandConsole.h, + src/DebugConsole.cpp, src/DisplayDevice.cpp, src/FontServer.cpp, + src/FontServer.h, src/FramebufferDevice.cpp, + src/FramebufferDevice.h, src/SDLDevice.cpp, src/fim.h: + housekeeping, -pedantic fixes. + +2008-12-27 15:01 dezperado + + * TODO, config.h.in, configure.ac, src/AADevice.h, + src/CommandConsole.cpp, src/CommandConsole.h, + src/DisplayDevice.cpp, src/DisplayDevice.h, + src/DummyDisplayDevice.h, src/FbiStuff.cpp, + src/FbiStuffFbtools.cpp, src/FramebufferDevice.cpp, + src/FramebufferDevice.h, src/Image.cpp, src/Image.h, + src/SDLDevice.cpp, src/SDLDevice.h, src/Viewport.cpp, + src/Window.cpp, src/fim.cpp, src/fim.h, src/readline.cpp: now, + with --disable-framebuffer fim will work without framebuffer + support. + +2008-12-27 00:07 dezperado + + * src/CommandConsole.cpp, src/DebugConsole.cpp, + src/DisplayDevice.cpp, src/DisplayDevice.h, src/Image.cpp, + src/SDLDevice.cpp, src/SDLDevice.h, src/common.cpp, src/common.h: + wiser way of rendering the console under SDL. + .fim_history mode will be set to 0600 on creation. + +2008-12-25 18:10 dezperado + + * src/Browser.cpp, src/Browser.h, src/CommandConsole.cpp, + src/FbiStuff.cpp, src/FbiStuff.h, src/FbiStuffDjvu.cpp, + src/FbiStuffPdf.cpp, src/FbiStuffPs.cpp, src/Image.cpp, + src/Image.h: introduced next-page and prev-page commands, to view + multipage djvu, pdf, ps documents. + +2008-12-25 15:30 dezperado + + * configure.ac, src/FbiStuffDjvu.cpp, src/FbiStuffPdf.cpp, + src/FbiStuffPs.cpp: correctness fixes for the djvu, pdf, ps + prototypal drivers. + +2008-12-25 12:17 dezperado + + * INSTALL, config.h.in, configure.ac, src/FbiStuff.cpp, + src/FbiStuffPs.cpp: Implemented a first form of PS file format + support (single-paged). + +2008-12-24 18:23 dezperado + + * config.h.in, configure.ac, src/FbiStuff.cpp, src/FbiStuffPdf.cpp, + src/Makefile.am: Implemented a first form of PDF file format + support (single-paged). + +2008-12-24 12:04 dezperado + + * INSTALL, README, TODO: doc comments + +2008-12-24 00:55 dezperado + + * config.h.in, configure.ac: forgot this stuff in the last commit.. + +2008-12-24 00:55 dezperado + + * src/FbiStuffDjvu.cpp, src/Makefile.am: Implemented a first form + of Dejavu file format support (single-paged). + +2008-12-21 21:58 dezperado + + * scripts/maintenance/cron-build.sh.in: ...bashism! + +2008-12-21 21:39 dezperado + + * scripts/maintenance/cron-build.sh.in: updated the crontab + export-build-and-mail script + +2008-12-21 18:13 dezperado + + * TODO, src/AADevice.cpp, src/AADevice.h, src/CommandConsole.cpp, + src/CommandConsole.h, src/DisplayDevice.cpp, + src/FramebufferDevice.cpp, src/SDLDevice.cpp, src/fimrc: fixed + the console echo problems. + implemented saving/loading of a ~/.fim_history file. + +2008-12-21 17:02 dezperado + + * src/AADevice.cpp, src/AADevice.h, src/FbiStuff.cpp, + src/FbiStuffBmp.cpp, src/FbiStuffFbtools.cpp, + src/FbiStuffGif.cpp, src/FbiStuffJpeg.cpp, src/FbiStuffPng.cpp, + src/FbiStuffTiff.cpp, src/fim.h: s/printf/FIM_FBI_PRINTF/g in ex + fbi stuff. + +2008-12-21 16:40 dezperado + + * src/AADevice.cpp, src/AADevice.h, src/CommandConsole.cpp, + src/DisplayDevice.cpp, src/common.cpp, src/fim.cpp, src/fim.h, + src/fim_stream.cpp: no more need for g_fim_no_framebuffer global + variable. + +2008-12-21 15:43 dezperado + + * NEWS, src/AADevice.cpp, src/AADevice.h, src/DebugConsole.cpp, + src/DisplayDevice.h, src/DummyDisplayDevice.h, + src/FramebufferDevice.h, src/SDLDevice.cpp, src/SDLDevice.h, + src/fimrc: set up the console for the aa driver, too. sadly, + there are problems with aalib console under screen. + +2008-12-21 13:40 dezperado + + * src/CommandConsole.cpp, src/CommandConsole.h, + src/DebugConsole.cpp, src/DebugConsole.h, src/DisplayDevice.cpp, + src/fimrc: the console is capable of scrolling, now. + +2008-12-21 11:10 dezperado + + * src/CommandConsole.cpp, src/CommandConsole.h, + src/DisplayDevice.cpp, src/SDLDevice.cpp, src/fimrc: typos in + SDLDevice.cpp. retouched the loop prevention stack machinery. + improved the fimrc. + +2008-12-21 09:20 dezperado + + * TODO, src/Browser.cpp, src/CommandConsole.cpp, src/FbiStuff.cpp, + src/FramebufferDevice.cpp, src/FramebufferDevice.h, + src/SDLDevice.cpp, src/fim.cpp, src/interpreter.cpp, + src/string.cpp, src/string.h: switched to size_t where needed; + wall and pedantic fixes; + +2008-12-20 18:25 dezperado + + * src/fim.cpp: workaround for a stdin file list reading bug (i did + not understnd why, sincerely). + +2008-12-18 01:18 dezperado + + * doc/FIM.TXT, src/CommandConsole.cpp, src/CommandConsole.h, + src/fimrc: Added the autocmd_trace_stack debug method; optimized + the default fimrc ; documented the system integration of fim. + +2008-11-10 00:01 dezperado + + * scripts/Makefile.am, scripts/rc/fimrc.lazy, + src/CommandConsole.cpp, src/CommandConsole.h, + src/FramebufferDevice.cpp, src/Image.cpp, src/Image.h, + src/Viewport.cpp, src/Viewport.h, src/fim.cpp, src/fim.h, + src/fimrc: Added the 'stdout' fim command. + Introduced a 'lazy' fimrc example configuration file. + Now the fimrc's are dist-archived, too. + +2008-11-09 19:52 dezperado + + * configure.ac, src/Browser.cpp, src/Browser.h, src/Cache.cpp, + src/CommandConsole.cpp, src/Image.cpp, src/Viewport.cpp: cache is + back into the game + +2008-11-02 21:49 dezperado + + * src/CommandConsole.cpp, src/CommandConsole.h, + src/DisplayDevice.cpp: autocmd_del command in. + +2008-10-19 12:58 dezperado + + * TODO, scripts/maintenance/cron-build.sh.in, scripts/rc, + scripts/rc/fimrc.eog, scripts/rc/fimrc.gqview, + scripts/rc/fimrc.kuickshow, src/DisplayDevice.cpp, + src/SDLDevice.cpp, src/defaultConfiguration.cpp, src/fimrc: Added + the scripts/rc/ directory to store fim configuration file to + emulate other image viewers. + Renamed First and Last key names to End and Home. + +2008-10-19 09:54 dezperado + + * src/AADevice.cpp, src/AADevice.h, src/CommandConsole.cpp, + src/DisplayDevice.cpp, src/DisplayDevice.h: console fixup for aa + +2008-10-19 09:38 dezperado + + * src/AADevice.h, src/CommandConsole.cpp, src/DebugConsole.cpp, + src/DisplayDevice.cpp, src/DisplayDevice.h, + src/FramebufferDevice.cpp, src/FramebufferDevice.h, + src/Makefile.am, src/SDLDevice.cpp, src/SDLDevice.h, src/fim.cpp: + Console and display devices code reorganization. + Some more sdl bpp independence. + CXXFLAGS is part of --version output now. + +2008-10-19 07:42 dezperado + + * src/SDLDevice.cpp, src/SDLDevice.h: Corrected the behaviour of + SDLDevice::catchInteractiveCommand() (caused pipe overflow + before). + +2008-10-19 07:38 dezperado + + * FAQ.TXT, src/CommandConsole.cpp, src/fim.cpp, src/fim.h, + src/readline.cpp: Some adjustments of device selection and + initialization code. + +2008-10-18 15:11 dezperado + + * BUGS, README, TODO, src/AADevice.h, src/CACADevice.h, + src/DebugConsole.cpp, src/DisplayDevice.h, + src/DummyDisplayDevice.h, src/SDLDevice.cpp, src/fim.cpp: The + debug console was convinced to work, too. With a dirty hack in + fim.cpp. + It's time for a cleanup of output device + probing/selection/initialization code. + +2008-10-18 13:49 dezperado + + * BUGS, src/SDLDevice.h: fixed a missing mandatory return value in + an inherited function, causing randomly neverending loops. + +2008-10-18 13:36 dezperado + + * BUGS, src/AADevice.cpp, src/AADevice.h, src/CACADevice.cpp, + src/CACADevice.h, src/CommandConsole.cpp, src/CommandConsole.h, + src/DisplayDevice.cpp, src/DisplayDevice.h, + src/DummyDisplayDevice.h, src/FramebufferDevice.h, + src/SDLDevice.cpp, src/SDLDevice.h, src/fim.h, src/readline.cpp: + SDL : support for arrows and control key, and some dirty hacks + with the readline keymaps in order to support meta (alt) + bindings. + +2008-10-12 23:24 dezperado + + * src/CommandConsole.cpp, src/SDLDevice.cpp, src/SDLDevice.h, + src/readline.cpp: readline integration with the SDL driver + +2008-10-12 21:05 dezperado + + * src/DisplayDevice.cpp, src/DisplayDevice.h, + src/FramebufferDevice.cpp, src/FramebufferDevice.h, + src/SDLDevice.cpp, src/SDLDevice.h: The Linux consolefont is + rendered under the SDL driver too, now. + +2008-10-12 17:50 dezperado + + * src/FontServer.cpp, src/FontServer.h, src/FramebufferDevice.cpp, + src/FramebufferDevice.h: FontServer::fs_render_fb -> + FramebufferDevice::fs_render_fb + +2008-10-12 17:37 dezperado + + * src/CommandConsole.cpp, src/SDLDevice.cpp: Fixed a x+screen null + pointer, swapped r and b in sdl code. + +2008-10-05 20:00 dezperado + + * doc/fim.man, src/AADevice.cpp, src/CommandConsole.cpp, + src/CommandConsole.h, src/DisplayDevice.cpp, src/DisplayDevice.h, + src/FramebufferDevice.cpp, src/FramebufferDevice.h, + src/SDLDevice.cpp, src/SDLDevice.h, src/fim.cpp: Worked further + on the SDL support, added the -o (--output-device) program switch + to select the output device among the supported ones. + Updated the man page accordingly. + +2008-10-04 19:26 dezperado + + * INSTALL, README: Small doc updates with mention about the pv + picture viewer. + +2008-10-04 17:27 dezperado + + * config.h.in, configure.ac, src/CommandConsole.cpp, + src/CommandConsole.h, src/DisplayDevice.cpp, src/DisplayDevice.h, + src/Makefile.am, src/SDLDevice.cpp, src/SDLDevice.h, src/fim.h: A + primordial and incomplete SDL (X) support is in now. + +2008-09-30 13:58 dezperado + + * doc/FIM.TXT: updated some doc with the trunk info + +2008-09-30 13:53 dezperado + + * ., AUTHORS, BUGS, COPYING, ChangeLog, FAQ.TXT, INSTALL, + Makefile.am, Makefile.old, NEWS, README, README.FIRST, TODO, + VERSION, autogen.sh, config.h.in, configure.ac, depcomp, distros, + doc, media, scripts, src: created a 'trunk' directory, after all. + diff --git a/FAQ.TXT b/FAQ.TXT new file mode 100644 index 0000000..0721254 --- /dev/null +++ b/FAQ.TXT @@ -0,0 +1,11 @@ + $Id: FAQ.TXT 165 2008-10-19 07:38:08Z dezperado $ + +Please consult the full FAQ section in the FIM.TXT file. + +Information about framebuffer is primarily in the man page, and the manual ( in the doc directory ). + +Information about the installation process is in the INSTALL file. + +Information about usage and much, much more is in doc/FIM.TXT + +Information about bugs and bug reporting is in the BUGS file and in the doc/FIM.TXT file. diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..a1e89e1 --- /dev/null +++ b/INSTALL @@ -0,0 +1,370 @@ +Installation Instructions +************************* + +Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation, +Inc. + + Copying and distribution of this file, with or without modification, +are permitted in any medium without royalty provided the copyright +notice and this notice are preserved. This file is offered as-is, +without warranty of any kind. + +Basic Installation +================== + + Briefly, the shell commands `./configure; make; make install' should +configure, build, and install this package. The following +more-detailed instructions are generic; see the `README' file for +instructions specific to this package. Some packages provide this +`INSTALL' file but do not implement all of the features documented +below. The lack of an optional feature in a given package is not +necessarily a bug. More recommendations for GNU packages can be found +in *note Makefile Conventions: (standards)Makefile Conventions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. Caching is +disabled by default to prevent problems with accidental use of stale +cache files. + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You need `configure.ac' if +you want to change it or regenerate `configure' using a newer version +of `autoconf'. + + The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. + + Running `configure' might take a while. While running, it prints + some messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package, generally using the just-built uninstalled binaries. + + 4. Type `make install' to install the programs and any data files and + documentation. When installing into a prefix owned by root, it is + recommended that the package be configured and built as a regular + user, and only the `make install' phase executed with root + privileges. + + 5. Optionally, type `make installcheck' to repeat any self-tests, but + this time using the binaries in their final installed location. + This target does not install anything. Running this target as a + regular user, particularly if the prior `make install' required + root privileges, verifies that the installation completed + correctly. + + 6. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + + 7. Often, you can also type `make uninstall' to remove the installed + files again. In practice, not all packages have tested that + uninstallation works correctly, even though it is required by the + GNU Coding Standards. + + 8. Some packages, particularly those that use Automake, provide `make + distcheck', which can by used by developers to test that all other + targets like `make install' and `make uninstall' work correctly. + This target is generally not run by end users. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. Run `./configure --help' +for details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c99 CFLAGS=-g LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you can use GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. This +is known as a "VPATH" build. + + With a non-GNU `make', it is safer to compile the package for one +architecture at a time in the source code directory. After you have +installed the package for one architecture, use `make distclean' before +reconfiguring for another architecture. + + On MacOS X 10.5 and later systems, you can create libraries and +executables that work on multiple system types--known as "fat" or +"universal" binaries--by specifying multiple `-arch' options to the +compiler but only a single `-arch' option to the preprocessor. Like +this: + + ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CPP="gcc -E" CXXCPP="g++ -E" + + This is not guaranteed to produce working output in all cases, you +may have to build one architecture at a time and combine the results +using the `lipo' tool if you have problems. + +Installation Names +================== + + By default, `make install' installs the package's commands under +`/usr/local/bin', include files under `/usr/local/include', etc. You +can specify an installation prefix other than `/usr/local' by giving +`configure' the option `--prefix=PREFIX', where PREFIX must be an +absolute file name. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +pass the option `--exec-prefix=PREFIX' to `configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=DIR' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. In general, the +default for these options is expressed in terms of `${prefix}', so that +specifying just `--prefix' will affect all of the other directory +specifications that were not explicitly provided. + + The most portable way to affect installation locations is to pass the +correct locations to `configure'; however, many packages provide one or +both of the following shortcuts of passing variable assignments to the +`make install' command line to change installation locations without +having to reconfigure or recompile. + + The first method involves providing an override variable for each +affected directory. For example, `make install +prefix=/alternate/directory' will choose an alternate location for all +directory configuration variables that were expressed in terms of +`${prefix}'. Any directories that were specified during `configure', +but not in terms of `${prefix}', must each be overridden at install +time for the entire installation to be relocated. The approach of +makefile variable overrides for each directory variable is required by +the GNU Coding Standards, and ideally causes no recompilation. +However, some platforms have known limitations with the semantics of +shared libraries that end up requiring recompilation when using this +method, particularly noticeable in packages that use GNU Libtool. + + The second method involves providing the `DESTDIR' variable. For +example, `make install DESTDIR=/alternate/directory' will prepend +`/alternate/directory' before all installation names. The approach of +`DESTDIR' overrides is not required by the GNU Coding Standards, and +does not work on platforms that have drive letters. On the other hand, +it does better at avoiding recompilation issues, and works well even +when some directory options were not specified in terms of `${prefix}' +at `configure' time. + +Optional Features +================= + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + + Some packages offer the ability to configure how verbose the +execution of `make' will be. For these packages, running `./configure +--enable-silent-rules' sets the default to minimal output, which can be +overridden with `make V=1'; while running `./configure +--disable-silent-rules' sets the default to verbose, which can be +overridden with `make V=0'. + +Particular systems +================== + + On HP-UX, the default C compiler is not ANSI C compatible. If GNU +CC is not installed, it is recommended to use the following options in +order to use an ANSI C compiler: + + ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" + +and if that doesn't work, install pre-built binaries of GCC for HP-UX. + + HP-UX `make' updates targets which have the same time stamps as +their prerequisites, which makes it generally unusable when shipped +generated files such as `configure' are involved. Use GNU `make' +instead. + + On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot +parse its `' header file. The option `-nodtk' can be used as +a workaround. If GNU CC is not installed, it is therefore recommended +to try + + ./configure CC="cc" + +and if that doesn't work, try + + ./configure CC="cc -nodtk" + + On Solaris, don't put `/usr/ucb' early in your `PATH'. This +directory contains several dysfunctional programs; working variants of +these programs are available in `/usr/bin'. So, if you need `/usr/ucb' +in your `PATH', put it _after_ `/usr/bin'. + + On Haiku, software installed for all users goes in `/boot/common', +not `/usr/local'. It is recommended to use the following options: + + ./configure --prefix=/boot/common + +Specifying the System Type +========================== + + There may be some features `configure' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, `configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS + KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the option `--target=TYPE' to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + + Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +causes the specified `gcc' to be used as the C compiler (unless it is +overridden in the site shell script). + +Unfortunately, this technique does not work for `CONFIG_SHELL' due to +an Autoconf bug. Until the bug is fixed you can use this workaround: + + CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash + +`configure' Invocation +====================== + + `configure' recognizes the following options to control how it +operates. + +`--help' +`-h' + Print a summary of all of the options to `configure', and exit. + +`--help=short' +`--help=recursive' + Print a summary of the options unique to this package's + `configure', and exit. The `short' variant lists options used + only in the top level, while the `recursive' variant lists options + also present in any nested packages. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--prefix=DIR' + Use DIR as the installation prefix. *note Installation Names:: + for more details, including other options available for fine-tuning + the installation locations. + +`--no-create' +`-n' + Run the configure checks, but stop before creating any output + files. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. + diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..ff08bb9 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,218 @@ +# $Id: Makefile.am 1411 2017-07-19 11:36:07Z dezperado $ + +# no-dependencies was due to problems with conditional sources +# nostdinc disables the standard -I. include which breaks a correct string.h include +AUTOMAKE_OPTIONS = nostdinc no-dependencies # dejagnu +SUBDIRS = src doc distros scripts + +dist_doc_DATA=$(top_srcdir)/README $(top_srcdir)/README.FIRST $(top_srcdir)/TODO $(top_srcdir)/VERSION $(top_srcdir)/BUGS $(top_srcdir)/FAQ.TXT $(top_srcdir)/AUTHORS $(top_srcdir)/ChangeLog $(top_srcdir)/NEWS +# no INSTALL INSTALL.TXT is necessary in rules +EXTRA_DIST= COPYING \ + Makefile.am configure.ac configure \ + aclocal.m4 config.h.in \ + autogen.sh \ + $(top_srcdir)/media/image.jpg \ + $(top_srcdir)/media/image.png \ + $(top_srcdir)/media/fim.png \ + $(top_srcdir)/var/fonts/Lat15-Terminus16.psf \ + depcomp missing install-sh +FIM_EXE=./src/fim +FIMGS_EXE=./src/fimgs + + +# mhmhmhm +# CLEANFILES = autom4te.cache + +srcdir = src + +# still unfinished +signed-tgzdist: dist + gpg -sbv -u 0xE0E669C8EF1258B8 $(distdir).tar.gz + ls -l $(distdir).tar.gz $(distdir).tar.gz.sig + +# still unfinished +signed-dist: dist + make dist-bzip2 && gpg -sbv -u 0xE0E669C8EF1258B8 $(distdir).tar.bz2 + ls -l $(distdir).tar.bz2 $(distdir).tar.bz2.sig + gpg -sbv -u 0xE0E669C8EF1258B8 $(distdir).tar.gz + ls -l $(distdir).tar.gz $(distdir).tar.gz.sig + +#%.sig: % +# gpg -sbv -u 0xE0E669C8EF1258B8 $@ $< +# gpg -sbav -u 0xE0E669C8EF1258B8 $@ $< + + +FIMNORCOPTS=-N --no-etc-rc-file + +# this rule is deprecated, too: testing should be performed with 'make tests' (FIXME) +sanity-check: all + @$(FIM_EXE) $(FIMNORCOPTS) -E $(top_srcdir)/scripts/tests/sanity.fim -t + +# this is the official way of testing fim +tests: all + ulimit -c unlimited || true + ulimit -v 32000 || true + ulimit -t 1000 || true + @top_srcdir=$(top_srcdir) $(SHELL) $(top_srcdir)/scripts/tests/version.sh + @top_srcdir=$(top_srcdir) $(SHELL) $(top_srcdir)/scripts/tests/font.sh + @$(FIM_EXE) $(FIMNORCOPTS) -o dumb -E $(top_srcdir)/scripts/example/oneline.fim -c quit + @$(FIM_EXE) $(FIMNORCOPTS) -o dumb -c 'quit 14' ; if test $$? == 14 ; then echo '[*] Error code return test PASSED' ; else echo 'Error code return test FAILED'; false ; fi + if test $(abs_builddir) = $(abs_srcdir) ; then make -C src/testdir ; fi + +FIMSCRIPTSDIR=`pwd`/scripts/maintenance/ + +# new target, still not working +tests-all: tests $(FIMSCRIPTSDIR)/configure-brute-check.sh + cd src && which cppcheck && cppcheck *cpp *.h || true + $(SHELL) $(FIMSCRIPTSDIR)/configure-brute-check.sh + +#news-dump: +# $(AWK) -- 'v=0;($$1 == "Version" && $$2=="'`cat VERSION`'"){while((input=getline) && $$1!="Version"){print}};' NEWS > f + +# this rule is deprecated, too +test: all + @$(FIM_EXE) $(FIMNORCOPTS) $(top_srcdir)/media/* #~/M*s/*g + +# this rule is deprecated, too +aatest: all + @$(FIM_EXE) $(FIMNORCOPTS) $(top_srcdir)/media/* -o aa #~/M*s/*g + +# this rule is old and deprecated +#tgz: clean +# tar -czf ../fim.`date +%Y%m%d%H%M`.tgz ../fim/* +# ls -l ../fim*.tgz -v + +# this rule is encouraged +report: + @cat VERSION + @echo '-' + @$(LEX) -V 2>&1 + @echo '-' + @$(YACC) -V 2>&1 + @echo '-' + @$(CC) -v 2>&1 + @echo '-' + @echo 'now please report the bug with this information to the author via email' ; + +# this rule is redundant +exec: test + +# this rule is smart, isn't it ? I love it ! +edit: + $(EDITOR) $(srcdir)/fim.cpp +':split $(srcdir)/fim.h' # Vim ! :) + +.PHONY: + @true + +# this rule is informative and for acting like a peacock +wc: + wc $(srcdir)/*.cpp $(srcdir)/*.h $(srcdir)/yacc.ypp $(srcdir)/lex.lex + @#wc $(FIM) # missing headers.. + +help: + @echo ----------------------------------------------- + @echo ' short Makefile help' + @echo ----------------------------------------------- + @echo + @echo 'Please read the documentation file before complaining!' + @echo + @echo 'The first documentation file you should read is README' + @echo + @echo 'If you are experiencing problems, please contact the code author.' + @echo + @echo 'His mail box resides as dezperado, then a dot, then autistici dot org.' + @echo + @echo 'You are encouraged attaching the output of `make report` in your bug reports.' + @echo 'Thanks for your collaboration.' + @echo + +ai: + make site up -C var/ + +up: upload news + +news: freshmeat mail-announce + +dox: doc/fim.man doc/fimrc.man doc/fimgs.man + +MANSUBST = sed -e 's,@sysconfdir\@,$(sysconfdir),g' -e 's,@docdir\@,$(docdir),g' -e 's,-,\\-,g' + +doc/fim.man doc/fimrc.man doc/fimgs.man: $(FIM_EXE) + $(FIM_EXE) $(FIMNORCOPTS) --help=m |$(MANSUBST) > doc/fim.man + $(FIM_EXE) $(FIMNORCOPTS) --dump-reference-help=man |$(MANSUBST) > doc/fimrc.man + $(FIMGS_EXE) -m -- $(FIMNORCOPTS) |$(MANSUBST) > doc/fimgs.man + +# fixme : missing integration with ChangeLog file +mail-announce: + @ figlet fim | mutt -s "fim-`cat VERSION` release" "fbi-improved-devel@nongnu.org" -i - + +log: changelog + +# from trunk, we should call svn2cl .. to get the full fim changelog history +changelog: + svn2cl .. + +release: upload freshmeat + +upload: savannah + +savannah: signed-dist + read && scp $(distdir).tar.gz.sig $(distdir).tar.gz $(distdir).tar.bz2.sig $(distdir).tar.bz2 dezperado@dl.sv.nongnu.org:/releases/fbi-improved/ + lynx -dump dl.sv.gnu.org/releases/fbi-improved + +savannah-lookup: + lynx -dump dl.sv.gnu.org/releases/fbi-improved + +# fixme : missing integration with ChangeLog file and such information +freshmeat_old: + @ $(AWK) -- 'v=0;($$1 == "Version" && $$2=="'`cat VERSION`'"){while((input=getline) && $$1!="Version"){print}};' NEWS + @echo freshmeat-submit -v "fbi-`cat VERSION`" \ + --project fbi-improved \ + --license GPL \ + --mailing-list-url $$(cat README | grep "^Mailing List :"|sed s/^.*\ :.//g) \ + --home-page-url $$(cat README | grep "^Web Page "|sed s/^.*\ :.//g) \ + --cvs-url $$(cat README | grep "^Repository"|sed s/^.*\ :.//g) \ + --gzipped-tar-url $$(cat README | grep "^Releases "|sed s/^.*\ :.//g)/"fim-`cat VERSION`".tar.gz \ + --mirror-site-url $$(cat README | grep "^Off.*rror : "|sed s/^.*\ :.//g) \ + --changelog-url $$(cat README | grep "^ChangeLog "|sed s/^.*\ :.//g) + @ echo "are you sure ? (any key to abort, yes to continue)" && read yes && [[ "$${yes}" == "yes" ]] && \ + $(AWK) -- 'v=0;($$1 == "Version" && $$2=="'`cat VERSION`'"){while((input=getline) && $$1!="Version"){print}};' NEWS | \ + freshmeat-submit -v "fbi-`cat VERSION`" \ + --project fbi-improved \ + --license GPL \ + --mailing-list-url $$(cat README | grep "^Mailing List :"|sed s/^.*\ :.//g) \ + --home-page-url $$(cat README | grep "^Web Page "|sed s/^.*\ :.//g) \ + --cvs-url $$(cat README | grep "^Repository"|sed s/^.*\ :.//g) \ + --gzipped-tar-url $$(cat README | grep "^Releases "|sed s/^.*\ :.//g)/"fim-`cat VERSION`".tar.gz \ + --mirror-site-url $$(cat README | grep "^Off.*rror : "|sed s/^.*\ :.//g) \ + --changelog-url $$(cat README | grep "^ChangeLog "|sed s/^.*\ :.//g) +# --url-demo $$(cat README | grep "^Web Page "|sed s/^.*:.//g) +# --bzipped-tar-url $$(cat README | grep "^Web Page "|sed s/^.*:.//g) + +freshmeat-submit: + @echo Project: fim + @echo Version: `cat VERSION` + @echo Release-Focus: Major feature enhancements + @echo Hide: N + @echo Home-Page-URL: $$(cat README | grep "^Web Page "|sed s/^.*\ :.//g) + @echo Mailing-List-URL: $$(cat README | grep "^Mailing List :"|sed s/^.*\ :.//g) + @echo Gzipped-Tar-URL: $$(cat README | grep "^Releases "|sed s/^.*\ :.//g)/"fim-`cat VERSION`".tar.gz + @echo Bzipped-Tar-URL: $$(cat README | grep "^Releases "|sed s/^.*\ :.//g)/"fim-`cat VERSION`".tar.bz2 + @echo License: GPL + @echo Mirror-Site-URL: $$(cat README | grep "^Off.*rror : "|sed s/^.*\ :.//g) + @echo ChangeLog-URL: $$(cat README | grep "^ChangeLog "|sed s/^.*\ :.//g) + @echo CVS-URL: $$(cat README | grep "^Repository"|sed s/^.*\ :.//g) + @echo + @ $(AWK) -- 'v=0;($$1 == "Version" && $$2=="'`cat VERSION`'"){while((input=getline) && $$1!="Version"){print}};' NEWS + +freshmeat: + @ echo "are you sure you want to freshmeat-submit ? (any key to abort, yes to continue)" && read yes && [[ "$${yes}" == "yes" ]] && \ + make freshmeat-submit | grep -v '^make\[' | freshmeat-submit + +commit: log + svn commit + +# This awaits completion. +#rpm: dist +# rpmbuild -ta @PACKAGE@-@VERSION@.tar.gz + diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..f6da739 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,1059 @@ +# Makefile.in generated by automake 1.11.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# $Id: Makefile.am 1411 2017-07-19 11:36:07Z dezperado $ + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +subdir = . +DIST_COMMON = README $(am__configure_deps) $(dist_doc_DATA) \ + $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/config.h.in $(top_srcdir)/configure \ + $(top_srcdir)/scripts/maintenance/cron-build.sh.in \ + $(top_srcdir)/scripts/maintenance/cron-rsync.sh.in \ + $(top_srcdir)/scripts/maintenance/cron-svndump.pl.in \ + $(top_srcdir)/scripts/maintenance/remote-build.sh.in AUTHORS \ + COPYING ChangeLog INSTALL NEWS THANKS TODO depcomp install-sh \ + missing +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno config.status.lineno +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = scripts/maintenance/cron-build.sh \ + scripts/maintenance/remote-build.sh \ + scripts/maintenance/cron-svndump.pl \ + scripts/maintenance/cron-rsync.sh +CONFIG_CLEAN_VPATH_FILES = +depcomp = +am__depfiles_maybe = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(docdir)" +DATA = $(dist_doc_DATA) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir dist dist-all distcheck +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + if test -d "$(distdir)"; then \ + find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -rf "$(distdir)" \ + || { sleep 5 && rm -rf "$(distdir)"; }; \ + else :; fi +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +DIST_ARCHIVES = $(distdir).tar.gz +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ + | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CAT = @CAT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONFIG_STATUS_DEPENDENCIES = @CONFIG_STATUS_DEPENDENCIES@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FIM_CONFIGURATION = @FIM_CONFIGURATION@ +FIM_CUSTOM_HARDCODED_CONSOLEFONT = @FIM_CUSTOM_HARDCODED_CONSOLEFONT@ +FIM_DEFS = @FIM_DEFS@ +FIM_LIBS = @FIM_LIBS@ +FIM_LIB_OBJECTS = @FIM_LIB_OBJECTS@ +FIM_SVN_REPOSITORY = @FIM_SVN_REPOSITORY@ +GREP = @GREP@ +HAVE_AWK = @HAVE_AWK@ +HAVE_BISON = @HAVE_BISON@ +HAVE_CAT = @HAVE_CAT@ +HAVE_CPP = @HAVE_CPP@ +HAVE_ECHO = @HAVE_ECHO@ +HAVE_FLEX = @HAVE_FLEX@ +HAVE_GREP = @HAVE_GREP@ +HAVE_MAN = @HAVE_MAN@ +HAVE_RM = @HAVE_RM@ +HAVE_SED = @HAVE_SED@ +HAVE_SORT = @HAVE_SORT@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBAA_CONFIG = @LIBAA_CONFIG@ +LIBDJVU = @LIBDJVU@ +LIBGIF = @LIBGIF@ +LIBJPEG = @LIBJPEG@ +LIBOBJS = @LIBOBJS@ +LIBPNG_CONFIG = @LIBPNG_CONFIG@ +LIBPOPPLER = @LIBPOPPLER@ +LIBPS = @LIBPS@ +LIBS = @LIBS@ +LIBSDL_CONFIG = @LIBSDL_CONFIG@ +LIBTIFF = @LIBTIFF@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MAN = @MAN@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POPPLER_CFLAGS = @POPPLER_CFLAGS@ +POPPLER_LIBS = @POPPLER_LIBS@ +RANLIB = @RANLIB@ +RM = @RM@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SORT = @SORT@ +STRIP = @STRIP@ +SVN_REVISION = @SVN_REVISION@ +SVN_REVISION_NUMBER = @SVN_REVISION_NUMBER@ +VERSION = @VERSION@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build_alias = @build_alias@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +fim_cv_version = @fim_cv_version@ +have_convert = @have_convert@ +have_dia = @have_dia@ +have_inkscape = @have_inkscape@ +have_xcftopnm = @have_xcftopnm@ +have_xfig = @have_xfig@ +have_zcat = @have_zcat@ +host_alias = @host_alias@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ + +# mhmhmhm +# CLEANFILES = autom4te.cache +srcdir = src +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ + +# no-dependencies was due to problems with conditional sources +# nostdinc disables the standard -I. include which breaks a correct string.h include +AUTOMAKE_OPTIONS = nostdinc no-dependencies # dejagnu +SUBDIRS = src doc distros scripts +dist_doc_DATA = $(top_srcdir)/README $(top_srcdir)/README.FIRST $(top_srcdir)/TODO $(top_srcdir)/VERSION $(top_srcdir)/BUGS $(top_srcdir)/FAQ.TXT $(top_srcdir)/AUTHORS $(top_srcdir)/ChangeLog $(top_srcdir)/NEWS +# no INSTALL INSTALL.TXT is necessary in rules +EXTRA_DIST = COPYING \ + Makefile.am configure.ac configure \ + aclocal.m4 config.h.in \ + autogen.sh \ + $(top_srcdir)/media/image.jpg \ + $(top_srcdir)/media/image.png \ + $(top_srcdir)/media/fim.png \ + $(top_srcdir)/var/fonts/Lat15-Terminus16.psf \ + depcomp missing install-sh + +FIM_EXE = ./src/fim +FIMGS_EXE = ./src/fimgs + +#%.sig: % +# gpg -sbv -u 0xE0E669C8EF1258B8 $@ $< +# gpg -sbav -u 0xE0E669C8EF1258B8 $@ $< +FIMNORCOPTS = -N --no-etc-rc-file +FIMSCRIPTSDIR = `pwd`/scripts/maintenance/ +MANSUBST = sed -e 's,@sysconfdir\@,$(sysconfdir),g' -e 's,@docdir\@,$(docdir),g' -e 's,-,\\-,g' +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +am--refresh: Makefile + @: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ + $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + $(am__cd) $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +$(am__aclocal_m4_deps): + +config.h: stamp-h1 + @if test ! -f $@; then rm -f stamp-h1; else :; fi + @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h +$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 +scripts/maintenance/cron-build.sh: $(top_builddir)/config.status $(top_srcdir)/scripts/maintenance/cron-build.sh.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +scripts/maintenance/remote-build.sh: $(top_builddir)/config.status $(top_srcdir)/scripts/maintenance/remote-build.sh.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +scripts/maintenance/cron-svndump.pl: $(top_builddir)/config.status $(top_srcdir)/scripts/maintenance/cron-svndump.pl.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +scripts/maintenance/cron-rsync.sh: $(top_builddir)/config.status $(top_srcdir)/scripts/maintenance/cron-rsync.sh.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +install-dist_docDATA: $(dist_doc_DATA) + @$(NORMAL_INSTALL) + @list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(docdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(docdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(docdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(docdir)" || exit $$?; \ + done + +uninstall-dist_docDATA: + @$(NORMAL_UNINSTALL) + @list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(docdir)'; $(am__uninstall_files_from_dir) + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + $(am__remove_distdir) + test -d "$(distdir)" || mkdir "$(distdir)" + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done + -test -n "$(am__skip_mode_fix)" \ + || find "$(distdir)" -type d ! -perm -755 \ + -exec chmod u+rwx,go+rx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r "$(distdir)" +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-lzip: distdir + tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz + $(am__remove_distdir) + +dist-lzma: distdir + tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma + $(am__remove_distdir) + +dist-xz: distdir + tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz + $(am__remove_distdir) + +dist-tarZ: distdir + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lzma*) \ + lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ + *.tar.lz*) \ + lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ + *.tar.xz*) \ + xz -dc $(distdir).tar.xz | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir); chmod u+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + test -d $(distdir)/_build || exit 0; \ + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && am__cwd=`pwd` \ + && $(am__cd) $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(AM_DISTCHECK_CONFIGURE_FLAGS) \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ + && cd "$$am__cwd" \ + || exit 1 + $(am__remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' +distuninstallcheck: + @test -n '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: trying to run $@ with an empty' \ + '$$(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + $(am__cd) '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-recursive +all-am: Makefile $(DATA) config.h +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(docdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-hdr distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: install-dist_docDATA + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-dist_docDATA + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \ + ctags-recursive install-am install-strip tags-recursive + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am am--refresh check check-am clean clean-generic \ + ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ + dist-lzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \ + distcheck distclean distclean-generic distclean-hdr \ + distclean-tags distcleancheck distdir distuninstallcheck dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dist_docDATA install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ + tags-recursive uninstall uninstall-am uninstall-dist_docDATA + + +# still unfinished +signed-tgzdist: dist + gpg -sbv -u 0xE0E669C8EF1258B8 $(distdir).tar.gz + ls -l $(distdir).tar.gz $(distdir).tar.gz.sig + +# still unfinished +signed-dist: dist + make dist-bzip2 && gpg -sbv -u 0xE0E669C8EF1258B8 $(distdir).tar.bz2 + ls -l $(distdir).tar.bz2 $(distdir).tar.bz2.sig + gpg -sbv -u 0xE0E669C8EF1258B8 $(distdir).tar.gz + ls -l $(distdir).tar.gz $(distdir).tar.gz.sig + +# this rule is deprecated, too: testing should be performed with 'make tests' (FIXME) +sanity-check: all + @$(FIM_EXE) $(FIMNORCOPTS) -E $(top_srcdir)/scripts/tests/sanity.fim -t + +# this is the official way of testing fim +tests: all + ulimit -c unlimited || true + ulimit -v 32000 || true + ulimit -t 1000 || true + @top_srcdir=$(top_srcdir) $(SHELL) $(top_srcdir)/scripts/tests/version.sh + @top_srcdir=$(top_srcdir) $(SHELL) $(top_srcdir)/scripts/tests/font.sh + @$(FIM_EXE) $(FIMNORCOPTS) -o dumb -E $(top_srcdir)/scripts/example/oneline.fim -c quit + @$(FIM_EXE) $(FIMNORCOPTS) -o dumb -c 'quit 14' ; if test $$? == 14 ; then echo '[*] Error code return test PASSED' ; else echo 'Error code return test FAILED'; false ; fi + if test $(abs_builddir) = $(abs_srcdir) ; then make -C src/testdir ; fi + +# new target, still not working +tests-all: tests $(FIMSCRIPTSDIR)/configure-brute-check.sh + cd src && which cppcheck && cppcheck *cpp *.h || true + $(SHELL) $(FIMSCRIPTSDIR)/configure-brute-check.sh + +#news-dump: +# $(AWK) -- 'v=0;($$1 == "Version" && $$2=="'`cat VERSION`'"){while((input=getline) && $$1!="Version"){print}};' NEWS > f + +# this rule is deprecated, too +test: all + @$(FIM_EXE) $(FIMNORCOPTS) $(top_srcdir)/media/* #~/M*s/*g + +# this rule is deprecated, too +aatest: all + @$(FIM_EXE) $(FIMNORCOPTS) $(top_srcdir)/media/* -o aa #~/M*s/*g + +# this rule is old and deprecated +#tgz: clean +# tar -czf ../fim.`date +%Y%m%d%H%M`.tgz ../fim/* +# ls -l ../fim*.tgz -v + +# this rule is encouraged +report: + @cat VERSION + @echo '-' + @$(LEX) -V 2>&1 + @echo '-' + @$(YACC) -V 2>&1 + @echo '-' + @$(CC) -v 2>&1 + @echo '-' + @echo 'now please report the bug with this information to the author via email' ; + +# this rule is redundant +exec: test + +# this rule is smart, isn't it ? I love it ! +edit: + $(EDITOR) $(srcdir)/fim.cpp +':split $(srcdir)/fim.h' # Vim ! :) + +.PHONY: + @true + +# this rule is informative and for acting like a peacock +wc: + wc $(srcdir)/*.cpp $(srcdir)/*.h $(srcdir)/yacc.ypp $(srcdir)/lex.lex + @#wc $(FIM) # missing headers.. + +help: + @echo ----------------------------------------------- + @echo ' short Makefile help' + @echo ----------------------------------------------- + @echo + @echo 'Please read the documentation file before complaining!' + @echo + @echo 'The first documentation file you should read is README' + @echo + @echo 'If you are experiencing problems, please contact the code author.' + @echo + @echo 'His mail box resides as dezperado, then a dot, then autistici dot org.' + @echo + @echo 'You are encouraged attaching the output of `make report` in your bug reports.' + @echo 'Thanks for your collaboration.' + @echo + +ai: + make site up -C var/ + +up: upload news + +news: freshmeat mail-announce + +dox: doc/fim.man doc/fimrc.man doc/fimgs.man + +doc/fim.man doc/fimrc.man doc/fimgs.man: $(FIM_EXE) + $(FIM_EXE) $(FIMNORCOPTS) --help=m |$(MANSUBST) > doc/fim.man + $(FIM_EXE) $(FIMNORCOPTS) --dump-reference-help=man |$(MANSUBST) > doc/fimrc.man + $(FIMGS_EXE) -m -- $(FIMNORCOPTS) |$(MANSUBST) > doc/fimgs.man + +# fixme : missing integration with ChangeLog file +mail-announce: + @ figlet fim | mutt -s "fim-`cat VERSION` release" "fbi-improved-devel@nongnu.org" -i - + +log: changelog + +# from trunk, we should call svn2cl .. to get the full fim changelog history +changelog: + svn2cl .. + +release: upload freshmeat + +upload: savannah + +savannah: signed-dist + read && scp $(distdir).tar.gz.sig $(distdir).tar.gz $(distdir).tar.bz2.sig $(distdir).tar.bz2 dezperado@dl.sv.nongnu.org:/releases/fbi-improved/ + lynx -dump dl.sv.gnu.org/releases/fbi-improved + +savannah-lookup: + lynx -dump dl.sv.gnu.org/releases/fbi-improved + +# fixme : missing integration with ChangeLog file and such information +freshmeat_old: + @ $(AWK) -- 'v=0;($$1 == "Version" && $$2=="'`cat VERSION`'"){while((input=getline) && $$1!="Version"){print}};' NEWS + @echo freshmeat-submit -v "fbi-`cat VERSION`" \ + --project fbi-improved \ + --license GPL \ + --mailing-list-url $$(cat README | grep "^Mailing List :"|sed s/^.*\ :.//g) \ + --home-page-url $$(cat README | grep "^Web Page "|sed s/^.*\ :.//g) \ + --cvs-url $$(cat README | grep "^Repository"|sed s/^.*\ :.//g) \ + --gzipped-tar-url $$(cat README | grep "^Releases "|sed s/^.*\ :.//g)/"fim-`cat VERSION`".tar.gz \ + --mirror-site-url $$(cat README | grep "^Off.*rror : "|sed s/^.*\ :.//g) \ + --changelog-url $$(cat README | grep "^ChangeLog "|sed s/^.*\ :.//g) + @ echo "are you sure ? (any key to abort, yes to continue)" && read yes && [[ "$${yes}" == "yes" ]] && \ + $(AWK) -- 'v=0;($$1 == "Version" && $$2=="'`cat VERSION`'"){while((input=getline) && $$1!="Version"){print}};' NEWS | \ + freshmeat-submit -v "fbi-`cat VERSION`" \ + --project fbi-improved \ + --license GPL \ + --mailing-list-url $$(cat README | grep "^Mailing List :"|sed s/^.*\ :.//g) \ + --home-page-url $$(cat README | grep "^Web Page "|sed s/^.*\ :.//g) \ + --cvs-url $$(cat README | grep "^Repository"|sed s/^.*\ :.//g) \ + --gzipped-tar-url $$(cat README | grep "^Releases "|sed s/^.*\ :.//g)/"fim-`cat VERSION`".tar.gz \ + --mirror-site-url $$(cat README | grep "^Off.*rror : "|sed s/^.*\ :.//g) \ + --changelog-url $$(cat README | grep "^ChangeLog "|sed s/^.*\ :.//g) +# --url-demo $$(cat README | grep "^Web Page "|sed s/^.*:.//g) +# --bzipped-tar-url $$(cat README | grep "^Web Page "|sed s/^.*:.//g) + +freshmeat-submit: + @echo Project: fim + @echo Version: `cat VERSION` + @echo Release-Focus: Major feature enhancements + @echo Hide: N + @echo Home-Page-URL: $$(cat README | grep "^Web Page "|sed s/^.*\ :.//g) + @echo Mailing-List-URL: $$(cat README | grep "^Mailing List :"|sed s/^.*\ :.//g) + @echo Gzipped-Tar-URL: $$(cat README | grep "^Releases "|sed s/^.*\ :.//g)/"fim-`cat VERSION`".tar.gz + @echo Bzipped-Tar-URL: $$(cat README | grep "^Releases "|sed s/^.*\ :.//g)/"fim-`cat VERSION`".tar.bz2 + @echo License: GPL + @echo Mirror-Site-URL: $$(cat README | grep "^Off.*rror : "|sed s/^.*\ :.//g) + @echo ChangeLog-URL: $$(cat README | grep "^ChangeLog "|sed s/^.*\ :.//g) + @echo CVS-URL: $$(cat README | grep "^Repository"|sed s/^.*\ :.//g) + @echo + @ $(AWK) -- 'v=0;($$1 == "Version" && $$2=="'`cat VERSION`'"){while((input=getline) && $$1!="Version"){print}};' NEWS + +freshmeat: + @ echo "are you sure you want to freshmeat-submit ? (any key to abort, yes to continue)" && read yes && [[ "$${yes}" == "yes" ]] && \ + make freshmeat-submit | grep -v '^make\[' | freshmeat-submit + +commit: log + svn commit + +# This awaits completion. +#rpm: dist +# rpmbuild -ta @PACKAGE@-@VERSION@.tar.gz + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..0cca1f4 --- /dev/null +++ b/NEWS @@ -0,0 +1,239 @@ + + FIM NEWS -- history of (main) user-visible changes in FIM. + + Version 0.5-rc3 + + * fix: mouse movement under SDL used to trigger unnecessary screen redraws. + * bugfix: on certain framebuffer configurations part of the screen would not be redrawn. + * bugfix: conversion from external program was vulnerable to failure due to missing check. + * fix: gif error handling could have led to NULL pointer usage. + * fix: the largest mipmap was not always being used. + * fix: -lfl linkage is not really necessary: removed it. + * fix: support for PPM files with 2 bytes per sample. + * fix: configure script regex_t check was unnecessarily broken + * fix: was likely using uninitialized data in Image() + * fix: a few more checks when reading PCX files + * bugfix: a function in AADevice was missing return value + * documented the %k expando for _info_fmt_str and bugfix (avoiding data corruption when handling %k) + * to ease reproducible builds: imposing LC_ALL=C to $(YACC) and $(SORT), vim2html.pl reads SOURCE_DATE_EPOCH + * fix: when stdint.h is available use uint8_t, uint16_t, uint32_t instead of non-portable __u8, __u16, __u32 + * fix: ./configure --disable-pcx was not properly disabling PCX format support + * fix: compilation was broken without framebuffer (FIM_WITH_NO_FRAMEBUFFER) + * fix: compilation was broken without FIM_WITH_LIBSDL configured in + * fix: with _re_search_opts='f' the in-descriptions search was broken + * fix: removed obsolete documentation for the "window" command, now disabled + * bugfix: repeating "recording 'repeat_last'" (default '.' key) by prepending a number now works + * fix: cleaned up the internal keysyms initialization code + * fix: lastly used image will be erased at last, after eventually prefetched images. + * fix: configure will try to detect curses/ncurses. + * fix: configure will use `sdl-config --static-lib`'. + * fix: a check was missing in the PS decoder when reading from stdin. + * bugfix: --offset option was ignoring lower bytes-offset. + * fix in _seek_magic and documentation. + * fix: in --offset mode, avoiding probing for external loader programs, handling of larger offsets. + * fix: 'recording' command non functioning properly. + * fix: configure would fail on --disable-aa and absent aalib. + * fix: -s switch was broken. + + Version 0.5-rc2 + + * configure will autodetect and turn aalib on by default + * fix: will emit more precise diagnostics on unsupported device string + * fix: adjusted man pages for roff cleanliness + * fix: typos fixed in the documentation + + Version 0.5-rc1 + + * fix: enabled concurrent make, e.g.: make -j 4 + * bug workaround: had no console scroll if no command executed on PostInteractiveCommand + * fix: some systems don't have sys_errlist: using strerror there + * fix: corrected the quiet mode (-q) to be quieter + * fix: no zlib.h build time dependency (this will be reintroduced in the future) + + Version 0.5-rc0 + + * -R / --recursive switch to turn on recursive push of command line specified directories + * added --sort and --sort-basename to sort the images list + * introduced mipmap mechanism (_use_mipmaps) for faster display/scaling of images + * status bar customizable with _display_status_fmt and _info_fmt_str, which can be + controlled by the use of special image variable specifiers ('expandos'): + "%T" expando to get (and display) total memory used by the program + "%C" expando to get (and display) file/memory usage by image cache + "%M" expando to get (and display) memory used by the current (displayed) image + "%c" expando to get (and display) centering information + "%m" expando to get (and display) current image mipmap occupation information + "%k" expando to get (and display) current image i:_comment value + "%?PRE?VAR?POST?" expando to get (and display) "PRE".i:VAR."POST" + ... + * search (and jump) on image descriptions via 'goto' and key '/' + * when repeating search with 'repeat_last', will use last direction + * '?' key is now assigned to backward search (goto '-//') + * default 'C-p' key is now assigned to repeat last backward search (goto '-//') + * image cache will remember alignment within viewport + * jump back and forth from the last viewed image with the ' (single quote aka apostrophe) + key and the _lastfileindex variable + * added --load-image-descriptions-file (equivalent to 'desc' 'load') to populate + the i:_comment values of each loaded image file and set _caption_over_image=2 + (with it added also --image-descriptions-file-separator) + * added the 'desc "load"' command to load a textual files comments description file + * introduced a 'limit' command, with comment, file name, or marked file criteria + * the '`' key is bound to toggle limit'ing to the marked files list + * introduced 'list "mark"' and 'list "unmark"' syntax styled as 'limit' + * load i:_comment and i:var from description file, with forms: + "filename comment" (to i:_comment), + "#!fim:var=value" (to set i:var=value on all all the files following) + "#!fim:var=" (to unset i:var=value on all all the files following) + "filename #!fim:=" (to i:_comment from the value read last) + "filename #!fim:+comment" (similar, but will append the new comment) + "filename #!fim:^comment" (similar, but will prepend the new comment) + "filename #!fim:s/f/t" (similar, but replace string f with string t) + * EXIF tags will be read with libexif and become i:EXIF_-prefixed variables + * if _want_exif_orientation is set, images will be reoriented according to EXIF + metadata (i:__exif_orientation, i:__exif_mirrored, i:__exif_flipped). + * the 'help' command will search also in fim command options + * will optionally use C++11 constructs with ./configure --enable-cxx11 (no user level impact) + * scaling image code faster (thanks to __restrict__ pointers) + * customizable SDL window caption line with _want_wm_caption_status + * BMP format support is now optional + * PCX format support (optional) + * changed meaning of variable _ignorecase: now it affects autocommands + * introduced variable _re_search_opts affecting regexp-based search + * default key 'r' is bound to 'rotate90', key 'R' to 'rotate270' + * can be invoked without stdin; e.g. from an X menu + * added "display 'resize'" to resize the SDL window, eventually to image size + * default SDL mode is windowed now + * by default, the 'C-w' key will resize the SDL window to the original image size + * by default, the 'W' key will resize the SDL window to the image size, + and added an --autowindow switch to adapt window size to picture size + * the 'help' command will search in help items if argument starts with / + * special variable i:* expanding to all the variable name/value pairs of the current image + * opening image files in archives (e.g. CBZ,CBR,RAR,TAR,TGZ,TBZ,7Z,ISO,...) + with libarchive (experimental) + * JPEG-2000 file support via JasPer (experimental) + * added a ':- INTEGER' syntax, so one can specify the file in the list counting from the end + * added an _archive_files variable to specify which file name types specify archives + * added a 'list "pushdirr"' command, working like "pushdir" but recursively + * the _fbfont variable will contain the current console font file string + * mirror/flip are now being applied with respect to the viewport borders + * stat() checking of files on load can be disabled with _push_checks + * added --no-stat-push to set _push_checks=0 before initialization + * added the _caption_over_image variable (which is 0 unless --load-image-descriptions-file) + * 'Pause' and 'Menu' keys are now available in SDL (-o sdl) mode + * added 'list' 'marked' to show the list of marked files + * key 'Del' bound to pop (delete) the current image from the list + * i:_file loader will store the used loader string + * switch --offset accepts a range now (using the new _open_offset_retry variable) + * if an image has been opened with an offset, i:_open_offset will be set accordingly + * variable i:pagecount is now replaced by i:pages + * put aside (disabled) the v: b: and w: namespaces until they make more sense + * panning on mouse movement in SDL mode + * `make fim' goal has been deleted + * changed librsb library detection: now it's e.g.: + LIBS="`librsb-config --ldflags --extra_libs` " CXXFLAGS="`librsb-config --cflags ` \ + ./configure --enable-matrices-rendering + * bugfix: in some situations fim -o fb was not clearing the screen before drawing the image + * bugfix in the "list 'remove'" internals + * --binary=1/--binary=24 will not pad tiny renderings to _preferred_rendering_width pixels + + Version 0.4 + + * changed --random semantics and introduced --random-no-seed switch + * customizable status bar file info string + * introduced --as-text to render printable bytes as text + * key r is bound to 'rotate90', key R to 'rotate270' + * bug fixes for the g: namespace, SDL/X mode, "list 'pop'" command, + the --offset option, 'ascale' and rotation, documentation. + + Version 0.4-beta + + * interface to the GraphicsMagic library (more graphics formats supported) + * introduced bitwise AND and OR operators + * support for rendering "matrix market" numerical matrix files (with librsb) + * X mode not anymore default in aalib, available at option + * libjpeg usage fixes + * libpng usage fixes (support for PNG_LIBPNG_VER>=10209) + * documentation improvements (e.g.: fim man page is auto-generated) + * "imlib2" X-based output device support + * "sdl" output device improvements (fullscreen/mouse/windowed options, I/O, ..) + * more default consolefont options (e.g.: hardcoded consolefonts support) + * configure option to disable the fim history file + * improvements to scale, goto, other commands + * improved directories reading + * introduced --no-commandline, --no-internal-config switches + * aggregated some commands for clarity + * output console can be disabled at configure time + * important fbdev bug fixes + * autocompletion of variable identifiers + + Version 0.3 + + * minor strchr compilation problem on some systems + * better consolefonts support + * much better SDL support (different color modes) + * 'negate' feature + * -S, or 'sanity-check' switch + + Version 0.3-beta-prerelease + + * auto-generated documentation: more consistency + * grammar specification, in man fimrc + * internal commands,variables,autocommands reference man page, in man fimrc + * better internal help mechanisms + * more control (resolution change,windowed mode) in experimental sdl mode + * new commands (pread,reverse,shuffle,...) + * (temporarily) disabled internal windows splitting + * pushing files from a directory + * several minor and major bugfixes + + Version 0.3-beta + + * full support for AAlib (Ascii Art rendering) (-o aa) + * experimental support for SDLlib (Simple Directmedia Layer) (-o sdl) (X!) + * experimental PDF, PS, DJVU file support + * history file support (~/.fim_history) + * seamless caching and prefetching integration + * viewing of any type files as bitmaps (unset bits black, set bits white) + * viewing of any type files as pixmaps (as RGB triples) + * framebuffer driver now can be disabled at compile time + * colors inversion: saves a significant fraction of power when viewing documents + + Version 0.3-alpha + + * experimental support for AAlib (Ascii Art rendering) (-t) + * reading image files (-i) and scripts (-p) from stdin + * runs on the powerpc architecure + * rewritten from scratch the debug console, now buffered and with scrolling + * achieved speedup in magnifying pictures + * achieved speedup in displaying dithered images + * smarter quoting rules (looser quote checking) when "push"ing files + * dumping to file execution logs as executable scripts (-W/--write-scriptout) + * implemented regular expressions matching operator (=~) + * new default key bindings for split windows control + * could be compiled with no readline library (--disable-readline) + + Version 0.2 + + * internal windowing (with splitting, resizing, swapping) support + * .xcf, .fig, .dia, .svg files now viewable via wrapper calls + * introduced interactive command iteration ( in the [n] form ) + * fim will try to run under screen and over ssh now + * custom framebuffer device, fonts and gamma are supported + * enriched compile-time options via the ./configure script + * vim-styled variable scoping g:,i:,v:,w: (local variables) + * eradicated some bugs + * introduced new variables, commands + + Version 0.2-alpha + + * first windowing functionalities + * bugs and subtle flaws handling + * introduced new variables, commands + + Version 0.1 + + * regular expressions for filtering the viewed image list + * vim-like autocommands + * command line autocompletion + * command line history + * completely customizable key bindings + * external/internal scriptability diff --git a/README b/README new file mode 100644 index 0000000..2b64488 --- /dev/null +++ b/README @@ -0,0 +1,462 @@ +================================================================================ + FIM - Fbi IMproved README document. +================================================================================ + 1 Overview + 2 Description + 3 Features, comparison to other image viewers + 4 Compilation Requirements + 4.5 Testing + 5 Run Time Requirements + 5.5 Hacking, maintenance guidelines + 6 Original Idea + 7 Technical overview (important for patch writers) + 8 Availability in Linux distributions + 8.1 Debian, Ubuntu + 8.2 Gentoo Installation Tips + 9 License + 10 Contacts, mailing lists, URLs +================================================================================ + 1 Overview +================================================================================ + +FIM (Fbi IMproved) is a highly customizable and scriptable image viewer targeted +at the users who are comfortable with software like the Vim text editor or the +Mutt mail user agent. +FIM aims to be a "Swiss Army knife" for viewing images. + +It derives from the Fbi image viewer (by Gerd Hoffmann), and works primarily in +the Linux frame buffer console. +FIM is multidevice: it has X support (via the SDL and the Imlib2 libraries) +and it supports ASCII art output (via the aalib library). + +FIM is free software, and it ships under the GPL software license, complete with +documentation, in form of a doc/FIM.TXT documentation file, a man page, lots +of comments in the code, and some text files. + +================================================================================ + 2 Description +================================================================================ + +FIM is a highly customizable and scriptable image viewer targeted at the +users who are comfortable with software like the Vim text editor or the Mutt +mail user agent. +FIM aims to be a swiss army knife for viewing images. + +It derives from the Fbi image viewer (by Gerd Hoffmann), and works primarily in +the Linux frame buffer console. +FIM is multidevice: it has X support (via the SDL and the Imlib2 libraries) +and it supports ASCII art output (via the aalib library). + +FIM is capable of regular expressions based (on filename) vim-like autocommands, +comment-based search, EXIF tags display. +It offers GNU readline command line autocompletion and history, +completely customizable key bindings, external/internal (if/while-based) +scriptability (through return codes, standard input/output, and commands given +at invocation time, initialization file), internal filename-based image search, +and much more features. +Each user available command and variable is documented. + +FIM is free software, and it ships under the GPL software license, complete with +documentation, in form of a doc/FIM.TXT documentation file, a man page, lots +of comments in the (sometimes still dirty) code, and some text files. + +================================================================================ + 3 Features, comparison to other image viewers +================================================================================ + +Implemented features: + + - interactive (default) and command line modes + - all of the functionality is scripted in an internal domain specific language + - on-screen debug and information console in command mode + - per-image variables (e.g.: i:var="value") + - regular expression filename searches (/*.png) and viewing + - command line history (enter the console with ':', then use arrows with arrows) + - command line tab-based command autocompletion (thanks to the GNU/readline) + - command line command autocompletion + - command line history file saving/loading upport (~/.fim_history) + - key-action binding, with Shift and Control key combinations for interactive mode + - simple if/while scriptability, with integer/float/string variables and arithmetic evaluation + - command aliases support (macros) + - event autocommands (in Vim's 'autocmd' style) + - regular expressions on filenames to enrich autocommand behaviour + - image descriptions display + - regular expressions on image descriptions + - configuration (initialization) file support (~/.fimrc) + - usable built-in default configuration + - wrapper script to convert pdf,ps,eps,dvi,cbr(rar),cbz(zip),tar,tar.gz,tgz,http://... + contents into images and display with FIM + - embedded piping through 'convert','inkscape','xcftopnm','dia'... for a wider file formats compatibility + - index based goto in Vim's style (:) + - regular expressions (on filename) based goto and image search + - stuff usual for an image viewer (scale, pan, etc..) + - stuff (un)usual for an image viewer (setting scale factor, auto width scale, + auto height scale, marking of 'interesting' files, sorting of files in the + list, recording/replaying of sessions, repeat last action ) + - image flipping, mirroring, rotation, stretching (asymmetric scaling) + - command iteration ( in the [n] form ) + - external script file execution + - system call support + - image caching (optional) + - image prefetching (optional) + - pipe commands from some input program + - many of these features could be enabled or disabled at compile time editing the Makefile + - runs under screen + - standard input file list read + - standard input whole file read + - standard input script file read + - support for AAlib (Ascii Art rendering) (-o aa) + - support for SDLlib (Simple Directmedia Layer) (-o sdl) (X!) + - experimental support for Imlib2 (-o imlib2) (X!) + - experimental PDF, PS, DJVU file support + - viewing any file as a binary/RGB pixelmap + - viewing any file as (rendered) text + - opening files at a specified file offset + +Yet unimplemented features: + + - autodocumentation, like gdb or vim + - mutt-like patterns ~p, ~r ... + - advanced pattern selection of images on other criterias ? + + + Follows a comparison of popular image viewers available on Linux, focusing on + the peculiar FIM features. + We take in consideration free software. + Note also that no all of the feature could ever exist in all of the mentioned + programs, by their very nature. + + ______________________________________________________________________________ + + \ Program: kuickshow eog [xz]gv fbi FIM GQview dfbsee pv qiv + ______________________________________________________________________________ + Features: + + status:(a)lpha/(m)ature m m m a m m m m m + environment(f=frame buffer)X X X,svga f f X f X X + linux specific ? * * * * ? + key rebindings * * * ? + external scriptability(bash,..) ~ * ~ ? + internal scriptability * ? + internal scriptability minilanguage * ? + printing support * * ? * ? + slideshow * * * * * * * * + caching * ? * * ? + preview browser * * ? + EXIF tag display * * * * ? + internal windowing X ? + internal image search * ? + external image search * ? + 'pan views' ('rich' views) * ? + system interaction * * * ? + system interaction safe * ? + remote commands * ? + saves last folder * * ? + runs under screen * ? + standard input interaction * ? + rotation * ? ? ? * ? ? * * + history * + multi-device (X/SDL, frame buffer, aalib) * + mirroring * * + ... + +Other nice command line picture viewers: pv (http://www.trashmail.net/pv/), + zgv, feh ... + + ______________________________________________________________________________ + + +================================================================================ + 4 Compilation Requirements +================================================================================ + + - the GNU readline library ( http://directory.fsf.org/readline.html ) + - GNU flex (NOT any lex ) ( http://directory.fsf.org/flex.html ) + - GNU bison (NOT any yacc) ( http://directory.fsf.org/bison.html ) + - the GCC ( GNU Compiler Collection ) ( http://directory.fsf.org/gcc.html ) + - optionally, header files for: + libpng ( http://directory.fsf.org/libpng.html ) + libjpeg ( http://www.ijg.org/ ) + giflib ( http://sourceforge.net/projects/giflib/ ) + libtiff ( http://www.libtiff.org/ ) + libdjvulibre ( http://sourceforge.net/projects/djvu/ ) + + Libraries originally required by Fbi but not by FIM: + libFS, libCURL, libLIRC + + + GNU Flex version prior to 2.5.4a and GNU Bison version prior 1.875d" are + known to give compilation problems, so make sure you have newer versions of + these. Note that Flex 2.5.4a comes after Flex-2.5.4. + This note is especially precious for Debian/Ubuntu users. + +-------------------------------------------------------------------------------- + 4.5 Testing + + Just after the './configure' and 'make' steps, you should: + + # test if fim works at all on this machine/user + make test + + # test if fim works at all on this machine/user (if you compiled aa support) + make aatest + + # run a pool of test scripts, which should validate most fim functionalities + # for common usage. + make tests + + # if you are a fim developer/hacker, test thoroughly all configure options + # (a long test) + make tests-all + +-------------------------------------------------------------------------------- + 4.6 Example: compiling FIM from repository on Ubuntu/Debian: + + sudo apt-get install subversion + sudo apt-get install automake autoconf libtool + sudo apt-get install libreadline-dev libexif-dev + sudo apt-get install libjpeg-dev libpng-dev libtiff-dev libgif-dev + sudo apt-get install libsdl1.2-dev libaa1-dev + # experimental: + sudo apt-get install libpoppler-dev libdjvulibre-dev libspectre-dev + sudo apt-get install libarchive-dev + svn co http://svn.savannah.nongnu.org/svn/fbi-improved/trunk/ fim + sh autogen.sh + cd fim + ./configure --enable-poppler --enable-aa --enable-sdl + make + +================================================================================ + 5 Run Time Requirements +================================================================================ + + - A Linux (not sure if it is necessary for it to be an x86; i think not) box + - The frame buffer device ( e.g.: /dev/fb0 or /dev/fb/0 ) enabled in the kernel + ( and usually found in "/usr/src/linux/Documentation/fb" in the kernel source + code tree ). + - shared library files for: libpng, libjpeg, libgif, libtiff, libreadline, + libexif + +================================================================================ + 5.5 Hacking, maintenance guidelines +================================================================================ + +If you hack FIM in an interesting way, consider submitting your changes as a +patch. + +There is a number of informal rules to follow when maintaining or hacking and +contributing to FIM + + - If you intend to support a new file format, remember that `fim -V` should + list the supported file types list. So you should update it. + - If you intend to support a new output device, remember that `fim -V` should + list the supported output devices. So you should update it. + - FIM should continue passing the tests after your patch, and your patch should + be robust, too. Consider writing a new test case. + +================================================================================ + 6 Original Idea +================================================================================ + +The original architecture of FIM is based on the wonderful fbi-1.31, written by +Gerd Hoffmann/Knorr: ( Fbi can be obtained at http://linux.bytesex.org/fbida/ ). + +The idea was to enrich Fbi with a command line and configurability features. + +An idea of the concept was settled when developing a small 'vim-like fbi patch' +back in 2005. + +The code was applied as a patch an the existing fbi source tree, but was not by +any means near to what is FIM today. + +FIM aims at a complete reorganization of the Fbi code, and ideally towards an +implementation of the most scriptable and configurable image viewer ever - not +tied to the frame buffer device and to a single keyboard input. + +================================================================================ + 7 Technical overview (important for patch writers,but old) +================================================================================ + +To run FIM requires a Linux box with the frame buffer device enabled in the +kernel, and some popular image file decoding libraries. + +Information about the frame buffer can be found under the directory + "./Documentation/fb" + inside the kernel tree + (usually "/usr/src/linux/Documentation/fb" ). + +The libraries can be found on their sites (as of 20070312): + + libpng : http://www.libpng.org/ + libjpeg : http://www.ijg.org/ + giflib : http://sourceforge.net/projects/giflib/ + libtiff : http://www.libtiff.org/ + libdjvulibre : http://sourceforge.net/projects/djvu/ + +Tested and working with library SDL-1.2.12. + +Note that it is highly likely that you already have these libraries on your +system, especially on Gentoo Linux. + +From the original README, it reads that Gerd himself built FBI hacking +"a svgalib PhotoCD viewer", so regard this software as a big, dirty code +potpourri :) . +For the sake of completeness, FIM started as a fork of version 1.31 of fbi, +available from http://dl.bytesex.org/releases/fbida/fbi_1.31.tar.gz . + +Useful documents I've read and consulted during the coding of Fim, and +useful for hacking it: + +Thomas Niemann's tutorial to yacc & lex +The yacc & lex HOWTO +GNU readline manual +Ray Lischner, STL Pocket Reference, O'Reilly, 2004 +Herbert Schildt, C++- Complete Reference, Third Edition, Osborne McGraw-Hill, 1999 +http://www.gnu.org/software/m4/manual/ +http://www.gnu.org/software/autoconf/manual/ +http://www.gnu.org/software/automake/manual/ +http://www.gnu.org/software/make/manual/ +http://www.gnu.org/software/bash/manual/ +http://www.gnu.org/software/bison/manual/ +flex manual ? +man console_codes +man fb.modes +man fbi +man console_ioctl +man resizecons + +Useful documents I could read later on: +vim -c ':help' +man 3 history +man readline +http://www.gnu.org/prep/standards/ + +Useful URLs: +http://www.tldp.org/HOWTO/Framebuffer-HOWTO.html +and mirrors +http://www.linux.org/docs/ldp/howto/Framebuffer-HOWTO.html +http://www.pluto.it/files/ildp/HOWTO/Framebuffer-HOWTO/Framebuffer-HOWTO.html + +and +http://bisqwit.iki.fi/source/fbmodes.html +http://asm.sourceforge.net/articles/fb.html +http://www.linuxjournal.com/article/2783 + +Tested platforms: + - 2.6.25-2-686 Linux Kernel, GCC-4.3.1, flex 2.5.35, bison 2.3, Debian Lenny, x86 + - 2.6.17 Linux Kernel, GCC-3.4.6, gentoo, x86 + - 2.6.17 Linux Kernel, GCC-4.1.1, gentoo, x86 + - 2.6.17 Linux Kernel, GCC-3.3.6, flex 2.5.4, bison 1.875d, gentoo, x86 + - 2.6.17 Linux Kernel, GCC-3.3.6, flex 2.5.4, bison 2.2 , gentoo, x86 + - 2.6.17 Linux Kernel, GCC-3.3.6, flex 2.5.33,bison 2.2 , gentoo, x86 + - 2.6.19 Linux Kernel, GCC-4.1.1, flex 2.5.33,bison 2.2 , gentoo, powerpc + - other ones, but non documented here. + + -- + + If you intend to write patches or contribute to the code, be sure of reading + all of the documentation and _write me an email first_ (i will give you some + advice). + + The code is much complicated and is very susceptible. + +================================================================================ + 8 Availability in Linux distributions +================================================================================ + +-------------------------------------------------------------------------------- + 8.1 Debian, Ubuntu + + You should find fim in Debian and Ubuntu, and install it with: + + sudo apt-get install fim + + But beware: the deb packages are very likely to be outdated. + + + In order to build from svn sources, you are advised to install packages from + the following (overly complete) list: + + autoconf autoconf-archive autoheader automake autotools-dev bison ctags + flex groff g++ libaa1-dev libdjvulibre-dev libgif4 libgif-dev libimlib2-dev + libjpeg-dev libncurses5-dev libpng-dev libpoppler-cpp-dev libpoppler-dev + libreadline-dev libsdl-dev libspectre-dev libtiff-dev libtool m4 make svn + txt2html libexif-dev + + The above list was valid on a Debian Jessie installation; it's fair to expect + these packages names to change a little with time.. + +-------------------------------------------------------------------------------- + 8.2 Gentoo Installation Tips (obsolete) + +On the Gentoo Linux distribution , you should not have problems building FIM by +first installing some libraries: + + $ emerge media-libs/giflib media-libs/jpeg media-libs/libpng media-libs/tiff +and Bison (from 1.875d on) and Flex: + $ emerge flex bison + +This should suffice. +Once these requirements are satisfied, you could proceed with the + ./configure ; make ; make install +sequence. +Standard installation details are in the INSTALL file. + +BEWARE: THERE COULD BE PROBLEMS WITH FLEX/BISON! + +WARNING: the gentoo linux fim package version (<=0.2) is obsolete! + +"flex version 2.5.4" and "bison (GNU Bison) 1.875d" are known to work. + +================================================================================ + 9 License +================================================================================ + + FIM is free software, and is licensed under the GPLv2 or later. + + FIM extends the Fbi program by Gerd Hoffmann, which is "GPLv2 or later". + FIM uses the PCX reading code contributed by Mohammed Isam. + FIM also uses a regex.c file from the GNU Regular Expressions library, +distributed on http://directory.fsf.org/regex.html, in the version shipped with +the Mutt mail user agent (http://www.mutt.org). + It also uses some scripts shipped with the Vim text editor (http://www.vim.org), +which is licensed compatibly with the GPL. + The FIM source code package includes the Lat15-Terminus16.psf file, originally +from the GPL licensed Terminus Font package, version 4.30 by Dimitar Toshkov + Zhekov. + +================================================================================ + 10 Contacts, URLs +================================================================================ + +FIM is (C) 2007-2015 Michele Martone. + +You can contact me via email: "dezperado_FOobAr_autistici_Baz_org", after +replacing _FOobAr_ with a '@' and _Baz_ with a '.'. + +If it is for a bug report or installation help, be sure of reading the +documentation and the BUGS file first, and then you're welcome. +If it is for other suggestions or ideas, you are welcome, too (and don't miss +the TODO file, too)! +FIM is not perfect: a number of weaknesses are summarized in TODO and BUGS. + + +Web Page : http://savannah.nongnu.org/projects/fbi-improved/ + +Announcements: http://freecode.com/projects/fbi-improved/ + +Mailing List : http://savannah.nongnu.org/mail/?group=fbi-improved + (or http://lists.nongnu.org/mailman/listinfo/fbi-improved-devel) + +Releases : http://download.savannah.nongnu.org/releases/fbi-improved + +Repository : http://svn.savannah.nongnu.org/svn/fbi-improved + +Off. Mirror : http://www.autistici.org/dezperado/fim/ + +ChangeLog : http://svn.savannah.nongnu.org/svn/fbi-improved/trunk/ChangeLog + +Bugs (official) : http://savannah.nongnu.org/bugs/?group=fbi-improved + + $Id: README 900 2015-12-20 19:40:16Z dezperado $ + vim:tw=78:fo=tcq2:isk=!-~,^*,^\|,^\":ts=8:ft=help:norl: diff --git a/README.FIRST b/README.FIRST new file mode 100644 index 0000000..9ae5238 --- /dev/null +++ b/README.FIRST @@ -0,0 +1,70 @@ +-------------------------------------------------------------------------------- + FIM Quick start ( the happy path ) : +-------------------------------------------------------------------------------- + +in the fim directory, invoke: + + # make + # make test + # ls -l fim + # chmod +x ./src/fimgs.sh + # ./src/fimgs.sh media/*.pdf + + And in order to have a *working* configuration file, issue: + # cp fimrc ~/.fimrc + ( a correct configuration file --- if at all --- is essential to the + proper working of FIM ) +-------------------------------------------------------------------------------- + BUILDING +-------------------------------------------------------------------------------- + +If you get problems with compilation, please send me an email with +the output of: + + # make report + +Problems may arise if fim fails finding its libraries.. + + +-------------------------------------------------------------------------------- + USAGE +-------------------------------------------------------------------------------- + +There is no good documentation currently about the internal language, as i have +not yet finished working on it. + +But to warm up with FIM, it is indicated to use the commands in the fimrc file. +The ./fimrc file is the one fim loads at startup. +It contains commands that bind keys to commands, aliases and such things. + +WARNING : DO NOT QUIT FIM WITH CONTROL-C ! IT CAN BREAK YOUR CONSOLE AND YOU +WILL NEED TO DO DIRTY TRICKS TO RESTORE ITS GRAPHICS CAPABILITIES. +USE q INSTEAD! +WARNING : DO NOT QUIT FIM WITH CONTROL-D ! AS ABOVE + +WARNING : DO NOT USE THE BINDINGS CONTROL-C, CONTROL-D, CONTROL-S, as they are +probably already signal-bound by the underlying terminal!! + +TIP : If the program hangs and gets terminated, leaving the console useless, DON'T PANIC! +Don't try to switch console -- better type blindly 'fim *' (or its path) +even if you don't see anything. This will restart it, and probably restore the console! + +Invocation : ./fim picture.jpg .. + +Default configuration bindings: + q quit + hjkl as in vim :) + n/PageUp next + p/PageDown prev + C-a auto scale + w auto width scale + : enter command line mode + Enter exit command line mode + + magnify + - reduce + C-+ increase scaling factor + C-- decrease scaling factor + +(C stays for Control) + +-------------------------------------------------------------------------------- diff --git a/THANKS b/THANKS new file mode 100644 index 0000000..d4c4797 --- /dev/null +++ b/THANKS @@ -0,0 +1,8 @@ + Thanks go to (in temporal order, newer to older): + +Mohammed Isam, for having provided PCX reading support +Matthieu Crapet, for enabling out-of-tree builds +Marco Barbàra, for testing and critiques +Vitaly Minko, for testing and debugging on ARM +Damiano Biagioli, for early testing +Marta Carbone, for early testing and debugging diff --git a/TODO b/TODO new file mode 100644 index 0000000..add6d65 --- /dev/null +++ b/TODO @@ -0,0 +1,504 @@ + $Id: TODO 1040 2016-08-25 09:24:55Z dezperado $ + +This file is a melange of ideas aimed towards further development. +If you are interested into Fim internals, philosophy, and evolution, you +are welcome to read and help improve this file, and subscribe to the +fim-devel mailing list ( fbi-improved-devel@nongnu.org ). + +If you would like to contribute to Fim, this file may give you ideas or +advice, meanwhile if you would like to contribute with an idea, it may +contribute to this file, too. + +Of course, the BUGS file is a source of constant inspiration (we may say, +of a maniacal taste ) for further improvement, too. + +If you just intend to learn more about Fim, please read the program +documentation in the "doc" directory first along with the man pages. + +Warning : Stuff in this file may be outdated, but necessary for +ongoing further inspiration. + +------------------------------------------------------------------------------- + Misc Current development directions + + +20141130 disabling convert or bmp can break test8 -- shall fix this, perhaps by ignoring the *.svg file there. +20141130 shall support a dual configure style: for each $LIBRARY, $FIM_LIBRARY_LIBS/$FIM_LIBRARY_CXXFLAGS and LIBS/CXXFLAGS. +20141130 rename configure options w.r.t. program options; e.g. --raw-bits-rendering to -o bit1/ -o bit24 +20141130 configure output shall fit in one screen +20141129 the configure is not well made w.r.t. exif, jasper, ... +20141129 setGlobalVariable -> setGV +20141129 setGlobalVariable("i:",FIM_VID_WANT_AUTOCENTER,1); +20141127 shall clean up Image::getInfoCustom considerably +20141126 shall document the exiftool interface +20141123 update all flags docuentation of FIM_VID_WANT_CAPTION_STATUS/... +20141123 clean up Image::getInfo +20141122 document/expand the FIM_WANT_EXPERIMENTAL_BASENAME functionality. +20141113 shall document the new '%k' descriptor, or expand it for generality. +20140830 version 0.4 does not cache limit on memory: may want to fix this. +20140830 need a precise control of scaling rules and viewports cache, as well to extend the viewport cache to scaled images +20131211 sort file names by modification date ? +20131107 fix --disable-scripting case ! +20131107 this is spurious: fim::string execute(const std::vector &args) +20131107 getIntVariable(varname) -> getIntVariable(varname, domain) +20131010 text/ascii/bits ascii renderer as funny fallback renderers +20131010 shall configure default tmpdir to /dev/shmem/something +20131009 may interface to http://www.feep.net/libtar/ +20130902 add a simple menu e.g.: using Motif (http://www.opengroup.org/desktop/motif.html), or buttons; e.g.: using X: http://www.x.org/releases/X11R7.7/doc/libX11/libX11/libX11.html#XEvent +20130829 interface to a library for gestures, someday. +20130824 need a "verbose pressed keys" mode, to help when guessing key bindings. +20130725 shall add autodetection of file format to "fim -" +20130702 "nextindir" function +20130702 http://dvdhrm.wordpress.com/2012/12/10/kmscon-introduction/ +20130620 need a minimal ppm file for testing +20130523 fix the bug when loading say, a a/1.fake and getting the files list shortened by two instead of one. +20130521 image decoder name as a variable. +20130505 glob() on non existent files +20130501 shall cache stat() results +20130412 may use a library like http://www.littlecms.com/ +20120811 need proper jpeg error handling +20120805 feeding a .png named PS file can lead to segfault. why ? +20120804 should create a general 'filter' autocmd trigger +20120804 negate and desaturate should be either applied instantly or accumulated in queue as transformations +20120718 " - multiple internal windows with indipendent images displayed at once" is discontinued! +20120718 make sure to substitute "framebuffer" with "frame buffer" in the docs and FIM.TXT +20120705 some day would be nice to use dnotify +20120408 bug: _filename non e' settato al primo caricamento: serve un goto_qualcosa prima +20120407 to clone a whole fim instance in a new process +20120130 to open svg files "natively" +20120129 for scalings that are multiples of an integer, may write a specific code +20120108 use zzuf; e.g.: for ((seed=0;seed<4;++seed));do zzuf -I jpg -s $seed src/fim media/ -c quit ; done +20111202 seem like an empty eps file crashes fim +20111124 does not compile on hpcff +20111122 fim inverts the colours of eps files +20111112 font resources: + psf tools: http://www.seasip.info/Unix/PSF + sigma consolefont: http://homepage.ntlworld.com/zarniwhoop/consolefonts/sigma.html + an old kbd HOWTO http://www.win.tue.nl/~aeb/linux/kbd/font-formats-1.html + psf format specs: http://tph16.tuwien.ac.at/cgi-bin/dwww/usr/share/doc/console-tools/file-formats/psf + an ancient article about linux 2.4 font handling: http://linuxgazette.net/issue91/loozzr.html + a bibliography (loosely related to psf): http://fontforge.sourceforge.net/bibliography.html +20111111 may use libgunzip / gzip decoding library ? +20111107 what about uploading nightly versions to savannah ? shall upload fim to savannah ! +20111025 seems like putting an invalid entry in the fonts list breaks list scanning +20111016 in the cookbook: how to 'catch' images in a directory full of oddly named files ? +20111008 decouple strings location from executable (e.g.: allow for a memory-mapped help/strings file) +20111005 imlib2 shall be suggested among devices on device fail. on hlst3, 'w' rendering bug. screen-patch should be optional at runtime when selecting the fbdev device +20111005 enable verbose keys specific to a device +20111003 http://tronche.com/gui/x/xlib/input/keyboard-encoding.html#KeySym +20110930 hand-based panning in fim; see feh +20110930 fim+sdl with an extra monitor aside fails. but mplayer seems to work, in this case. why ? +20110929 shall give a recipe and render possible to view a 100%-scaled image with zero scaling. +20110927 the cache system shall resist time index overflow +20110927 fix the bug opening the gif icon in media/ through graphicsmagick; manifests on hlst3 +20110926 every bit of fim functioning shall be documented +20110926 fim manual sections in hardcoded strings shall be systematically coherent +20110926 shall be able to open movie files and displaying them (not cacheably), frame by frame +20110926 shall handle timeout handling when reading from a pipe +20110922 plugins shall be able to return variables +20110921 need mipmap scaled versions of images; plugins as the opencv one may operate on a selected mipmap, and then incrementally go up +20110913 shall use AC_ARG_VAR in configure.ac, so ./configure --help displays the 'precious' variables +20110909 tty control stuff (e.g.:saved_attributes_) shall be compile time optional +20110907 vedi liburiparser +20110904 buffering stdin/whatever shall be tmpname/fd backed +20110904 shall introduce more verbosity levels +20110904 see http://barre.nom.fr/medical/samples/ for sample DICOM files +20110902 'cd' should (may?) have vim's semantics +20110902 every command should be profilable: how ? +20110902 need fim-recipes (1) to collect misc wisdom +20110901 should provide an easy and benchmarkable method (variable based) to load a big list of files (thousands) with maximum speed (that is, without checking the signatures) +20110831 insert macros here and there for random or controlled error injection +20110831 whenever possible, error strings shall be printed out escaped; if not possible, this should be reported. +20110831 program return codes should reflect failure reason (e.g.: generic unspecified, input, internal, device, memory exhaustion, etc) +20110830 should provide some statistics/microbenchmarks; e.g.: pixels/s in resize, or bytes/s in disk I/O, etc. +20110830 write an 'interruptible' interface for heavier functions +20110830 very big files should be allowed to be read with no big copy +20110830 smaller files should be allowed to be read with copy (so, a single from-disk copy) +20110829 I am not sure whether --cd-and-readdir works; shall write an accurate test for this +20110824 need statistics on memory usage, from within fim. +20110824 need help [ "grep" | "find" ] +20110823 need to interface to zip.h and libzip -- and define a 'buffered', or 'virtual' files abstraction +20110917 should build a separate fim-main program, in order to generate a valid man help when the user manual will not be online (e.g.: in a minimalistically configured fim, with all inner docs cut out) +20110820 should have a way to disable terminal control flow (thus allowing C-s, C-q) +20110817 need macros to check for allowed width/height/bpp/... values +20110816 fim.h should be an #include-only container ! +20110816 repeat should become a standard argument of commands +20110801 is there a way to make fim load . if no file is specified ? +20110801 a pensarci bene, bottoni in sdl mode non sono poi cosi' impossibili +20110724 program 'fimtutor' as 'fim --tutorial' +20110724 Ctrl-C shall prompt for quitting (or optionally, quit), interrupting any interruptible task +20110724 allow plugins which can only load metainfo (user variables) from under-loading files (e.g.: plugins using specialized libraries) +20110713 semi-colons terminating commands can be misleading +20110713 parse errors should be verbose +20110713 dez@nino:~ $ fim -c 'variables;stdout _last_system_output;quit' +20110711 autocompletion of varname = would be both cool and useful +20110711 shall give the user chance to specify the position of an autocommand (e.g.: -1, +1, etc) within the current autocommands list +20110711 shall give the user chance to push dirs contents sorted +20110710 make dox dies under cygwin (unsupported man options) +20110709 need to write to fim-users mentioning the ChangeLog and the solved bugs +20110709 grep .. | sed .. | fim_h_autocmds.h +20110709 grep .. | sed .. | fim_h_error_codes.h +20110709 grep .. | sed .. | fim_h_variables.h +20110711 may use ESC as a readline-exiting key +20110702 exif tags may goto i:exif:* variables +20110702 bind '\\' 'scale "100%"'; # is not accepted; this is bad +20110701 shall establish a policy in using #error +20110701 an easy way for window resize on 'next', in sdl mode +20110629 use CHAR_BIT in src/FbiStuffBit1.cpp +20110628 fimgs has some problems +20110627 ./configure --no-history +20110626 man8 fim; man5 fimrc +20110624 vedi se e' possibile 'goto last' e se PostNext e' ancora li da qualche parte +20110623 2. does not work +20110623 one may add :{+number} +20110623 missing :+// +20110622 test7 was modified to work after some horrible page/cache hacks. consider rewriting the test +20110622 the cache/goto code now is a complete mess (page-wise next interacts with cache) +20110622 shall fix the FIM_HORRIBLE_CACHE_INVALIDATING_HACK +20110620 the lock/unlock usage style in the SDL case may not be correct in many situations, leading to system lock errors +20110620 sdl is still flawed without an interactive shell underneath; libreadline used in non-callback mode uses the terminal, and this is bad (verify this by running from within nautilus scripts) +20110620 need a user friendly, self-uninstalling warning message on empty files list, on startup +20110620 tab based files autocompletion has problems (may show only partial results) +20110620 init feature-check routine with some regexp/regsubst functionality testing +20110621 shall expose a regexp substition command +20110619 need an option for non-name-based, but loader-based directory scanning + +------------------------------------------------------------------------------- +Documentation features/fixes: + +20110129 incongruences in FIM.TXT: the system command is declared to be non active. this is wrong. +20090512 TODO : implement a regexp-based search, to give the user hints. (20090512) (like vim's helpgrep, helpfind) +20090418 fimtutor + +------------------------------------------------------------------------------- +Major language clarity features/fixes: + +20110620 many commands shall be documented conditionally +20110517 may consider distinguishing "options" from "variables", as vim does +20110507 need a special mention for special variables (and their namespaces), in the documentation +20070417 It has come the time to decide the future developments of Fim. + A lot of doubts arose. Here they are: + - integration of the command line completion with the lexer/parser, to gain consistency + - decisions about the nature of the language: + - should the variables be accessed like Bash,Perl, or C? + - should strings exist? + - should arrays exist ? + - should types exist ? + - should boolean options exist (like in Vim's paste/nopaste) ? + - should multi (quad/..) options exist (like in Mutt) ? + - could it be nice to attach options set to an image/browser (e.g.: + autowidth in only a window in a multiwindow scenario )? + - integration with external libraries/scripts/etc.. ? + + These issues need reflection and study of the practical and theoretical + advantages/possibilities/limitations of the alternatives. + Meanwhile, the current development effort will be focused on enhancing + the existing code, possibly not adding features but enhancing the code + structure and converting the odd Fbi code in elegant, or possibly more + optimized, (especially the hacked, critical parts concerning mirroring + and flipping! ) Fim code. +20070903 these features are currently going to be worked in the near future: + - arbitrary long key sequence bindings (mutt-like) + - shortcuts algebra for commands + - parameter passing to commands + - variables scoped inside viewport (v:), window (w:), image (i: or l:), global (g:), script (s:) + - (to study) lookup tables to string to integer token conversion of variable names + (to gain speedup and increase variables impact) + - (to study) active variables - variables triggering actions + - vim like 'set', 'let', 'unlet' commands.. + +------------------------------------------------------------------------------- +Minor language clarity features/fixes: + +20110615 scale_increment & co -> in the "default aliases" section +20110615 set_commandline_mode -> cmdline on ; set_interactive_mode -> cmdline off ; clear -> console [clear|info] +20110615 color [negate|gray] +20110615 redisplay = display 'force' ; reload = load 'force' +20110615 info [size|width|...] +20110613 need a single variable for flip,mirror, and eventually rotation (e.g.:fmr90) +20110613 shall reintroduce many composite commands tokens (e.g.: "pan 'up'") +20110612 scrolldown,scrollforward -> [pan|scroll] forward|read +20110612 dump_key_codes -> dump key_codes|variables|commands|aliases +20110612 clear -> console clear +20110612 shall rename from _varname to v:varname, whenever this has sense. +20110610 shall unify the scaling-control variables +20110504 aa driver swaps pageup/pagedown ? +20071127 histall, histdell +20071006 implement mechanisms or policies for namespace inheritage on windows split + +------------------------------------------------------------------------------- +Major and tricky (time consuming) features: + +20111003 need a function checking if all sym_keys in some device are populated. +20110604 may consider usage of ffmpeg's libswscale for image scaling +20110615 collate/permute args in aliases (for ensuring primitive recursive computability, with some other features) ? +20110530 in some contexts, using libsvga (see http://www.svgalib.org/jay/beginners_guide/beginners_guide.html) may be interesting +20110516 shall foresee a mechanism for `stacked decoding'of `container' files (e.g.: gz,tar,tar.gz,bz,...) +20110516 shall foresee support for dynamically lodaded modules, for a number of operations (e.g.: file decoding/loading using custom external programs or libraries); see also http://tldp.org/HOWTO/Program-Library-HOWTO/dl-libraries.html +20110506 shall see libicu http://userguide.icu-project.org/, for internationalization/unicode +20110127 consider making the program ready for GNU gettext: http://www.gnu.org/software/hello/manual/gettext/index.html#Top +20110117 could develop a "stack of windows" idea, for zooming or such stuff. +20110108 use static_cast, for it is not ambiguous with conversions +20090512 argument to aliases +20080127 think about a multi-monitor strategy for a single instance of Fim: note that currently it is possible to specify a framebuffer device (therefore a monitor) via -d (--device) + +------------------------------------------------------------------------------- +Minor but tricky (time consuming) features/issues: + +20110618 cd dir ; push /regexp/ +20110617 may honour command line options parsing features of aalib +20110521 autocompletion shall be escaped (for opening filenames containing quoting chars) +20110612 using up and down keys in / mode seems to recall general history, not search history (even in old fim revisions)! +20110615 '3g'-like interactive command ? right now, it will repeat 3 times 'g', but we may internally switch the while to a special argument +20110530 need some "emergency" command and/or mechanism for freeing/reclaiming memory (e.g.:caches, buffers) +20110507 the generated man output shall print out examples which are also a correctness test +20110202 DICOM integration ? see libmdc2-dev / man medcon +20110503 it would be cool to allow bindings valid in consolemode +20080430 find a way to catch the console signal C-s in fim in a way to make C-s bindable +20080313 make each cpp file include exactly the header files used +20080216 add textureview mode +20091214 consider using libmagic +20090810 :|ocr - or : PostFileRead +20090513 _seek_magic : if set, this pattern will be searched before going to the next image or seek_next {pattern} ?, associando ad Image l'offset .. (a' la multipage) +20090318 minicheck to detect wrong permissions on fb file ?! +20081228 marked pictures should have at least some asterisk and the user should be able to unmark them. +20080903 introduce a variable for handling centering style : sticky, proportional, smart, ... (see Viewport) + +------------------------------------------------------------------------------- +Test & correctness oriented features: + +20110620 use cpp instead of grep when autogenerating doc files +20110612 the parser should be strictly checked for leaks +20110612 need a runtime method for diverting stdout ? may ease debugging. +20110602 need a test for the goodness of the 'random' variable numbers. +20110516 invoking fim in sdl mode with very low resolutions/window sizes is crashy. this is bad. +20110515 shall preprocessor-conditionally catch std::exception's and cout'ing this info or activate some debug channel. +20110515 shall use clear() resize(0) instead of clear() alone (which does not resize arrays) +20110515 shall check against end() after each erase() operation on vectors +20110507 need a macro to avoid X == "" comparisons +20110129 all of the scripts/rc scripts should be tested for compliance +20110108 use google's cpplint for a cleaner code: http://google-styleguide.googlecode.com/svn/trunk/cpplint/cpplint.py +20110108 apply the 'explicit' keywords to constructors +20101007 the use find_key_for_bound_cmd() should be avoided in status line update +20091220 consider distributing a font file or simply to embed a freely licensed one in the sources, with an eye on portability +20091116 write some miniprogram for debugging keyboard input. +20091004 pdf picture viewing is memory greedy - be it a leak ? +20090820 should add a quick sanity check flag ( e.g.: --sanity-check ) +20090711 should develop some quick benchmark to evaluate some drawing operations (e.g.: blanking, color fill, etc) +20090603 fix Adobe CS3 created jpg files opening +20090530 crop = gTrue; // fix this +20090419 serious exception handling for out of memory conditions for push_back's and stuff +20090412 fbi bugs: http://bugs.debian.org/cgi-bin/pkgreport.cgi?pkg=fbi +20090404 could use dejagnu for interactive (keyboard interaction based) testing + http://www.kegel.com/xgcc3/ng1.txt, although first tests with expect (http://expect.nist.gov/) showed it + doesn't handle well input exchange with fim +20090318 static checkers ? + stllint : aszt.inf.elte.hu/~gsd/s/cikkek/concepts/2006/GregorSchuppSPE05.pdf + cppcheck : http://sourceforge.net/projects/cppcheck/ + using astyle for code readability ? + could use flawfinder +20090305 moritz suggests fimgs with : + src/fim -c 'autoheight=0;autowidth=0;v:auto_scale_v=0;'\ + 'autocmd "PostRedisplay" "" "g:oscale=scale;";'\ + 'autocmd "PostReload" "" "scale g:oscale.\"%\";";' *pages* +20090223 http://www.cubewano.org/oink <- use this automated checker, as well as other tools, possibily at least for format string vulnerabilities +20090224 to test better, develop some simple string functions and f(){}, a=f(x,y) , f , f x y , in vim style if possible, regexp_search +20090212 fix problems deriving from missing binaries and stuff +20090110 write a test case with memory constraints (in a way to stress say, failing mallocs) +20090108 write a test for corrupt image resilience (testing skip functionalities) +20081229 write a malloc and calloc wrapper, for the future +20081221 get rid of designated initializers (-pedantic) for ISO-C++ +20080509 very long strings in input may cause problems :) +20070812 examine fbi's weak points like http://freshmeat.net/articles/view/2203/ and fix them in Fim, if present. + +------------------------------------------------------------------------------- +Minor but not easy (time consuming) features: + +20110516 shall enable building with SDL only, without using Unix syscalls. +20081227 http://www-masu.ist.osaka-u.ac.jp/~kakugawa/TeX-Guy/ for dvi support +20080908 pdflib would be a nice try to view pdf files from within fim, but multiple anonymous images should be supported + +------------------------------------------------------------------------------- +Optimization related ideas: + +20090213 rewrite the core in a way to avoid convert_line: there is a potentially big performance gain +20080826 refine and optimize the rotation mechanism into a smarter, smoother, rendering based one +20090108 write some multi-mode optimizing blitting code generating m4 macro + +------------------------------------------------------------------------------- +Documentation related ideas: + +20071230 UNIX domain sockets communication and multithreaded Fim +20071230 A decent Features section in the web site, from the top. +20071127 in-depth study of Vim documentation to uniform languages as much as possible +20071127 prepare a cookbook +20071127 inspiration : # vim +':help eval' + + +------------------------------------------------------------------------------- +Language related ideas: + +20080502 find a syntactical solution for ;; handling (extra semicolons) in the parser +20080223 fine grain the grammar using whitespaces too +20080216 add a third optional argument to bind : a description +20071127 possible namespaces : + w:... window variables + g:... global variables + l:... local variables + s:... script variables + t:... tab variables + v:... vim variables +20071127 functions, return status, stdout, stderr ? +20071025 introduce a namespace : 'e:', to get environment variables! +20070921 argument passing to aliases, bash like ?! or vim-like ? +20070920 as much as possible of Vim's language intuitive syntax + +------------------------------------------------------------------------------- +Debug related ideas: + +20080414 follow -Weffc++ g++ flag guidelines, and -Werror +20080414 instead of malloc() to use calloc() and MALLOC_PERTURB, M_PERTURB on mallopt() +20080414 use mtrace() sometimes, MALLOC_TRACE=mout +20080414 use the dmalloc library (DMALLOC_OPTIONS), ElectricFence, +20080414 use valgrind +20080414 use mudflap library +20080414 compile with -D_GLIBCXX_DEBUG for having a bug-aware C++ standard library +20080414 experiment with libsegfault, +20080414 use lint from time to time +20080414 to add scripts to check for memory leaks and related bugs and build problems, + in a way contributors could run cron scripts with svn export / build capabilities + +------------------------------------------------------------------------------- +Debian oriented stuff: + +20090226 debianize: + dpkg-buildpackage -rfakeroot -k0x0xE0E669C80xE0E669C8EF1258B8 + fakeroot debian/rules binary + http://www.debian.org/doc/debian-policy/ + http://www.debian.org/doc/maint-guide/ch-build.en.html + http://pbuilder.alioth.debian.org/#IRCchannel + http://www.ibm.com/developerworks/linux/library/l-debpkg.html + http://www.debian-administration.org/articles/488 + http://www.debian-administration.org/articles/337 + debuild -us -uc + http://people.debian.org/~codehelp/#sponsor + http://dl.bytesex.org/releases/fbida/ida_0.21.dsc +20090223 dput, dupload, svn-autoreleasedeb, devscripts, debsecan + + +------------------------------------------------------------------------------- +Optimization: + +20070418 Got ~400% speedup on image display thanks to trivial changes in + the drawing code : memset and memcpy instead of assignations, and a less + trivial change by swapping RGB channels on loading time instead that on + drawing time. The analysis was made with the gprof profiler, nicely. + +Maybe one day me or some contributor will read + http://www.cvl.isy.liu.se/ScOut/Publications/PaperInfo/sf05.html + or +Example 4.14 of the Intel Architecture SW Manual Optimization explains how to +and find some useful idea. +use PSHUFLW,PSHUFW,PSHUFD to reverse contiguous words in registers. + +------------------------------------------------------------------------------- + +This file is often outdated : Fim is far better than it seems here :) + +Please read the FIM.TXT file and the fimrc template to discover nice Fim features. + + OPEN BUGS: + +20080323 65535 byte limit for a script size (stored in a fim::string) causes problems + ( see scripts/tests/maxlenscript.fim for this ) +20070210 fix properly the file parser and max script filelength limit +20070129 control 4 crashes the prog with code 42 ... why ? :) + + MISSING SMALL FIXES: +20070303 fix rar and zip dependencies in Makefiles and such for fimgs.sh +20070303 see if while-nesting is a real danger combined with interruption handling +20070303 update the while construct documentation and fix the while command execution bugs +20070303 add an interface for setting exitBinding (now Enter!) +20070210 add an interface to modify key bindings and keycode bindings. +20070401 variables : $VARNAME or $(VARNAME) or VARNAME ? + + SCIENCE FICTION WISHED ADD-ONS: +20070307 someday: to integrate with a speech recognizer for command issuing +20070323 image understanding language - based pattern selection +20070401 ?= /semanticexp/ operator + + ADD: +20070401 find's -exec '{}' ';' -like predicate syntax +20070125 add pipe to other commands and exec and system (screenshot with fbgrab, for example) +20070128 add support for command renaming with checks... +20070130 proper signal handing for while cycle interruption.. +20070201 cwd,ls,pwd,stat,file... + + MISC IDEAS : +20070303 + load cfg, save cfg + flip=yes|no + scale=i|i:i|:i|i:| + fit =width|height|none|image|min|max + center=t|b|l|r|tl|tr|bl|br|center + orientation=90|... [cw|ccw] | flip + mirror=yes|no + persistent_options= word*|'*' + transient_options = word* + logfile=... + debugfile=.. + cwd=word + negative=.. + interpolator=.. + options_style=stacked|trasient|permanent_save + function : + [n]%[r|l] + +|-n[%] +20070401 better variable handling : boolean variables, conversion, 'no' prefixing, + completion fitting the language rules.. + + DATES: +20061223 inception +20070202 stress testing (1000+d-) gave : CommandConsole.cpp:577: "pipe error" +20070204 make stricter the policy of recording (only aliases and/or lines.complete the time behaviour + IDEAS +20070210 eliminate the fresh variable from the config? +20070216 eliminate image tearing by studying the framebuffer device + repeat_last N ?! + TIPS +20070302 use __FUNCTION__ : is not ANSI, but GCC + diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..15b7cd8 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.5-rc3 diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000..6371de7 --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,1171 @@ +# generated automatically by aclocal 1.11.6 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, +# Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, +[m4_warning([this file was generated for autoconf 2.69. +You have another version of autoconf. It may work, but is not guaranteed to. +If you have problems, you may need to regenerate the build system entirely. +To do so, use the procedure documented by the package, typically `autoreconf'.])]) + +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 1 (pkg-config-0.24) +# +# Copyright © 2004 Scott James Remnant . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi +fi[]dnl +])# PKG_PROG_PKG_CONFIG + +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# +# Check to see whether a particular set of modules exists. Similar +# to PKG_CHECK_MODULES(), but does not set variables or print errors. +# +# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +# only at the first occurence in configure.ac, so if the first place +# it's called might be skipped (such as if it is within an "if", you +# have to call PKG_CHECK_EXISTS manually +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_default([$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test -n "$$1"; then + pkg_cv_[]$1="$$1" + elif test -n "$PKG_CONFIG"; then + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes ], + [pkg_failed=yes]) + else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG + +# _PKG_SHORT_ERRORS_SUPPORTED +# ----------------------------- +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])# _PKG_SHORT_ERRORS_SUPPORTED + + +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +# +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + AC_MSG_RESULT([no]) + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + m4_default([$4], [AC_MSG_ERROR( +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT])[]dnl + ]) +elif test $pkg_failed = untried; then + AC_MSG_RESULT([no]) + m4_default([$4], [AC_MSG_FAILURE( +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see .])[]dnl + ]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + $3 +fi[]dnl +])# PKG_CHECK_MODULES + +# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software +# Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 1 + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +# (This private macro should not be called outside this file.) +AC_DEFUN([AM_AUTOMAKE_VERSION], +[am__api_version='1.11' +dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to +dnl require some minimum version. Point them to the right macro. +m4_if([$1], [1.11.6], [], + [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl +]) + +# _AM_AUTOCONF_VERSION(VERSION) +# ----------------------------- +# aclocal traces this macro to find the Autoconf version. +# This is a private macro too. Using m4_define simplifies +# the logic in aclocal, which can simply ignore this definition. +m4_define([_AM_AUTOCONF_VERSION], []) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. +# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], +[AM_AUTOMAKE_VERSION([1.11.6])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 1 + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[dnl Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50])dnl +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 9 + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ(2.52)dnl + ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE])dnl +AC_SUBST([$1_FALSE])dnl +_AM_SUBST_NOTMAKE([$1_TRUE])dnl +_AM_SUBST_NOTMAKE([$1_FALSE])dnl +m4_define([_AM_COND_VALUE_$1], [$2])dnl +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, +# 2010, 2011 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 12 + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "GCJ", or "OBJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], UPC, [depcc="$UPC" am_compiler_list=], + [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + am__universal=false + m4_case([$1], [CC], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac], + [CXX], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac]) + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok `-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE(dependency-tracking, +[ --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH])dnl +_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl +AC_SUBST([am__nodep])dnl +_AM_SUBST_NOTMAKE([am__nodep])dnl +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +#serial 5 + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[{ + # Autoconf 2.62 quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + case $CONFIG_FILES in + *\'*) eval set x "$CONFIG_FILES" ;; + *) set x $CONFIG_FILES ;; + esac + shift + for mf + do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done + done +} +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each `.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2008, 2009 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 16 + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.62])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl +dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. +m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, + [m4_fatal([AC_INIT should be called with package and version arguments])])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) +AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl +AC_REQUIRE([AM_PROG_MKDIR_P])dnl +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJC], + [_AM_DEPENDENCIES(OBJC)], + [define([AC_PROG_OBJC], + defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl +]) +_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl +dnl The `parallel-tests' driver may need to know about EXEEXT, so add the +dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro +dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. +AC_CONFIG_COMMANDS_PRE(dnl +[m4_provide_if([_AM_COMPILER_EXEEXT], + [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl +]) + +dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not +dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further +dnl mangled by Autoconf and run in a shell conditional statement. +m4_define([_AC_COMPILER_EXEEXT], +m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) + + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_arg=$1 +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation, +# Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 1 + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +if test x"${install_sh}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi +AC_SUBST(install_sh)]) + +# Copyright (C) 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Add --enable-maintainer-mode option to configure. -*- Autoconf -*- +# From Jim Meyering + +# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008, +# 2011 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 5 + +# AM_MAINTAINER_MODE([DEFAULT-MODE]) +# ---------------------------------- +# Control maintainer-specific portions of Makefiles. +# Default is to disable them, unless `enable' is passed literally. +# For symmetry, `disable' may be passed as well. Anyway, the user +# can override the default with the --enable/--disable switch. +AC_DEFUN([AM_MAINTAINER_MODE], +[m4_case(m4_default([$1], [disable]), + [enable], [m4_define([am_maintainer_other], [disable])], + [disable], [m4_define([am_maintainer_other], [enable])], + [m4_define([am_maintainer_other], [enable]) + m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) +AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode's default is 'disable' unless 'enable' is passed + AC_ARG_ENABLE([maintainer-mode], +[ --][am_maintainer_other][-maintainer-mode am_maintainer_other make rules and dependencies not useful + (and sometimes confusing) to the casual installer], + [USE_MAINTAINER_MODE=$enableval], + [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) + AC_MSG_RESULT([$USE_MAINTAINER_MODE]) + AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) + MAINT=$MAINTAINER_MODE_TRUE + AC_SUBST([MAINT])dnl +] +) + +AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo this is the am__doit target +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# Ignore all kinds of additional output from `make'. +case `$am_make -s -f confmf 2> /dev/null` in #( +*the\ am__doit\ target*) + am__include=include + am__quote= + _am_result=GNU + ;; +esac +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + case `$am_make -s -f confmf 2> /dev/null` in #( + *the\ am__doit\ target*) + am__include=.include + am__quote="\"" + _am_result=BSD + ;; + esac +fi +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) +rm -f confinc confmf +]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 6 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([missing])dnl +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation, +# Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 1 + +# AM_PROG_MKDIR_P +# --------------- +# Check for `mkdir -p'. +AC_DEFUN([AM_PROG_MKDIR_P], +[AC_PREREQ([2.60])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, +dnl while keeping a definition of mkdir_p for backward compatibility. +dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. +dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of +dnl Makefile.ins that do not define MKDIR_P, so we do our own +dnl adjustment using top_builddir (which is defined more often than +dnl MKDIR_P). +AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl +case $mkdir_p in + [[\\/$]]* | ?:[[\\/]]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac +]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software +# Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 5 + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# -------------------- +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) + +# _AM_SET_OPTIONS(OPTIONS) +# ------------------------ +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 5 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[[\\\"\#\$\&\'\`$am_lf]]*) + AC_MSG_ERROR([unsafe absolute working directory name]);; +esac +case $srcdir in + *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) + AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; +esac + +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT(yes)]) + +# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 1 + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor `install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in `make install-strip', and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 3 + +# _AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. +# This macro is traced by Automake. +AC_DEFUN([_AM_SUBST_NOTMAKE]) + +# AM_SUBST_NOTMAKE(VARIABLE) +# -------------------------- +# Public sister of _AM_SUBST_NOTMAKE. +AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of `v7', `ustar', or `pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AC_SUBST([AMTAR], ['$${TAR-tar}']) +m4_if([$1], [v7], + [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi +done +rm -rf conftest.dir + +AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) +AC_MSG_RESULT([$am_cv_prog_tar_$1])]) +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..8b616eb --- /dev/null +++ b/autogen.sh @@ -0,0 +1,26 @@ +#!/bin/sh +# $LastChangedDate: 2011-05-23 14:51:20 +0200 (Mon, 23 May 2011) $ + +# This file is still not complete. + +# this should create configure.scan + +aclocal || { echo "no aclocal ?" ; exit 1 ; } + +#autoscan + +# we produce suitable config.h.in +autoheader + +# we produce a configure script +autoconf || { echo "no autoconf ?" ; exit 1 ; } + +# we produce a brand new Makefile +automake --add-missing || { echo "no automake ?" ; exit 1 ; } + +# The automake required for autogen.sh'in this package is 1.10. +# So users who want to build from the svn repository are required to use this version. +# +# Users building from the tarball shouldn't bother, of course, +# because they get the configure script generated from the tarball maintainer. + diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000..8b89614 --- /dev/null +++ b/config.h.in @@ -0,0 +1,576 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define if building universal (internal helper macro) */ +#undef AC_APPLE_UNIVERSAL_BUILD + +/* custom CXXFLAGS */ +#undef CXXFLAGS + +/* Enable pdf support. */ +#undef ENABLE_PDF + +/* program to use for shell commands */ +#undef EXECSHELL + +/* */ +#undef FBI_AUTHOR + +/* */ +#undef FBI_AUTHOR_NAME + +/* Allows the user to specify a file loader */ +#undef FIM_ALLOW_LOADER_STRING_SPECIFICATION + +/* */ +#undef FIM_AUTHOR + +/* */ +#undef FIM_AUTHOR_EMAIL + +/* */ +#undef FIM_AUTHOR_NAME + +/* */ +#undef FIM_AUTOCMDS + +/* */ +#undef FIM_AUTOSKIP_FAILED + +/* */ +#undef FIM_BIG_ENDIAN + +/* */ +#undef FIM_BOZ_PATCH + +/* */ +#undef FIM_BUGGED_CACHE + +/* */ +#undef FIM_CACHE_DEBUG + +/* */ +#undef FIM_CHECK_DUPLICATES + +/* */ +#undef FIM_CHECK_FILE_EXISTENCE + +/* */ +#undef FIM_COMMAND_AUTOCOMPLETION + +/* */ +#undef FIM_CONFIGURATION + +/* */ +#undef FIM_DEFAULT_CONFIG + +/* */ +#undef FIM_DEFAULT_CONFIGURATION + +/* */ +#undef FIM_DEFAULT_CONSOLEFONT + +/* */ +#undef FIM_DEFAULT_KEY_CONFIG + +/* */ +#undef FIM_EXPERIMENTAL_ROTATION + +/* */ +#undef FIM_HANDLE_GIF + +/* */ +#undef FIM_HANDLE_TIFF + +/* */ +#undef FIM_ITERATED_COMMANDS + +/* */ +#undef FIM_KEEP_BROKEN_CONSOLE + +/* */ +#undef FIM_LINUX_CONSOLEFONTS_DIR_SCAN + +/* */ +#undef FIM_NAMESPACES + +/* */ +#undef FIM_NOFB + +/* */ +#undef FIM_NOFIMRC + +/* */ +#undef FIM_NOHISTORY + +/* */ +#undef FIM_PIPE_IMAGE_READ + +/* */ +#undef FIM_RANDOM + +/* */ +#undef FIM_READ_DIRS + +/* */ +#undef FIM_READ_STDIN + +/* */ +#undef FIM_READ_STDIN_IMAGE + +/* */ +#undef FIM_RECORDING + +/* */ +#undef FIM_RECURSIVE_DIRS + +/* */ +#undef FIM_REMOVE_FAILED + +/* */ +#undef FIM_SKIP_KNOWN_FILETYPES + +/* */ +#undef FIM_SMART_COMPLETION + +/* */ +#undef FIM_SWITCH_FIXUP + +/* */ +#undef FIM_TMP_FILENAME + +/* */ +#undef FIM_TRY_CONVERT + +/* */ +#undef FIM_TRY_DIA + +/* */ +#undef FIM_TRY_INKSCAPE + +/* */ +#undef FIM_TRY_XCFTOPNM + +/* */ +#undef FIM_TRY_XFIG + +/* */ +#undef FIM_USE_CXX11 + +/* */ +#undef FIM_USE_DESIGNATED_INITIALIZERS + +/* */ +#undef FIM_USE_READLINE + +/* */ +#undef FIM_USE_ZCAT + +/* */ +#undef FIM_VERSION + +/* */ +#undef FIM_WANTS_SLOW_RESIZE + +/* */ +#undef FIM_WANT_CUSTOM_INFO_STATUS_BAR + +/* If defined, exiftool will be used to get additional file information + (EXPERIMENTAL). */ +#undef FIM_WANT_EXIFTOOL + +/* Fim will be capable of marking files while viewing and outputting their + names on exit. */ +#undef FIM_WANT_FILENAME_MARK_AND_DUMP + +/* Enable a hardcoded font in the executable. */ +#undef FIM_WANT_HARDCODED_FONT + +/* Internals shall use 64 bit integers (EXPERIMENTAL). */ +#undef FIM_WANT_LONG_INT + +/* Scripting. (enabled by default) */ +#undef FIM_WANT_NOSCRIPTING + +/* Output console. (enabled by default) */ +#undef FIM_WANT_NO_OUTPUT_CONSOLE + +/* Enables raw bits rendering */ +#undef FIM_WANT_RAW_BITS_RENDERING + +/* */ +#undef FIM_WANT_SEEK_MAGIC + +/* */ +#undef FIM_WANT_STATIC_BINARY + +/* Enables text rendering */ +#undef FIM_WANT_TEXT_RENDERING + +/* Check for freetype library, with no feature behind: do not use this. + (disabled by default) */ +#undef FIM_WANT_UNICODE + +/* Fim windowing support */ +#undef FIM_WINDOWS + +/* */ +#undef FIM_WITH_AALIB + +/* Defined, if (EXPERIMENTAL, UNFINISHED) libarchive support is enabled */ +#undef FIM_WITH_ARCHIVE + +/* BMP file support. */ +#undef FIM_WITH_BMP + +/* */ +#undef FIM_WITH_CACALIB + +/* */ +#undef FIM_WITH_LIBEXIF + +/* We have libImlib */ +#undef FIM_WITH_LIBIMLIB2 + +/* */ +#undef FIM_WITH_LIBJASPER + +/* Defined, if libpng support is enabled */ +#undef FIM_WITH_LIBPNG + +/* Defined, if libsdl support is enabled */ +#undef FIM_WITH_LIBSDL + +/* Defined if sample bogus 'xyz' loader support is enabled. */ +#undef FIM_WITH_LIBXYZ + +/* Defined when framebuffer device support is turned off. */ +#undef FIM_WITH_NO_FRAMEBUFFER + +/* PCX file support. */ +#undef FIM_WITH_PCX + +/* Defined, if UFRaw support is enabled */ +#undef FIM_WITH_UFRAW + +/* Define to 1 if you have the `bcmp' function. */ +#undef HAVE_BCMP + +/* Define to 1 if you have the `bcopy' function. */ +#undef HAVE_BCOPY + +/* Define to 1 if you have the `bzero' function. */ +#undef HAVE_BZERO + +/* Define to 1 if you have the header file. */ +#undef HAVE_CLIMITS + +/* Define to 1 if you have the header file. */ +#undef HAVE_CSTDIO + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#undef HAVE_DIRENT_H + +/* Define to 1 if you have the `drand48' function. */ +#undef HAVE_DRAND48 + +/* If present, fgetln() will be used as a replacement for getline(). (on BSD) + */ +#undef HAVE_FGETLN + +/* Define to 1 if you have the `fileno' function. */ +#undef HAVE_FILENO + +/* Define to 1 if you have the `fmemopen' function. */ +#undef HAVE_FMEMOPEN + +/* Define to 1 if you have the header file. */ +#undef HAVE_FONTCONFIG_FCFREETYPE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_FONTCONFIG_FONTCONFIG_H + +/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ +#undef HAVE_FSEEKO + +/* If present, the getenv function allows fim to read environment variables. + */ +#undef HAVE_GETENV + +/* If present, will be used for stdin reading. (on GNU) */ +#undef HAVE_GETLINE + +/* Define to 1 if you have the `getpagesize' function. */ +#undef HAVE_GETPAGESIZE + +/* Should live when _GNU_SOURCE, but it could be not the case. */ +#undef HAVE_GET_CURRENT_DIR_NAME + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_IOCTL_H + +/* Define to 1 if you have the `curses' library (-lcurses). */ +#undef HAVE_LIBCURSES + +/* We have libdjvulibre */ +#undef HAVE_LIBDJVU + +/* Define to 1 if you have the `fl' library (-lfl). */ +#undef HAVE_LIBFL + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBGEN_H + +/* We have libGraphicsMagick */ +#undef HAVE_LIBGRAPHICSMAGICK + +/* We have libjpeg */ +#undef HAVE_LIBJPEG + +/* Define to 1 if you have the `m' library (-lm). */ +#undef HAVE_LIBM + +/* Define to 1 if you have the `ncurses' library (-lncurses). */ +#undef HAVE_LIBNCURSES + +/* We have libpoppler (Warning: the API could still break! (as of + v.0.8.7--0.24.1)) */ +#undef HAVE_LIBPOPPLER + +/* We have libspectre */ +#undef HAVE_LIBSPECTRE + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIMITS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_FB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_KD_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_VT_H + +/* */ +#undef HAVE_MATRIX_MARKET_DECODER + +/* Define to 1 if you have the `memcmp' function. */ +#undef HAVE_MEMCMP + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the `memset' function. */ +#undef HAVE_MEMSET + +/* Define to 1 if you have a working `mmap' system call. */ +#undef HAVE_MMAP + +/* Define to 1 if you have the header file, and it defines `DIR'. */ +#undef HAVE_NDIR_H + +/* Define to 1 if you have the `rand' function. */ +#undef HAVE_RAND + +/* Define to 1 if you have the `random' function. */ +#undef HAVE_RANDOM + +/* Define to 1 if you have the `regcomp' function. */ +#undef HAVE_REGCOMP + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDARG_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDIO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the `strcpy' function. */ +#undef HAVE_STRCPY + +/* Define to 1 if you have the `strerror' function. */ +#undef HAVE_STRERROR + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the `strncmp' function. */ +#undef HAVE_STRNCMP + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYSEXITS_H + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#undef HAVE_SYS_DIR_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_IOCTL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_MMAN_H + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#undef HAVE_SYS_NDIR_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_RESOURCE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_USER_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNIX_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_WCHAR_H + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define as the return type of signal handlers (`int' or `void'). */ +#undef RETSIGTYPE + +/* The size of `int', as computed by sizeof. */ +#undef SIZEOF_INT + +/* The size of `int *', as computed by sizeof. */ +#undef SIZEOF_INT_P + +/* The size of `off_t', as computed by sizeof. */ +#undef SIZEOF_OFF_T + +/* The size of `size_t', as computed by sizeof. */ +#undef SIZEOF_SIZE_T + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* SVN REVISION */ +#undef SVN_REVISION + +/* SVN REVISION NUMBER */ +#undef SVN_REVISION_NUMBER + +/* Define if you want to use the included (GNU) regex.c. */ +#undef USE_GNU_REGEX + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# undef _POSIX_PTHREAD_SEMANTICS +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# undef _TANDEM_SOURCE +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif + + +/* Version number of package */ +#undef VERSION + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +# undef WORDS_BIGENDIAN +# endif +#endif + +/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a + `char[]'. */ +#undef YYTEXT_POINTER + +/* Enable large inode numbers on Mac OS X 10.5. */ +#ifndef _DARWIN_USE_64_BIT_INODE +# define _DARWIN_USE_64_BIT_INODE 1 +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +#undef _FILE_OFFSET_BITS + +/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ +#undef _LARGEFILE_SOURCE + +/* Define for large files, on AIX-style hosts. */ +#undef _LARGE_FILES + +/* Define to 1 if on MINIX. */ +#undef _MINIX + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +#undef _POSIX_1_SOURCE + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +#undef _POSIX_SOURCE + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif diff --git a/configure b/configure new file mode 100755 index 0000000..e64c931 --- /dev/null +++ b/configure @@ -0,0 +1,14017 @@ +#! /bin/sh +# From configure.ac Revision. +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.69 for fim 0.5-rc3. +# +# Report bugs to . +# +# +# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1 +test -x / || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org and +$0: dezperado_FOobAr_autistici_Baz_org, by replacing +$0: _FOobAr_ with a @ and _Baz_ with a . about your system, +$0: including any error possibly output before this +$0: message. Then install a modern shell, or manually run +$0: the script under such a shell if you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='fim' +PACKAGE_TARNAME='fim' +PACKAGE_VERSION='0.5-rc3' +PACKAGE_STRING='fim 0.5-rc3' +PACKAGE_BUGREPORT='dezperado_FOobAr_autistici_Baz_org, by replacing _FOobAr_ with a @ and _Baz_ with a .' +PACKAGE_URL='' + +ac_unique_file="src/fim.cpp" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +ac_header_list= +ac_subst_vars='am__EXEEXT_FALSE +am__EXEEXT_TRUE +LTLIBOBJS +FIM_SVN_REPOSITORY +FIM_DEFS +have_dia +have_xfig +have_inkscape +have_xcftopnm +have_convert +have_zcat +FIM_WANT_CUSTOM_HARDCODED_CONSOLEFONT_FALSE +FIM_WANT_CUSTOM_HARDCODED_CONSOLEFONT_TRUE +FIM_CUSTOM_HARDCODED_CONSOLEFONT +FIM_WANT_HARDCODED_CONSOLEFONT_FALSE +FIM_WANT_HARDCODED_CONSOLEFONT_TRUE +LIBSDL_CONFIG +LIBAA_CONFIG +LIBPNG_CONFIG +ENABLE_PDF_FALSE +ENABLE_PDF_TRUE +POPPLER_LIBS +POPPLER_CFLAGS +PKG_CONFIG_LIBDIR +PKG_CONFIG_PATH +PKG_CONFIG +ENABLE_POPPLER_FALSE +ENABLE_POPPLER_TRUE +LIBPOPPLER +ENABLE_DJVU_FALSE +ENABLE_DJVU_TRUE +LIBDJVU +ENABLE_PS_FALSE +ENABLE_PS_TRUE +LIBPS +ENABLE_JPEG_FALSE +ENABLE_JPEG_TRUE +LIBJPEG +ENABLE_TIFF_FALSE +ENABLE_TIFF_TRUE +LIBTIFF +ENABLE_GIF_FALSE +ENABLE_GIF_TRUE +LIBGIF +fim_cv_version +LIBOBJS +CXXCPP +MAN +CAT +SORT +ECHO +SED +RM +HAVE_MAN +HAVE_CAT +HAVE_AWK +HAVE_CPP +HAVE_SORT +HAVE_GREP +HAVE_SED +HAVE_RM +HAVE_ECHO +HAVE_BISON +HAVE_FLEX +MAINT +MAINTAINER_MODE_FALSE +MAINTAINER_MODE_TRUE +FIM_LIB_OBJECTS +FIM_LIBS +CONFIG_STATUS_DEPENDENCIES +am__fastdepCXX_FALSE +am__fastdepCXX_TRUE +CXXDEPMODE +am__fastdepCC_FALSE +am__fastdepCC_TRUE +CCDEPMODE +am__nodep +AMDEPBACKSLASH +AMDEP_FALSE +AMDEP_TRUE +am__quote +am__include +DEPDIR +am__untar +am__tar +AMTAR +am__leading_dot +SET_MAKE +AWK +mkdir_p +MKDIR_P +INSTALL_STRIP_PROGRAM +STRIP +install_sh +MAKEINFO +AUTOHEADER +AUTOMAKE +AUTOCONF +ACLOCAL +VERSION +PACKAGE +CYGPATH_W +am__isrc +AR +ac_ct_CXX +CXXFLAGS +CXX +RANLIB +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +LEXLIB +LEX_OUTPUT_ROOT +LEX +YFLAGS +YACC +EGREP +GREP +CPP +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +FIM_CONFIGURATION +SVN_REVISION_NUMBER +SVN_REVISION +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_dependency_tracking +enable_largefile +enable_maintainer_mode +enable_graphicsmagick +enable_imlib2 +enable_default_bindings +enable_default_mapping +enable_default_config +enable_system +enable_framebuffer +enable_static +with_regex +enable_gif +enable_tiff +enable_cxx11 +enable_readline +enable_jpeg +enable_ps +enable_djvu +enable_poppler +enable_pdf +enable_bmp +enable_pcx +with_png_prefix +enable_png +enable_xyz +enable_ufraw +enable_archive +enable_exif +enable_jasper +enable_aa +with_sdl_prefix +enable_sdl +enable_exiftool +enable_autocommands +enable_hardcoded_font +enable_long_int_vars +enable_windows +enable_fimrc +enable_history +enable_screen +enable_resize_optimizations +enable_stdin_image_reading +enable_scan_consolefonts +enable_seek_magic +enable_pushdir +enable_recursive_pushdir +enable_debug +enable_warnings +enable_cacalib +with_cflags +with_exec_shell +enable_convert +enable_xcftopnm +enable_inkscape +enable_xfig +enable_dia +with_default_consolefont +with_custom_hardcoded_consolefont +with_tmpfile +enable_custom_status_bar +enable_optimizations +enable_mark_and_dump +enable_scripting +enable_output_console +enable_unicode +enable_as_text_rendering +enable_raw_bits_rendering +enable_loader_string_specification +enable_matrices_rendering +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP +YACC +YFLAGS +CXX +CXXFLAGS +CCC +CXXCPP +PKG_CONFIG +PKG_CONFIG_PATH +PKG_CONFIG_LIBDIR +POPPLER_CFLAGS +POPPLER_LIBS' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures fim 0.5-rc3 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/fim] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of fim 0.5-rc3:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors + --disable-largefile omit support for large files + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer + --enable-graphicsmagick Enable GraphicsMagick library support + (EXPERIMENTAL). + --enable-imlib2 Enable Imlib2 library support + (EXPERIMENTAL,INCOMPLETE). + --disable-default-bindings + Builtin default minimal key binding + --disable-default-mapping + Builtin default minimal key mapping + --disable-default-config + Builtin default minimal configuration + --disable-system Disable system() and pipe() calls. + --disable-framebuffer Disable the framebuffer device driver. + --enable-static Want a static binary. (disabled by default) + --disable-gif Disable gif support. + --disable-tiff Disable tiff support. + --enable-cxx11 Enable C++11 standard constructs (requires + appropriate CXXFLAGS, e.g. -std=c++11) + (EXPERIMENTAL). + --disable-readline Disable readline support (EXPERIMENTAL). + --disable-jpeg Disable jpeg support. + --disable-ps Disable ps support. + --disable-djvu Disable djvu support. + --enable-poppler Enable poppler (PDF rendering) support. This will + add LIBPOPPLER_CXXFLAGS="-I/usr/include/poppler/" to + the compilation flags. You can override this by + passing configure a suitable LIBPOPPLER_CXXFLAGS + variable. + --enable-pdf Compile with pdf support + --disable-bmp Disable BMP file support (enabled by default). + --disable-pcx Disable PCX file support (enabled by default). + --disable-png Disable png support. + --enable-xyz Enable the sample bogus 'xyz' file loading support. + This makes only sense in order to learn how to + include a new file format and wish to play with + src/FbiStuffXyz.cpp in the while. + --enable-ufraw Enable UFRaw support (EXPERIMENTAL). + --enable-archive Enable libarchive support (please provide + ARCHIVE_LIBS, ARCHIVE_CXXFLAGS) (EXPERIMENTAL, + UNFINISHED). + --disable-exif JPEG EXIF tags support with libexif. + --enable-jasper Turns on JPEG-2000 files support using JasPer + (EXPERIMENTAL) + --disable-aa Ascii Art (-o aa) support (via aalib) + --disable-sdl Disable libsdl support. + --enable-exiftool Turns on exiftool support (EXPERIMENTAL, shall + provide the EXIFTOOLLINK variable with library or + object files and EXIFTOOLCXXFLAGS) + --disable-autocommands Fim will by default use autocommands. + --enable-hardcoded-font Enable a hardcoded font in the executable (good as a + fallback (FBFONT=fim://) when no PSF format + consolefonts files are available). + --enable-long-int-vars Internals shall use 64 bit integers (EXPERIMENTAL. + --disable-windows Disable windowing system in Fim. (deprecated) + --disable-fimrc Fim will by default load the ~/.fimrc file. + --disable-history Fim will by default load/save a ~/.fim_history file. + --disable-screen Fim will try to work under screen by default (please + read BUGS) + --disable-resize-optimizations + Some old (fbi) code is optimized for speedup in fim. + --disable-stdin-image-reading + Fim will read an image from stdin with the -i + switch. (experimental) + --enable-scan-consolefonts + Fim will scan some predefined directory in look for + console fonts as a fallback. (experimental) + --enable-seek-magic Fim will be capable to seek on a specified magic + string. (experimental) + --enable-pushdir Fim will scan directories for files. + --disable-recursive-pushdir + Fim will be able to push directories recursively + (implies --enable-push-dirs ) + --enable-debug Turns on debug options (recommended for debugging) + --enable-warnings Turns on compiler warnings (recommended, for + debugging) + --enable-cacalib Turns on cacalib support (STILL INCOMPLETE) + --disable-smartautocompletion + Fim will treat as a proper, unescaped string, + nonquoted and nonevaluated strings which happen to + match an existing filename. + --disable-convert Fim will try to use convert (ImageMagick) as a last + resort for opening unknown format files. + --disable-xcftopnm Fim will try to use xcftopnm (Gimp) for opening XCF + format files. + --disable-inkscape Fim will try to use Inkscape for opening SVG format + files. + --disable-xfig Fim will try to use xfig (fig2dev) for opening FIG + format files. + --disable-dia Fim will try to use dia for opening DIA format + files. + --disable-custom-status-bar + Customization of status bar via a printf-like + string. + --enable-optimizations Will try to enhance compilation flags (EXPERIMENTAL) + --enable-mark-and-dump Fim will be capable of marking files while viewing + and outputting their names on exit. (enabled by + default) + --enable-scripting Scripting. (enabled by default) + --enable-output-console Output console. (enabled by default) + --enable-unicode Unicode. (disabled by default) + --disable-as-text-rendering + Disable as-text rendering (viewing of any file as + character bytes -- not to be confused with the ASCII + art output). + --disable-raw-bits-rendering + Disable raw bits rendering (viewing of any file as + either a 1 or 24 bpp bitmap). + --disable-loader-string-specification + Disables the chance to specify a file loader. + --enable-matrices-rendering + Uses librsb for rendering of Matrix Market files + (must have librsb-config in the PATH). + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-regex Use the GNU regex library instead of the POSIX one + --with-png-prefix=PFX prefix where libpng is installed (optional) + --with-sdl-prefix=PFX prefix where libsdl is installed (optional) + --with-cflags=CXXFLAGS Specify a custom CXXFLAGS append value. e.g.: -pg + You cannot call this argument multiple times. In + case you want completely reset CXXFLAGS use : + CXXFLAGS='' ./configure .. Note + that Fim is a C++ program, so we set + CXXFLAGS=CXXFLAGS. + --with-exec-shell=SHELL Specify alternate shell (ONLY if /bin/sh is broken) + --with-default-consolefont=FILE + Specify a default consolefont (psf or psf.gz format) + file. + --with-custom-hardcoded-consolefont=FILE + Specify a custom consolefont to be hardcoded + (uncompressed psf format, absolute path) at build + time (requires --enable-hardcoded-font). + --with-tmpfile=FILE Specify where to put temporary files created when + interacting with external conversion programs + (default is "/tmp/__FIM_TEMPORARY_FILE"). + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + YACC The `Yet Another Compiler Compiler' implementation to use. + Defaults to the first program found out of: `bison -y', `byacc', + `yacc'. + YFLAGS The list of arguments that will be passed by default to $YACC. + This script will default YFLAGS to the empty string to avoid a + default value of `-d' given by some make applications. + CXX C++ compiler command + CXXFLAGS C++ compiler flags + CXXCPP C++ preprocessor + PKG_CONFIG path to pkg-config utility + PKG_CONFIG_PATH + directories to add to pkg-config's search path + PKG_CONFIG_LIBDIR + path overriding pkg-config's built-in search path + POPPLER_CFLAGS + C compiler flags for POPPLER, overriding pkg-config + POPPLER_LIBS + linker flags for POPPLER, overriding pkg-config + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to . +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +fim configure 0.5-rc3 +generated by GNU Autoconf 2.69 + +Copyright (C) 2012 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_c_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if eval \${$3+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} +( $as_echo "## bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ## +## Report this to dezperado_FOobAr_autistici_Baz_org ## +## bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ##" + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_mongrel + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_cxx_try_compile LINENO +# ---------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_compile + +# ac_fn_cxx_try_link LINENO +# ------------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_link + +# ac_fn_cxx_try_run LINENO +# ------------------------ +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_cxx_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_run + +# ac_fn_cxx_compute_int LINENO EXPR VAR INCLUDES +# ---------------------------------------------- +# Tries to find the compile-time value of EXPR in a program that includes +# INCLUDES, setting VAR accordingly. Returns whether the value could be +# computed +ac_fn_cxx_compute_int () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) >= 0)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_lo=0 ac_mid=0 + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) <= $ac_mid)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_hi=$ac_mid; break +else + as_fn_arith $ac_mid + 1 && ac_lo=$as_val + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) < 0)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_hi=-1 ac_mid=-1 + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) >= $ac_mid)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_lo=$ac_mid; break +else + as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + ac_lo= ac_hi= +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) <= $ac_mid)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_hi=$ac_mid +else + as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in #(( +?*) eval "$3=\$ac_lo"; ac_retval=0 ;; +'') ac_retval=1 ;; +esac + else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +static long int longval () { return $2; } +static unsigned long int ulongval () { return $2; } +#include +#include +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if (($2) < 0) + { + long int i = longval (); + if (i != ($2)) + return 1; + fprintf (f, "%ld", i); + } + else + { + unsigned long int i = ulongval (); + if (i != ($2)) + return 1; + fprintf (f, "%lu", i); + } + /* Do not output a trailing newline, as this causes \r\n confusion + on some platforms. */ + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_run "$LINENO"; then : + echo >>conftest.val; read $3 &5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +int +main () +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_cxx_check_func + +# ac_fn_cxx_try_cpp LINENO +# ------------------------ +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_cpp + +# ac_fn_cxx_check_header_mongrel LINENO HEADER VAR INCLUDES +# --------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_cxx_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if eval \${$3+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} +( $as_echo "## bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ## +## Report this to dezperado_FOobAr_autistici_Baz_org ## +## bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ##" + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_cxx_check_header_mongrel + +# ac_fn_cxx_check_header_compile LINENO HEADER VAR INCLUDES +# --------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_cxx_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_cxx_check_header_compile +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by fim $as_me 0.5-rc3, which was +generated by GNU Autoconf 2.69. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + $as_echo "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + $as_echo "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + $as_echo "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + $as_echo "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +$as_echo "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +as_fn_append ac_header_list " stdlib.h" +as_fn_append ac_header_list " unistd.h" +as_fn_append ac_header_list " sys/param.h" +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + +if test x"1415" != x ; then + # The above test gets evaluated when creating the configure script. + +$as_echo "#define SVN_REVISION \"1415\"" >>confdefs.h + + SVN_REVISION="1415" + + +$as_echo "#define SVN_REVISION_NUMBER 1415" >>confdefs.h + + SVN_REVISION_NUMBER=1415 + +fi + + +FIM_CONFIGURATION="$0 $@" + +cat >>confdefs.h <<_ACEOF +#define FIM_CONFIGURATION "$FIM_CONFIGURATION" +_ACEOF + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: + Welcome to the Fim (revision $SVN_REVISION) configure script! + This script will create the right Makefile for building Fim on your system. + But first, it will check if your system has the right configuration for Fim to build. + + There are options to this script, please run : + ./configure --help=short + for a complete list of these options. + + Please read BUGS and README and report any bug found to the Fim maintainer! +" >&5 +$as_echo "$as_me: + Welcome to the Fim (revision $SVN_REVISION) configure script! + This script will create the right Makefile for building Fim on your system. + But first, it will check if your system has the right configuration for Fim to build. + + There are options to this script, please run : + ./configure --help=short + for a complete list of these options. + + Please read BUGS and README and report any bug found to the Fim maintainer! +" >&6;} + + +#AM_CONFIG_HEADER([config.h]) +#AC_CONFIG_SRCDIR(pinentry/pinentry.h) + +# +#AM_INIT_AUTOMAKE($PACKAGE_NAME, $PACKAGE_VERSION) +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if ${ac_cv_objext+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_GREP" || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP" || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" +if test "x$ac_cv_header_minix_config_h" = xyes; then : + MINIX=yes +else + MINIX= +fi + + + if test "$MINIX" = yes; then + +$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h + + +$as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h + + +$as_echo "#define _MINIX 1" >>confdefs.h + + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 +$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } +if ${ac_cv_safe_to_define___extensions__+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +# define __EXTENSIONS__ 1 + $ac_includes_default +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_safe_to_define___extensions__=yes +else + ac_cv_safe_to_define___extensions__=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 +$as_echo "$ac_cv_safe_to_define___extensions__" >&6; } + test $ac_cv_safe_to_define___extensions__ = yes && + $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h + + $as_echo "#define _ALL_SOURCE 1" >>confdefs.h + + $as_echo "#define _GNU_SOURCE 1" >>confdefs.h + + $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h + + $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h + + + +#AC_MANTAINER_MODE +#AC_CANONICAL_HOST + +#missing_dir=`cd $ac_aux_dir && pwd` +#AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) +#AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) +#AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) +#AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) +#AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +for ac_prog in 'bison -y' byacc +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_YACC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$YACC"; then + ac_cv_prog_YACC="$YACC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_YACC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +YACC=$ac_cv_prog_YACC +if test -n "$YACC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $YACC" >&5 +$as_echo "$YACC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$YACC" && break +done +test -n "$YACC" || YACC="yacc" + +for ac_prog in flex lex +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_LEX+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$LEX"; then + ac_cv_prog_LEX="$LEX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_LEX="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +LEX=$ac_cv_prog_LEX +if test -n "$LEX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LEX" >&5 +$as_echo "$LEX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$LEX" && break +done +test -n "$LEX" || LEX=":" + +if test "x$LEX" != "x:"; then + cat >conftest.l <<_ACEOF +%% +a { ECHO; } +b { REJECT; } +c { yymore (); } +d { yyless (1); } +e { /* IRIX 6.5 flex 2.5.4 underquotes its yyless argument. */ + yyless ((input () != 0)); } +f { unput (yytext[0]); } +. { BEGIN INITIAL; } +%% +#ifdef YYTEXT_POINTER +extern char *yytext; +#endif +int +main (void) +{ + return ! yylex () + ! yywrap (); +} +_ACEOF +{ { ac_try="$LEX conftest.l" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$LEX conftest.l") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking lex output file root" >&5 +$as_echo_n "checking lex output file root... " >&6; } +if ${ac_cv_prog_lex_root+:} false; then : + $as_echo_n "(cached) " >&6 +else + +if test -f lex.yy.c; then + ac_cv_prog_lex_root=lex.yy +elif test -f lexyy.c; then + ac_cv_prog_lex_root=lexyy +else + as_fn_error $? "cannot find output from $LEX; giving up" "$LINENO" 5 +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_root" >&5 +$as_echo "$ac_cv_prog_lex_root" >&6; } +LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root + +if test -z "${LEXLIB+set}"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking lex library" >&5 +$as_echo_n "checking lex library... " >&6; } +if ${ac_cv_lib_lex+:} false; then : + $as_echo_n "(cached) " >&6 +else + + ac_save_LIBS=$LIBS + ac_cv_lib_lex='none needed' + for ac_lib in '' -lfl -ll; do + LIBS="$ac_lib $ac_save_LIBS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +`cat $LEX_OUTPUT_ROOT.c` +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_lex=$ac_lib +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + test "$ac_cv_lib_lex" != 'none needed' && break + done + LIBS=$ac_save_LIBS + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lex" >&5 +$as_echo "$ac_cv_lib_lex" >&6; } + test "$ac_cv_lib_lex" != 'none needed' && LEXLIB=$ac_cv_lib_lex +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether yytext is a pointer" >&5 +$as_echo_n "checking whether yytext is a pointer... " >&6; } +if ${ac_cv_prog_lex_yytext_pointer+:} false; then : + $as_echo_n "(cached) " >&6 +else + # POSIX says lex can declare yytext either as a pointer or an array; the +# default is implementation-dependent. Figure out which it is, since +# not all implementations provide the %pointer and %array declarations. +ac_cv_prog_lex_yytext_pointer=no +ac_save_LIBS=$LIBS +LIBS="$LEXLIB $ac_save_LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #define YYTEXT_POINTER 1 +`cat $LEX_OUTPUT_ROOT.c` +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_prog_lex_yytext_pointer=yes +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_save_LIBS + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_yytext_pointer" >&5 +$as_echo "$ac_cv_prog_lex_yytext_pointer" >&6; } +if test $ac_cv_prog_lex_yytext_pointer = yes; then + +$as_echo "#define YYTEXT_POINTER 1" >>confdefs.h + +fi +rm -f conftest.l $LEX_OUTPUT_ROOT.c + +fi + +ac_aux_dir= +for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if ${ac_cv_path_install+:} false; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in #(( + ./ | .// | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + + + + +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -z "$CXX"; then + if test -n "$CCC"; then + CXX=$CCC + else + if test -n "$ac_tool_prefix"; then + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 +$as_echo "$CXX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CXX="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 +$as_echo "$ac_ct_CXX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CXX" && break +done + + if test "x$ac_ct_CXX" = x; then + CXX="g++" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CXX=$ac_ct_CXX + fi +fi + + fi +fi +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 +$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } +if ${ac_cv_cxx_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_cxx_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 +$as_echo "$ac_cv_cxx_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GXX=yes +else + GXX= +fi +ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_save_CXXFLAGS=$CXXFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 +$as_echo_n "checking whether $CXX accepts -g... " >&6; } +if ${ac_cv_prog_cxx_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_cxx_werror_flag=$ac_cxx_werror_flag + ac_cxx_werror_flag=yes + ac_cv_prog_cxx_g=no + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_prog_cxx_g=yes +else + CXXFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + +else + ac_cxx_werror_flag=$ac_save_cxx_werror_flag + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_prog_cxx_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cxx_werror_flag=$ac_save_cxx_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 +$as_echo "$ac_cv_prog_cxx_g" >&6; } +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +#AC_PROG_CXXCPP +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +set dummy ${ac_tool_prefix}ar; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="${ac_tool_prefix}ar" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_AR"; then + ac_ct_AR=$AR + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AR="ar" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +$as_echo "$ac_ct_AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_AR" = x; then + AR="ar" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +else + AR="$ac_cv_prog_AR" +fi + +fim_cv_version=`cat $srcdir/VERSION` +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + +#AC_LANG_PUSH([C++]) +am__api_version='1.11' + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +$as_echo_n "checking whether build environment is sane... " >&6; } +# Just in case +sleep 1 +echo timestamp > conftest.file +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[\\\"\#\$\&\'\`$am_lf]*) + as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; +esac +case $srcdir in + *[\\\"\#\$\&\'\`$am_lf\ \ ]*) + as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; +esac + +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken +alias in your environment" "$LINENO" 5 + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + as_fn_error $? "newly created file is older than distributed files! +Check your system clock" "$LINENO" 5 +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. +# By default was `s,x,x', remove it if useless. +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 +$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +fi + +if test x"${install_sh}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi + +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 +$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } +if test -z "$MKDIR_P"; then + if ${ac_cv_path_mkdir+:} false; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue + case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir (GNU coreutils) '* | \ + 'mkdir (coreutils) '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + break 3;; + esac + done + done + done +IFS=$as_save_IFS + +fi + + test -d ./--version && rmdir ./--version + if test "${ac_cv_path_mkdir+set}" = set; then + MKDIR_P="$ac_cv_path_mkdir -p" + else + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + MKDIR_P="$ac_install_sh -d" + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +$as_echo "$MKDIR_P" >&6; } + +mkdir_p="$MKDIR_P" +case $mkdir_p in + [\\/$]* | ?:[\\/]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AWK+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +$as_echo "$AWK" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo this is the am__doit target +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 +$as_echo_n "checking for style of include used by $am_make... " >&6; } +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# Ignore all kinds of additional output from `make'. +case `$am_make -s -f confmf 2> /dev/null` in #( +*the\ am__doit\ target*) + am__include=include + am__quote= + _am_result=GNU + ;; +esac +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + case `$am_make -s -f confmf 2> /dev/null` in #( + *the\ am__doit\ target*) + am__include=.include + am__quote="\"" + _am_result=BSD + ;; + esac +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 +$as_echo "$_am_result" >&6; } +rm -f confinc confmf + +# Check whether --enable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then : + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + am__isrc=' -I$(srcdir)' + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE='fim' + VERSION='0.5-rc3' + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AMTAR='$${TAR-tar}' + +am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' + + + + +depcc="$CC" am_compiler_list= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if ${am_cv_CC_dependencies_compiler_type+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok `-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + +depcc="$CXX" am_compiler_list= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if ${am_cv_CXX_dependencies_compiler_type+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CXX_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok `-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CXX_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CXX_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } +CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then + am__fastdepCXX_TRUE= + am__fastdepCXX_FALSE='#' +else + am__fastdepCXX_TRUE='#' + am__fastdepCXX_FALSE= +fi + + + +#AM_INIT_AUTOMAKE(fim, $fim_cv_version) +#AM_INIT_AUTOMAKE(fim, 1.0) +CONFIG_STATUS_DEPENDENCIES='$(top_srcdir)/VERSION' + +CPPFLAGS='' + + + + + +#AC_LANG_POP([C++]) + +fim="fim" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for prefix" >&5 +$as_echo_n "checking for prefix... " >&6; } +if test x$prefix = xNONE; then + fim_cv_prefix=$ac_default_prefix +else + fim_cv_prefix=$prefix +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $fim_cv_prefix" >&5 +$as_echo "$fim_cv_prefix" >&6; } + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing strerror" >&5 +$as_echo_n "checking for library containing strerror... " >&6; } +if ${ac_cv_search_strerror+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char strerror (); +int +main () +{ +return strerror (); + ; + return 0; +} +_ACEOF +for ac_lib in '' cposix; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_search_strerror=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_strerror+:} false; then : + break +fi +done +if ${ac_cv_search_strerror+:} false; then : + +else + ac_cv_search_strerror=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_strerror" >&5 +$as_echo "$ac_cv_search_strerror" >&6; } +ac_res=$ac_cv_search_strerror +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + +#AM_C_PROTOTYPES +if test "x$U" != "x"; then + as_fn_error $? "Compiler not ANSI compliant" "$LINENO" 5 +fi +#AC_PROG_CPP +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 +$as_echo_n "checking for inline... " >&6; } +if ${ac_cv_c_inline+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo () {return 0; } +$ac_kw foo_t foo () {return 0; } +#endif + +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_c_inline=$ac_kw +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_inline" != no && break +done + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 +$as_echo "$ac_cv_c_inline" >&6; } + +case $ac_cv_c_inline in + inline | yes) ;; + *) + case $ac_cv_c_inline in + no) ac_val=;; + *) ac_val=$ac_cv_c_inline;; + esac + cat >>confdefs.h <<_ACEOF +#ifndef __cplusplus +#define inline $ac_val +#endif +_ACEOF + ;; +esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 +$as_echo_n "checking for an ANSI C-conforming const... " >&6; } +if ${ac_cv_c_const+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + +#ifndef __cplusplus + /* Ultrix mips cc rejects this sort of thing. */ + typedef int charset[2]; + const charset cs = { 0, 0 }; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *pcpcc; + char **ppc; + /* NEC SVR4.0.2 mips cc rejects this. */ + struct point {int x, y;}; + static struct point const zero = {0,0}; + /* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + pcpcc = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++pcpcc; + ppc = (char**) pcpcc; + pcpcc = (char const *const *) ppc; + { /* SCO 3.2v4 cc rejects this sort of thing. */ + char tx; + char *t = &tx; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + if (s) return 0; + } + { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + } + { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; } bx; + struct s *b = &bx; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + if (!foo) return 0; + } + return !cs[0] && !zero.x; +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_c_const=yes +else + ac_cv_c_const=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 +$as_echo "$ac_cv_c_const" >&6; } +if test $ac_cv_c_const = no; then + +$as_echo "#define const /**/" >>confdefs.h + +fi + + +# Check whether --enable-largefile was given. +if test "${enable_largefile+set}" = set; then : + enableval=$enable_largefile; +fi + +if test "$enable_largefile" != no; then + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 +$as_echo_n "checking for special C compiler options needed for large files... " >&6; } +if ${ac_cv_sys_largefile_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_sys_largefile_CC=no + if test "$GCC" != yes; then + ac_save_CC=$CC + while :; do + # IRIX 6.2 and later do not support large files by default, + # so use the C compiler's -n32 option if that helps. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF + if ac_fn_cxx_try_compile "$LINENO"; then : + break +fi +rm -f core conftest.err conftest.$ac_objext + CC="$CC -n32" + if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_sys_largefile_CC=' -n32'; break +fi +rm -f core conftest.err conftest.$ac_objext + break + done + CC=$ac_save_CC + rm -f conftest.$ac_ext + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 +$as_echo "$ac_cv_sys_largefile_CC" >&6; } + if test "$ac_cv_sys_largefile_CC" != no; then + CC=$CC$ac_cv_sys_largefile_CC + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 +$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } +if ${ac_cv_sys_file_offset_bits+:} false; then : + $as_echo_n "(cached) " >&6 +else + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_sys_file_offset_bits=no; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _FILE_OFFSET_BITS 64 +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_sys_file_offset_bits=64; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_sys_file_offset_bits=unknown + break +done +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 +$as_echo "$ac_cv_sys_file_offset_bits" >&6; } +case $ac_cv_sys_file_offset_bits in #( + no | unknown) ;; + *) +cat >>confdefs.h <<_ACEOF +#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits +_ACEOF +;; +esac +rm -rf conftest* + if test $ac_cv_sys_file_offset_bits = unknown; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 +$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; } +if ${ac_cv_sys_large_files+:} false; then : + $as_echo_n "(cached) " >&6 +else + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_sys_large_files=no; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _LARGE_FILES 1 +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_sys_large_files=1; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_sys_large_files=unknown + break +done +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 +$as_echo "$ac_cv_sys_large_files" >&6; } +case $ac_cv_sys_large_files in #( + no | unknown) ;; + *) +cat >>confdefs.h <<_ACEOF +#define _LARGE_FILES $ac_cv_sys_large_files +_ACEOF +;; +esac +rm -rf conftest* + fi + + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGEFILE_SOURCE value needed for large files" >&5 +$as_echo_n "checking for _LARGEFILE_SOURCE value needed for large files... " >&6; } +if ${ac_cv_sys_largefile_source+:} false; then : + $as_echo_n "(cached) " >&6 +else + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include /* for off_t */ + #include +int +main () +{ +int (*fp) (FILE *, off_t, int) = fseeko; + return fseeko (stdin, 0, 0) && fp (stdin, 0, 0); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_sys_largefile_source=no; break +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _LARGEFILE_SOURCE 1 +#include /* for off_t */ + #include +int +main () +{ +int (*fp) (FILE *, off_t, int) = fseeko; + return fseeko (stdin, 0, 0) && fp (stdin, 0, 0); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_sys_largefile_source=1; break +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + ac_cv_sys_largefile_source=unknown + break +done +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_source" >&5 +$as_echo "$ac_cv_sys_largefile_source" >&6; } +case $ac_cv_sys_largefile_source in #( + no | unknown) ;; + *) +cat >>confdefs.h <<_ACEOF +#define _LARGEFILE_SOURCE $ac_cv_sys_largefile_source +_ACEOF +;; +esac +rm -rf conftest* + +# We used to try defining _XOPEN_SOURCE=500 too, to work around a bug +# in glibc 2.1.3, but that breaks too many other things. +# If you want fseeko and ftello with glibc, upgrade to a fixed glibc. +if test $ac_cv_sys_largefile_source != unknown; then + +$as_echo "#define HAVE_FSEEKO 1" >>confdefs.h + +fi + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of off_t" >&5 +$as_echo_n "checking size of off_t... " >&6; } +if ${ac_cv_sizeof_off_t+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_cxx_compute_int "$LINENO" "(long int) (sizeof (off_t))" "ac_cv_sizeof_off_t" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_off_t" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (off_t) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_off_t=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_off_t" >&5 +$as_echo "$ac_cv_sizeof_off_t" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_OFF_T $ac_cv_sizeof_off_t +_ACEOF + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 +$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } + # Check whether --enable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then : + enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval +else + USE_MAINTAINER_MODE=no +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 +$as_echo "$USE_MAINTAINER_MODE" >&6; } + if test $USE_MAINTAINER_MODE = yes; then + MAINTAINER_MODE_TRUE= + MAINTAINER_MODE_FALSE='#' +else + MAINTAINER_MODE_TRUE='#' + MAINTAINER_MODE_FALSE= +fi + + MAINT=$MAINTAINER_MODE_TRUE + + + + +ac_fn_cxx_check_func "$LINENO" "getenv" "ac_cv_func_getenv" +if test "x$ac_cv_func_getenv" = xyes; then : + +$as_echo "#define HAVE_GETENV 1" >>confdefs.h + +fi + +ac_fn_cxx_check_func "$LINENO" "getline" "ac_cv_func_getline" +if test "x$ac_cv_func_getline" = xyes; then : + +$as_echo "#define HAVE_GETLINE 1" >>confdefs.h + +fi + +ac_fn_cxx_check_func "$LINENO" "fgetln" "ac_cv_func_fgetln" +if test "x$ac_cv_func_fgetln" = xyes; then : + +$as_echo "#define HAVE_FGETLN 1" >>confdefs.h + +fi + +ac_fn_cxx_check_func "$LINENO" "get_current_dir_name" "ac_cv_func_get_current_dir_name" +if test "x$ac_cv_func_get_current_dir_name" = xyes; then : + +$as_echo "#define HAVE_GET_CURRENT_DIR_NAME 1" >>confdefs.h + +fi + +ac_fn_cxx_check_func "$LINENO" "rsb_lib_init" "ac_cv_func_rsb_lib_init" +if test "x$ac_cv_func_rsb_lib_init" = xyes; then : + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pow in -lm" >&5 +$as_echo_n "checking for pow in -lm... " >&6; } +if ${ac_cv_lib_m_pow+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lm $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pow (); +int +main () +{ +return pow (); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_lib_m_pow=yes +else + ac_cv_lib_m_pow=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_pow" >&5 +$as_echo "$ac_cv_lib_m_pow" >&6; } +if test "x$ac_cv_lib_m_pow" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBM 1 +_ACEOF + + LIBS="-lm $LIBS" + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for yylex in -lfl" >&5 +$as_echo_n "checking for yylex in -lfl... " >&6; } +if ${ac_cv_lib_fl_yylex+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lfl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char yylex (); +int +main () +{ +return yylex (); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_lib_fl_yylex=yes +else + ac_cv_lib_fl_yylex=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_fl_yylex" >&5 +$as_echo "$ac_cv_lib_fl_yylex" >&6; } +if test "x$ac_cv_lib_fl_yylex" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBFL 1 +_ACEOF + + LIBS="-lfl $LIBS" + +fi + +# Check whether --enable-graphicsmagick was given. +if test "${enable_graphicsmagick+set}" = set; then : + enableval=$enable_graphicsmagick; if test x$enableval != xno ; then fim_handle_graphicsmagick=yes ; fi +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GetMagickVersion in -lGraphicsMagick" >&5 +$as_echo_n "checking for GetMagickVersion in -lGraphicsMagick... " >&6; } +if ${ac_cv_lib_GraphicsMagick_GetMagickVersion+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lGraphicsMagick $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char GetMagickVersion (); +int +main () +{ +return GetMagickVersion (); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_lib_GraphicsMagick_GetMagickVersion=yes +else + ac_cv_lib_GraphicsMagick_GetMagickVersion=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_GraphicsMagick_GetMagickVersion" >&5 +$as_echo "$ac_cv_lib_GraphicsMagick_GetMagickVersion" >&6; } +if test "x$ac_cv_lib_GraphicsMagick_GetMagickVersion" = xyes; then : + +if test x"$fim_handle_graphicsmagick" = x"yes" ; then + FIM_LIB_OBJECTS="$FIM_LIB_OBJECTS FbiStuffMagick.o"; + LIBS="$LIBS `GraphicsMagick-config --cppflags --ldflags --libs|tr '\n' ' '` "; + CXXFLAGS="$CXXFLAGS `GraphicsMagick-config --cppflags |tr '\n' ' '` "; + +$as_echo "#define HAVE_LIBGRAPHICSMAGICK 1" >>confdefs.h + +fi + +fi + + +# Check whether --enable-imlib2 was given. +if test "${enable_imlib2+set}" = set; then : + enableval=$enable_imlib2; if test x$enableval != xno ; then fim_handle_imlib2=yes ; fi +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for imlib_create_image in -lImlib2" >&5 +$as_echo_n "checking for imlib_create_image in -lImlib2... " >&6; } +if ${ac_cv_lib_Imlib2_imlib_create_image+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lImlib2 $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char imlib_create_image (); +int +main () +{ +return imlib_create_image (); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_lib_Imlib2_imlib_create_image=yes +else + ac_cv_lib_Imlib2_imlib_create_image=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Imlib2_imlib_create_image" >&5 +$as_echo "$ac_cv_lib_Imlib2_imlib_create_image" >&6; } +if test "x$ac_cv_lib_Imlib2_imlib_create_image" = xyes; then : + +if test x"$fim_handle_imlib2" = x"yes" ; then + FIM_LIB_OBJECTS="$FIM_LIB_OBJECTS Imlib2Device.o"; + LIBS="$LIBS `imlib2-config --libs|tr '\n' ' '` "; + CXXFLAGS="$CXXFLAGS `imlib2-config --cflags |tr '\n' ' '` "; + +$as_echo "#define FIM_WITH_LIBIMLIB2 1" >>confdefs.h + +fi + +fi + + +# Extract the first word of "flex", so it can be a program name with args. +set dummy flex; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_HAVE_FLEX+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$HAVE_FLEX"; then + ac_cv_prog_HAVE_FLEX="$HAVE_FLEX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_HAVE_FLEX="yes" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_HAVE_FLEX" && ac_cv_prog_HAVE_FLEX="no" +fi +fi +HAVE_FLEX=$ac_cv_prog_HAVE_FLEX +if test -n "$HAVE_FLEX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_FLEX" >&5 +$as_echo "$HAVE_FLEX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +# Extract the first word of "bison", so it can be a program name with args. +set dummy bison; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_HAVE_BISON+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$HAVE_BISON"; then + ac_cv_prog_HAVE_BISON="$HAVE_BISON" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_HAVE_BISON="yes" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_HAVE_BISON" && ac_cv_prog_HAVE_BISON="no" +fi +fi +HAVE_BISON=$ac_cv_prog_HAVE_BISON +if test -n "$HAVE_BISON"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_BISON" >&5 +$as_echo "$HAVE_BISON" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +if test x$HAVE_FLEX != x"yes" ; then + as_fn_error $? "No flex (lexical analyser generator) executable detected!" "$LINENO" 5 ; +fi +if test x$HAVE_BISON != x"yes" ; then + as_fn_error $? "No bison (parser generator) executable detected!" "$LINENO" 5 ; +fi + +# Extract the first word of "echo", so it can be a program name with args. +set dummy echo; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_HAVE_ECHO+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$HAVE_ECHO"; then + ac_cv_prog_HAVE_ECHO="$HAVE_ECHO" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_HAVE_ECHO="yes" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_HAVE_ECHO" && ac_cv_prog_HAVE_ECHO="no" +fi +fi +HAVE_ECHO=$ac_cv_prog_HAVE_ECHO +if test -n "$HAVE_ECHO"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_ECHO" >&5 +$as_echo "$HAVE_ECHO" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +# Extract the first word of "rm", so it can be a program name with args. +set dummy rm; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_HAVE_RM+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$HAVE_RM"; then + ac_cv_prog_HAVE_RM="$HAVE_RM" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_HAVE_RM="yes" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_HAVE_RM" && ac_cv_prog_HAVE_RM="no" +fi +fi +HAVE_RM=$ac_cv_prog_HAVE_RM +if test -n "$HAVE_RM"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_RM" >&5 +$as_echo "$HAVE_RM" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +# Extract the first word of "sed", so it can be a program name with args. +set dummy sed; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_HAVE_SED+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$HAVE_SED"; then + ac_cv_prog_HAVE_SED="$HAVE_SED" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_HAVE_SED="yes" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_HAVE_SED" && ac_cv_prog_HAVE_SED="no" +fi +fi +HAVE_SED=$ac_cv_prog_HAVE_SED +if test -n "$HAVE_SED"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_SED" >&5 +$as_echo "$HAVE_SED" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +# Extract the first word of "grep", so it can be a program name with args. +set dummy grep; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_HAVE_GREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$HAVE_GREP"; then + ac_cv_prog_HAVE_GREP="$HAVE_GREP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_HAVE_GREP="yes" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_HAVE_GREP" && ac_cv_prog_HAVE_GREP="no" +fi +fi +HAVE_GREP=$ac_cv_prog_HAVE_GREP +if test -n "$HAVE_GREP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_GREP" >&5 +$as_echo "$HAVE_GREP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +# Extract the first word of "sort", so it can be a program name with args. +set dummy sort; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_HAVE_SORT+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$HAVE_SORT"; then + ac_cv_prog_HAVE_SORT="$HAVE_SORT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_HAVE_SORT="yes" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_HAVE_SORT" && ac_cv_prog_HAVE_SORT="no" +fi +fi +HAVE_SORT=$ac_cv_prog_HAVE_SORT +if test -n "$HAVE_SORT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_SORT" >&5 +$as_echo "$HAVE_SORT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +# Extract the first word of "cpp", so it can be a program name with args. +set dummy cpp; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_HAVE_CPP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$HAVE_CPP"; then + ac_cv_prog_HAVE_CPP="$HAVE_CPP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_HAVE_CPP="yes" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_HAVE_CPP" && ac_cv_prog_HAVE_CPP="no" +fi +fi +HAVE_CPP=$ac_cv_prog_HAVE_CPP +if test -n "$HAVE_CPP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_CPP" >&5 +$as_echo "$HAVE_CPP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +# Extract the first word of "awk", so it can be a program name with args. +set dummy awk; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_HAVE_AWK+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$HAVE_AWK"; then + ac_cv_prog_HAVE_AWK="$HAVE_AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_HAVE_AWK="yes" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_HAVE_AWK" && ac_cv_prog_HAVE_AWK="no" +fi +fi +HAVE_AWK=$ac_cv_prog_HAVE_AWK +if test -n "$HAVE_AWK"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_AWK" >&5 +$as_echo "$HAVE_AWK" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +# Extract the first word of "cat", so it can be a program name with args. +set dummy cat; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_HAVE_CAT+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$HAVE_CAT"; then + ac_cv_prog_HAVE_CAT="$HAVE_CAT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_HAVE_CAT="yes" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_HAVE_CAT" && ac_cv_prog_HAVE_CAT="no" +fi +fi +HAVE_CAT=$ac_cv_prog_HAVE_CAT +if test -n "$HAVE_CAT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_CAT" >&5 +$as_echo "$HAVE_CAT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +# Extract the first word of "man", so it can be a program name with args. +set dummy man; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_HAVE_MAN+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$HAVE_MAN"; then + ac_cv_prog_HAVE_MAN="$HAVE_MAN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_HAVE_MAN="yes" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_HAVE_MAN" && ac_cv_prog_HAVE_MAN="no" +fi +fi +HAVE_MAN=$ac_cv_prog_HAVE_MAN +if test -n "$HAVE_MAN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_MAN" >&5 +$as_echo "$HAVE_MAN" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +#AC_CHECK_PROG([HAVE_WHICH],[which],[yes],[no]) +#AC_CHECK_PROG([HAVE_GPG],[gpg],[yes],[no]) +#AC_CHECK_PROG([HAVE_LS],[ls],[yes],[no]) +#AC_CHECK_PROG([HAVE_CD],[cd],[yes],[no]) +#AC_CHECK_PROG([HAVE_CC],[cc],[yes],[no]) +# Extract the first word of "rm", so it can be a program name with args. +set dummy rm; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_RM+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $RM in + [\\/]* | ?:[\\/]*) + ac_cv_path_RM="$RM" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_RM="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_RM" && ac_cv_path_RM="no" + ;; +esac +fi +RM=$ac_cv_path_RM +if test -n "$RM"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RM" >&5 +$as_echo "$RM" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +# Extract the first word of "sed", so it can be a program name with args. +set dummy sed; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_SED+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $SED in + [\\/]* | ?:[\\/]*) + ac_cv_path_SED="$SED" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_SED="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_SED" && ac_cv_path_SED="no" + ;; +esac +fi +SED=$ac_cv_path_SED +if test -n "$SED"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SED" >&5 +$as_echo "$SED" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +# Extract the first word of "grep", so it can be a program name with args. +set dummy grep; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $GREP in + [\\/]* | ?:[\\/]*) + ac_cv_path_GREP="$GREP" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_GREP="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_GREP" && ac_cv_path_GREP="no" + ;; +esac +fi +GREP=$ac_cv_path_GREP +if test -n "$GREP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GREP" >&5 +$as_echo "$GREP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +# Extract the first word of "echo", so it can be a program name with args. +set dummy echo; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ECHO+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $ECHO in + [\\/]* | ?:[\\/]*) + ac_cv_path_ECHO="$ECHO" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ECHO="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_ECHO" && ac_cv_path_ECHO="no" + ;; +esac +fi +ECHO=$ac_cv_path_ECHO +if test -n "$ECHO"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ECHO" >&5 +$as_echo "$ECHO" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +# Extract the first word of "sort", so it can be a program name with args. +set dummy sort; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_SORT+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $SORT in + [\\/]* | ?:[\\/]*) + ac_cv_path_SORT="$SORT" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_SORT="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_SORT" && ac_cv_path_SORT="no" + ;; +esac +fi +SORT=$ac_cv_path_SORT +if test -n "$SORT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SORT" >&5 +$as_echo "$SORT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +# Extract the first word of "cpp", so it can be a program name with args. +set dummy cpp; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_CPP+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $CPP in + [\\/]* | ?:[\\/]*) + ac_cv_path_CPP="$CPP" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_CPP="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_CPP" && ac_cv_path_CPP="no" + ;; +esac +fi +CPP=$ac_cv_path_CPP +if test -n "$CPP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +# Extract the first word of "awk", so it can be a program name with args. +set dummy awk; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_AWK+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $AWK in + [\\/]* | ?:[\\/]*) + ac_cv_path_AWK="$AWK" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_AWK="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_AWK" && ac_cv_path_AWK="no" + ;; +esac +fi +AWK=$ac_cv_path_AWK +if test -n "$AWK"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +$as_echo "$AWK" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +# Extract the first word of "cat", so it can be a program name with args. +set dummy cat; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_CAT+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $CAT in + [\\/]* | ?:[\\/]*) + ac_cv_path_CAT="$CAT" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_CAT="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_CAT" && ac_cv_path_CAT="no" + ;; +esac +fi +CAT=$ac_cv_path_CAT +if test -n "$CAT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CAT" >&5 +$as_echo "$CAT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +# Extract the first word of "man", so it can be a program name with args. +set dummy man; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_MAN+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $MAN in + [\\/]* | ?:[\\/]*) + ac_cv_path_MAN="$MAN" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_MAN="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_MAN" && ac_cv_path_MAN="no" + ;; +esac +fi +MAN=$ac_cv_path_MAN +if test -n "$MAN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAN" >&5 +$as_echo "$MAN" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +#AC_PATH_PROG([CC],[cc],[no]) +#AC_PATH_PROG([WHICH],[which],[no]) +#AC_PATH_PROG([GPG],[gpg],[no]) +#AC_PATH_PROG([LS],[ls],[no]) +#AC_PATH_PROG([CD],[cd],[no]) +# FIXME: what if we have no grep and/or no sed ? +# (echo is often a shell builtin) +have_default_bindings=yes +have_default_mapping=yes +have_default_config=yes + +# Check whether --enable-default_bindings was given. +if test "${enable_default_bindings+set}" = set; then : + enableval=$enable_default_bindings; if test x$enableval = xyes; then + have_default_bindings=yes + else + have_default_bindings=no + fi + +fi + + +# Check whether --enable-default_mapping was given. +if test "${enable_default_mapping+set}" = set; then : + enableval=$enable_default_mapping; if test x$enableval = xyes; then + have_default_mapping=yes + else + have_default_mapping=no + fi + +fi + + +# Check whether --enable-default_config was given. +if test "${enable_default_config+set}" = set; then : + enableval=$enable_default_config; if test x$enableval = xyes; then + have_default_config=yes + else + have_default_config=no + fi + +fi + + + + if test x$have_default_bindings != xno; then + FIM_DEFS="$FIM_DEFS -D FIM_DEFAULT_CONFIG" + $as_echo "#define FIM_DEFAULT_CONFIG 1" >>confdefs.h + + fi + + if test x$have_default_mapping != xno; then + FIM_DEFS="$FIM_DEFS -D FIM_DEFAULT_KEY_CONFIG" + $as_echo "#define FIM_DEFAULT_KEY_CONFIG 1" >>confdefs.h + + fi + + if test x$have_default_config != xno; then + FIM_DEFS="$FIM_DEFS -D FIM_DEFAULT_CONFIGURATION" + $as_echo "#define FIM_DEFAULT_CONFIGURATION 1" >>confdefs.h + + fi + +#CPPFLAGS=$DEPS +#AC_SUBST(LIBSDL_CXXFLAGS) +#AC_SUBST(LIBPNG_CXXFLAGS) +#AC_SUBST(LIBSDL_CXXFLAGS) +#AC_SUBST(LIBPNG_CXXFLAGS) +#AC_SUBST(LIBPNG_LIBS) + +# Check whether --enable-system was given. +if test "${enable_system+set}" = set; then : + enableval=$enable_system; if test x$enableval = xno ; then + fim_system_calls=no + fi + +fi + + +# Check whether --enable-framebuffer was given. +if test "${enable_framebuffer+set}" = set; then : + enableval=$enable_framebuffer; if test x$enableval = xno ; then + fim_handle_framebuffer=no + fi + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: Checking for headers required by the Linux framebuffer device." >&5 +$as_echo "$as_me: Checking for headers required by the Linux framebuffer device." >&6;} +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 +$as_echo_n "checking how to run the C++ preprocessor... " >&6; } +if test -z "$CXXCPP"; then + if ${ac_cv_prog_CXXCPP+:} false; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CXXCPP needs to be expanded + for CXXCPP in "$CXX -E" "/lib/cpp" + do + ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CXXCPP=$CXXCPP + +fi + CXXCPP=$ac_cv_prog_CXXCPP +else + ac_cv_prog_CXXCPP=$CXXCPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 +$as_echo "$CXXCPP" >&6; } +ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + +for ac_header in linux/fb.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "linux/fb.h" "ac_cv_header_linux_fb_h" "$ac_includes_default" +if test "x$ac_cv_header_linux_fb_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LINUX_FB_H 1 +_ACEOF + break +else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find linux/fb.h. Fim Linux framebuffer driver requires it!." >&5 +$as_echo "$as_me: WARNING: Cannot find linux/fb.h. Fim Linux framebuffer driver requires it!." >&2;} +fi + +done + +for ac_header in linux/vt.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "linux/vt.h" "ac_cv_header_linux_vt_h" "$ac_includes_default" +if test "x$ac_cv_header_linux_vt_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LINUX_VT_H 1 +_ACEOF + break +else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find linux/vt.h. Fim Linux framebuffer driver requires it!." >&5 +$as_echo "$as_me: WARNING: Cannot find linux/vt.h. Fim Linux framebuffer driver requires it!." >&2;} +fi + +done + +for ac_header in linux/kd.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "linux/kd.h" "ac_cv_header_linux_kd_h" "$ac_includes_default" +if test "x$ac_cv_header_linux_kd_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LINUX_KD_H 1 +_ACEOF + break +else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find linux/kd.h. Fim Linux framebuffer driver requires it!." >&5 +$as_echo "$as_me: WARNING: Cannot find linux/kd.h. Fim Linux framebuffer driver requires it!." >&2;} +fi + +done + + +if test x$ac_cv_header_linux_fb_h != xyes -o \ + x$ac_cv_header_linux_vt_h != xyes -o \ + x$ac_cv_header_linux_kd_h != xyes ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Turning off Linux framebuffer support due to missing headers" >&5 +$as_echo "$as_me: WARNING: Turning off Linux framebuffer support due to missing headers" >&2;} + fim_handle_framebuffer=no +fi + +if test x$fim_handle_framebuffer = xno ; then + +$as_echo "#define FIM_WITH_NO_FRAMEBUFFER 1" >>confdefs.h + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_cxx_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + + + + + for ac_header in $ac_header_list +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_cxx_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + + + + + +for ac_func in getpagesize +do : + ac_fn_cxx_check_func "$LINENO" "getpagesize" "ac_cv_func_getpagesize" +if test "x$ac_cv_func_getpagesize" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_GETPAGESIZE 1 +_ACEOF + +fi +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working mmap" >&5 +$as_echo_n "checking for working mmap... " >&6; } +if ${ac_cv_func_mmap_fixed_mapped+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ac_cv_func_mmap_fixed_mapped=no +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +/* malloc might have been renamed as rpl_malloc. */ +#undef malloc + +/* Thanks to Mike Haertel and Jim Avera for this test. + Here is a matrix of mmap possibilities: + mmap private not fixed + mmap private fixed at somewhere currently unmapped + mmap private fixed at somewhere already mapped + mmap shared not fixed + mmap shared fixed at somewhere currently unmapped + mmap shared fixed at somewhere already mapped + For private mappings, we should verify that changes cannot be read() + back from the file, nor mmap's back from the file at a different + address. (There have been systems where private was not correctly + implemented like the infamous i386 svr4.0, and systems where the + VM page cache was not coherent with the file system buffer cache + like early versions of FreeBSD and possibly contemporary NetBSD.) + For shared mappings, we should conversely verify that changes get + propagated back to all the places they're supposed to be. + + Grep wants private fixed already mapped. + The main things grep needs to know about mmap are: + * does it exist and is it safe to write into the mmap'd area + * how to use it (BSD variants) */ + +#include +#include + +#if !defined STDC_HEADERS && !defined HAVE_STDLIB_H +char *malloc (); +#endif + +/* This mess was copied from the GNU getpagesize.h. */ +#ifndef HAVE_GETPAGESIZE +# ifdef _SC_PAGESIZE +# define getpagesize() sysconf(_SC_PAGESIZE) +# else /* no _SC_PAGESIZE */ +# ifdef HAVE_SYS_PARAM_H +# include +# ifdef EXEC_PAGESIZE +# define getpagesize() EXEC_PAGESIZE +# else /* no EXEC_PAGESIZE */ +# ifdef NBPG +# define getpagesize() NBPG * CLSIZE +# ifndef CLSIZE +# define CLSIZE 1 +# endif /* no CLSIZE */ +# else /* no NBPG */ +# ifdef NBPC +# define getpagesize() NBPC +# else /* no NBPC */ +# ifdef PAGESIZE +# define getpagesize() PAGESIZE +# endif /* PAGESIZE */ +# endif /* no NBPC */ +# endif /* no NBPG */ +# endif /* no EXEC_PAGESIZE */ +# else /* no HAVE_SYS_PARAM_H */ +# define getpagesize() 8192 /* punt totally */ +# endif /* no HAVE_SYS_PARAM_H */ +# endif /* no _SC_PAGESIZE */ + +#endif /* no HAVE_GETPAGESIZE */ + +int +main () +{ + char *data, *data2, *data3; + const char *cdata2; + int i, pagesize; + int fd, fd2; + + pagesize = getpagesize (); + + /* First, make a file with some known garbage in it. */ + data = (char *) malloc (pagesize); + if (!data) + return 1; + for (i = 0; i < pagesize; ++i) + *(data + i) = rand (); + umask (0); + fd = creat ("conftest.mmap", 0600); + if (fd < 0) + return 2; + if (write (fd, data, pagesize) != pagesize) + return 3; + close (fd); + + /* Next, check that the tail of a page is zero-filled. File must have + non-zero length, otherwise we risk SIGBUS for entire page. */ + fd2 = open ("conftest.txt", O_RDWR | O_CREAT | O_TRUNC, 0600); + if (fd2 < 0) + return 4; + cdata2 = ""; + if (write (fd2, cdata2, 1) != 1) + return 5; + data2 = (char *) mmap (0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd2, 0L); + if (data2 == MAP_FAILED) + return 6; + for (i = 0; i < pagesize; ++i) + if (*(data2 + i)) + return 7; + close (fd2); + if (munmap (data2, pagesize)) + return 8; + + /* Next, try to mmap the file at a fixed address which already has + something else allocated at it. If we can, also make sure that + we see the same garbage. */ + fd = open ("conftest.mmap", O_RDWR); + if (fd < 0) + return 9; + if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_FIXED, fd, 0L)) + return 10; + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data2 + i)) + return 11; + + /* Finally, make sure that changes to the mapped area do not + percolate back to the file as seen by read(). (This is a bug on + some variants of i386 svr4.0.) */ + for (i = 0; i < pagesize; ++i) + *(data2 + i) = *(data2 + i) + 1; + data3 = (char *) malloc (pagesize); + if (!data3) + return 12; + if (read (fd, data3, pagesize) != pagesize) + return 13; + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data3 + i)) + return 14; + close (fd); + return 0; +} +_ACEOF +if ac_fn_cxx_try_run "$LINENO"; then : + ac_cv_func_mmap_fixed_mapped=yes +else + ac_cv_func_mmap_fixed_mapped=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_mmap_fixed_mapped" >&5 +$as_echo "$ac_cv_func_mmap_fixed_mapped" >&6; } +if test $ac_cv_func_mmap_fixed_mapped = yes; then + +$as_echo "#define HAVE_MMAP 1" >>confdefs.h + +fi +rm -f conftest.mmap conftest.txt + + +for ac_func in bzero memset memcmp strncmp strcpy +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +for ac_func in bcopy bcmp +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +for ac_func in drand48 random rand +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +for ac_func in fileno +do : + ac_fn_cxx_check_func "$LINENO" "fileno" "ac_cv_func_fileno" +if test "x$ac_cv_func_fileno" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_FILENO 1 +_ACEOF + +fi +done + +for ac_func in fmemopen +do : + ac_fn_cxx_check_func "$LINENO" "fmemopen" "ac_cv_func_fmemopen" +if test "x$ac_cv_func_fmemopen" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_FMEMOPEN 1 +_ACEOF + +fi +done + + +#AC_CHECK_HEADERS([stddef.h]) +#AC_CHECK_HEADERS([stdlib.h]) +for ac_header in string.h strings.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_cxx_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + for ac_func in strerror +do : + ac_fn_cxx_check_func "$LINENO" "strerror" "ac_cv_func_strerror" +if test "x$ac_cv_func_strerror" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_STRERROR 1 +_ACEOF + +fi +done + +fi + +done + + + +for ac_header in stdint.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "stdint.h" "ac_cv_header_stdint_h" "$ac_includes_default" +if test "x$ac_cv_header_stdint_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_STDINT_H 1 +_ACEOF + +fi + +done + +for ac_header in wchar.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "wchar.h" "ac_cv_header_wchar_h" "$ac_includes_default" +if test "x$ac_cv_header_wchar_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_WCHAR_H 1 +_ACEOF + +fi + +done + +for ac_header in fontconfig/fontconfig.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "fontconfig/fontconfig.h" "ac_cv_header_fontconfig_fontconfig_h" "$ac_includes_default" +if test "x$ac_cv_header_fontconfig_fontconfig_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_FONTCONFIG_FONTCONFIG_H 1 +_ACEOF + +fi + +done + +for ac_header in fontconfig/fcfreetype.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "fontconfig/fcfreetype.h" "ac_cv_header_fontconfig_fcfreetype_h" "$ac_includes_default" +if test "x$ac_cv_header_fontconfig_fcfreetype_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_FONTCONFIG_FCFREETYPE_H 1 +_ACEOF + +fi + +done + + +ac_header_dirent=no +for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do + as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5 +$as_echo_n "checking for $ac_hdr that defines DIR... " >&6; } +if eval \${$as_ac_Header+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include <$ac_hdr> + +int +main () +{ +if ((DIR *) 0) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + eval "$as_ac_Header=yes" +else + eval "$as_ac_Header=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$as_ac_Header + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 +_ACEOF + +ac_header_dirent=$ac_hdr; break +fi + +done +# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. +if test $ac_header_dirent = dirent.h; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 +$as_echo_n "checking for library containing opendir... " >&6; } +if ${ac_cv_search_opendir+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char opendir (); +int +main () +{ +return opendir (); + ; + return 0; +} +_ACEOF +for ac_lib in '' dir; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_search_opendir=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_opendir+:} false; then : + break +fi +done +if ${ac_cv_search_opendir+:} false; then : + +else + ac_cv_search_opendir=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 +$as_echo "$ac_cv_search_opendir" >&6; } +ac_res=$ac_cv_search_opendir +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 +$as_echo_n "checking for library containing opendir... " >&6; } +if ${ac_cv_search_opendir+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char opendir (); +int +main () +{ +return opendir (); + ; + return 0; +} +_ACEOF +for ac_lib in '' x; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_search_opendir=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_opendir+:} false; then : + break +fi +done +if ${ac_cv_search_opendir+:} false; then : + +else + ac_cv_search_opendir=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 +$as_echo "$ac_cv_search_opendir" >&6; } +ac_res=$ac_cv_search_opendir +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + +fi + +for ac_header in stdarg.h sys/ioctl.h ioctl.h sysexits.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_cxx_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +for ac_header in sys/time.h sys/resource.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_cxx_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +for ac_header in unix.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "unix.h" "ac_cv_header_unix_h" "$ac_includes_default" +if test "x$ac_cv_header_unix_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_UNIX_H 1 +_ACEOF + +fi + +done + +for ac_header in libgen.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "libgen.h" "ac_cv_header_libgen_h" "$ac_includes_default" +if test "x$ac_cv_header_libgen_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBGEN_H 1 +_ACEOF + +fi + +done + +for ac_header in sys/user.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "sys/user.h" "ac_cv_header_sys_user_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_user_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SYS_USER_H 1 +_ACEOF + +fi + +done + +for ac_header in sys/mman.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "sys/mman.h" "ac_cv_header_sys_mman_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_mman_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SYS_MMAN_H 1 +_ACEOF + +fi + +done + +for ac_header in cstdio stdio.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_cxx_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + break +else + as_fn_error $? "Cannot find cstdio or stdio.h. Fim requires at least one or the other." "$LINENO" 5 +fi + +done + + +for ac_header in climits limits.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_cxx_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + break +else + as_fn_error $? "Cannot find limits.h nor climits. Fim requires it!." "$LINENO" 5 +fi + +done + + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5 +$as_echo_n "checking size of int... " >&6; } +if ${ac_cv_sizeof_int+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_cxx_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_int" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (int) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_int=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5 +$as_echo "$ac_cv_sizeof_int" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_INT $ac_cv_sizeof_int +_ACEOF + + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int *" >&5 +$as_echo_n "checking size of int *... " >&6; } +if ${ac_cv_sizeof_int_p+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_cxx_compute_int "$LINENO" "(long int) (sizeof (int *))" "ac_cv_sizeof_int_p" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_int_p" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (int *) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_int_p=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int_p" >&5 +$as_echo "$ac_cv_sizeof_int_p" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_INT_P $ac_cv_sizeof_int_p +_ACEOF + + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of size_t" >&5 +$as_echo_n "checking size of size_t... " >&6; } +if ${ac_cv_sizeof_size_t+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_cxx_compute_int "$LINENO" "(long int) (sizeof (size_t))" "ac_cv_sizeof_size_t" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_size_t" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (size_t) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_size_t=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_size_t" >&5 +$as_echo "$ac_cv_sizeof_size_t" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_SIZE_T $ac_cv_sizeof_size_t +_ACEOF + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 +$as_echo_n "checking whether byte ordering is bigendian... " >&6; } +if ${ac_cv_c_bigendian+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_c_bigendian=unknown + # See if we're dealing with a universal compiler. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __APPLE_CC__ + not a universal capable compiler + #endif + typedef int dummy; + +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + + # Check for potential -arch flags. It is not universal unless + # there are at least two -arch flags with different values. + ac_arch= + ac_prev= + for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do + if test -n "$ac_prev"; then + case $ac_word in + i?86 | x86_64 | ppc | ppc64) + if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then + ac_arch=$ac_word + else + ac_cv_c_bigendian=universal + break + fi + ;; + esac + ac_prev= + elif test "x$ac_word" = "x-arch"; then + ac_prev=arch + fi + done +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test $ac_cv_c_bigendian = unknown; then + # See if sys/param.h defines the BYTE_ORDER macro. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + +int +main () +{ +#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ + && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ + && LITTLE_ENDIAN) + bogus endian macros + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + # It does; now see whether it defined to BIG_ENDIAN or not. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + +int +main () +{ +#if BYTE_ORDER != BIG_ENDIAN + not big endian + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_c_bigendian=yes +else + ac_cv_c_bigendian=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test $ac_cv_c_bigendian = unknown; then + # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main () +{ +#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) + bogus endian macros + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + # It does; now see whether it defined to _BIG_ENDIAN or not. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main () +{ +#ifndef _BIG_ENDIAN + not big endian + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_c_bigendian=yes +else + ac_cv_c_bigendian=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test $ac_cv_c_bigendian = unknown; then + # Compile a test program. + if test "$cross_compiling" = yes; then : + # Try to guess by grepping values from an object file. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +short int ascii_mm[] = + { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; + short int ascii_ii[] = + { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; + int use_ascii (int i) { + return ascii_mm[i] + ascii_ii[i]; + } + short int ebcdic_ii[] = + { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; + short int ebcdic_mm[] = + { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; + int use_ebcdic (int i) { + return ebcdic_mm[i] + ebcdic_ii[i]; + } + extern int foo; + +int +main () +{ +return use_ascii (foo) == use_ebcdic (foo); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then + ac_cv_c_bigendian=yes + fi + if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi + fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ + + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long int l; + char c[sizeof (long int)]; + } u; + u.l = 1; + return u.c[sizeof (long int) - 1] == 1; + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_run "$LINENO"; then : + ac_cv_c_bigendian=no +else + ac_cv_c_bigendian=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 +$as_echo "$ac_cv_c_bigendian" >&6; } + case $ac_cv_c_bigendian in #( + yes) + fim_big_endian=yes;; #( + no) + fim_big_endian=no ;; #( + universal) + +$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h + + ;; #( + *) + fim_big_endian=hmmm ;; + esac + + +if test "x$fim_big_endian" = "xyes" ; then + + $as_echo "#define FIM_BIG_ENDIAN 1" >>confdefs.h + +fi + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5 +$as_echo_n "checking return type of signal handlers... " >&6; } +if ${ac_cv_type_signal+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include + +int +main () +{ +return *(signal (0, 0)) (0) == 1; + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_type_signal=int +else + ac_cv_type_signal=void +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5 +$as_echo "$ac_cv_type_signal" >&6; } + +cat >>confdefs.h <<_ACEOF +#define RETSIGTYPE $ac_cv_type_signal +_ACEOF + + + + +# Check whether --enable-static was given. +if test "${enable_static+set}" = set; then : + enableval=$enable_static; if test x$enableval = xyes; then fim_cv_want_static=1 ; else fim_cv_want_static=0 ; fi +else + fim_cv_want_static=0 +fi + +if test x$fim_cv_want_static == x1 ; then + LIBS="$LIBS --static" + LIBDJVU_STATIC_EXTRA="-lpthread" + # too many dependencies for the following! + LIBPOPPLER_STATIC_EXTRA="" + LIBSPECTRE_STATIC_EXTRA="" + #LIBPOPPLER_STATIC_EXTRA="-lfreetype -llcms" + #LIBSPECTRE_STATIC_EXTRA="-Wl,--start-group -lgs -lfontconfig -ldl -ljbig2dec -ljasper -lpthread -lpng -lppd -lpaper -lavahi-common -lavahi-client -lexpat -lfreetype -lgnutls -ldbus-1 -ltasn1 -lcupsimage -lcups -lgcrypt -Wl,--end-group " + LIBTIFF_STATIC_EXTRA="-ljpeg -lz" + cat >>confdefs.h <<_ACEOF +#define FIM_WANT_STATIC_BINARY $fim_cv_want_static Want a static binary. (disabled by default) +_ACEOF + +fi + + + +# Check whether --with-regex was given. +if test "${with_regex+set}" = set; then : + withval=$with_regex; fim_cv_regex=yes +else + for ac_func in regcomp +do : + ac_fn_cxx_check_func "$LINENO" "regcomp" "ac_cv_func_regcomp" +if test "x$ac_cv_func_regcomp" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_REGCOMP 1 +_ACEOF + fim_cv_regex=no +else + fim_cv_regex=yes +fi +done + +fi + + +if test X$fim_cv_regex = Xno ; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether your system regexp library is completely broken" >&5 +$as_echo_n "checking whether your system regexp library is completely broken... " >&6; } +if ${fim_cv_regex_broken+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + fim_cv_regex_broken=yes +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +int main() { regex_t blah ; regmatch_t p; p.rm_eo = p.rm_eo; return regcomp(&blah, "foo.*bar", REG_NOSUB) || regexec (&blah, "foobar", 0, NULL, 0); } +_ACEOF +if ac_fn_cxx_try_run "$LINENO"; then : + fim_cv_regex_broken=no +else + fim_cv_regex_broken=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $fim_cv_regex_broken" >&5 +$as_echo "$fim_cv_regex_broken" >&6; } + if test X$fim_cv_regex_broken = Xyes ; then + echo "Using the included GNU regex instead." >&6 + fim_cv_regex=yes + fi +fi + +if test X$fim_cv_regex = Xyes; then + +$as_echo "#define USE_GNU_REGEX 1" >>confdefs.h + + case " $LIBOBJS " in + *" regex.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS regex.$ac_objext" + ;; +esac + +fi + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking where to put the documentation..." >&5 +$as_echo_n "checking where to put the documentation...... " >&6; } +# FIXME : the above line seems troublesome, BUT IT IS NOT (see the muttrc for this trick). + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $fim_cv_docdir" >&5 +$as_echo "$fim_cv_docdir" >&6; } + + + + +# Check whether --enable-gif was given. +if test "${enable_gif+set}" = set; then : + enableval=$enable_gif; if test x$enableval = xno ; then + fim_handle_gif=no + fi + +fi + +if test x$fim_handle_gif != xno ; then + fim_handle_gif=yes + have_gif=yes + if test x$with_libgif != xno && test -z "$LIBGIF"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DGifOpenFileHandle in -lgif" >&5 +$as_echo_n "checking for DGifOpenFileHandle in -lgif... " >&6; } +if ${ac_cv_lib_gif_DGifOpenFileHandle_+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgif $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char DGifOpenFileHandle (); +int +main () +{ +return DGifOpenFileHandle (); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_lib_gif_DGifOpenFileHandle_=yes +else + ac_cv_lib_gif_DGifOpenFileHandle_=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gif_DGifOpenFileHandle_" >&5 +$as_echo "$ac_cv_lib_gif_DGifOpenFileHandle_" >&6; } +if test "x$ac_cv_lib_gif_DGifOpenFileHandle_" = xyes; then : + have_gif=yes +else + have_gif=no + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** GIF loader will not be built (GIF library not found) ***" >&5 +$as_echo "$as_me: WARNING: *** GIF loader will not be built (GIF library not found) ***" >&2;} +fi + + if test x"$have_gif" = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gif.h" >&5 +$as_echo_n "checking for gif.h... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#undef PACKAGE +#undef VERSION +#undef HAVE_STDLIB_H +#include +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO"; then : + have_gif=yes +else + have_gif=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gif" >&5 +$as_echo "$have_gif" >&6; } + if test x"$have_gif" = xyes; then + LIBGIF='-lgif' + else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** GIF loader will not be built (GIF header file not found) ***" >&5 +$as_echo "$as_me: WARNING: *** GIF loader will not be built (GIF header file not found) ***" >&2;} + fi + fi + fi + +# if test x$with_libgif != xno ; then +# the following needs thorough testing + if test x"$have_gif" == xyes ; then + FIM_LIB_OBJECTS="$FIM_LIB_OBJECTS FbiStuffGif.o" + LIBS="$LIBS $LIBGIF" + $as_echo "#define FIM_HANDLE_GIF 1" >>confdefs.h + + else + fim_handle_gif=no + fi + +# if test x$with_libgif != xno && test -z "$LIBGIF"; then + # +# fi +else + fim_handle_gif=no +fi + + if test x$have_gif = xyes; then + ENABLE_GIF_TRUE= + ENABLE_GIF_FALSE='#' +else + ENABLE_GIF_TRUE='#' + ENABLE_GIF_FALSE= +fi + + + + +# Check whether --enable-tiff was given. +if test "${enable_tiff+set}" = set; then : + enableval=$enable_tiff; if test x$enableval = xno ; then + fim_handle_tiff=no + fi + +fi + +if test x$fim_handle_tiff != xno ; then + fim_handle_tiff=yes + have_tiff=yes + if test x$with_libtiff != xno && test -z "$LIBTIFF"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for TIFFOpen in -ltiff" >&5 +$as_echo_n "checking for TIFFOpen in -ltiff... " >&6; } +if ${ac_cv_lib_tiff_TIFFOpen_+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ltiff $LIBTIFF_STATIC_EXTRA $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char TIFFOpen (); +int +main () +{ +return TIFFOpen (); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_lib_tiff_TIFFOpen_=yes +else + ac_cv_lib_tiff_TIFFOpen_=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tiff_TIFFOpen_" >&5 +$as_echo "$ac_cv_lib_tiff_TIFFOpen_" >&6; } +if test "x$ac_cv_lib_tiff_TIFFOpen_" = xyes; then : + have_tiff=yes +else + have_tiff=no + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** TIFF loader will not be built (TIFF library not found) ***" >&5 +$as_echo "$as_me: WARNING: *** TIFF loader will not be built (TIFF library not found) ***" >&2;} +fi + + if test x"$have_tiff" = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tiff.h" >&5 +$as_echo_n "checking for tiff.h... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#undef PACKAGE +#undef VERSION +#undef HAVE_STDLIB_H +#include +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO"; then : + have_tiff=yes +else + have_tiff=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_tiff" >&5 +$as_echo "$have_tiff" >&6; } + if test x"$have_tiff" = xyes; then + LIBTIFF="-ltiff $LIBTIFF_STATIC_EXTRA" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** TIFF loader will not be built (TIFF header file not found) ***" >&5 +$as_echo "$as_me: WARNING: *** TIFF loader will not be built (TIFF header file not found) ***" >&2;} + fi + fi + fi + +# if test x$with_libtiff != xno ; then +# the following needs thorough testing + if test x"$have_tiff" == xyes ; then + FIM_LIB_OBJECTS="$FIM_LIB_OBJECTS FbiStuffTiff.o" + LIBS="$LIBS $LIBTIFF" + $as_echo "#define FIM_HANDLE_TIFF 1" >>confdefs.h + + else + fim_handle_tiff=no + fi + +# if test x$with_libtiff != xno && test -z "$LIBTIFF"; then + # +# fi +else + fim_handle_tiff=no +fi + + if test x$have_tiff = xyes; then + ENABLE_TIFF_TRUE= + ENABLE_TIFF_FALSE='#' +else + ENABLE_TIFF_TRUE='#' + ENABLE_TIFF_FALSE= +fi + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for noecho in -lcurses" >&5 +$as_echo_n "checking for noecho in -lcurses... " >&6; } +if ${ac_cv_lib_curses_noecho+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lcurses $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char noecho (); +int +main () +{ +return noecho (); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_lib_curses_noecho=yes +else + ac_cv_lib_curses_noecho=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_curses_noecho" >&5 +$as_echo "$ac_cv_lib_curses_noecho" >&6; } +if test "x$ac_cv_lib_curses_noecho" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBCURSES 1 +_ACEOF + + LIBS="-lcurses $LIBS" + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for noecho in -lncurses" >&5 +$as_echo_n "checking for noecho in -lncurses... " >&6; } +if ${ac_cv_lib_ncurses_noecho+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lncurses $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char noecho (); +int +main () +{ +return noecho (); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_lib_ncurses_noecho=yes +else + ac_cv_lib_ncurses_noecho=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncurses_noecho" >&5 +$as_echo "$ac_cv_lib_ncurses_noecho" >&6; } +if test "x$ac_cv_lib_ncurses_noecho" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBNCURSES 1 +_ACEOF + + LIBS="-lncurses $LIBS" + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for caca_create_canvas in -lcaca" >&5 +$as_echo_n "checking for caca_create_canvas in -lcaca... " >&6; } +if ${ac_cv_lib_caca_caca_create_canvas+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lcaca $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char caca_create_canvas (); +int +main () +{ +return caca_create_canvas (); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_lib_caca_caca_create_canvas=yes +else + ac_cv_lib_caca_caca_create_canvas=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_caca_caca_create_canvas" >&5 +$as_echo "$ac_cv_lib_caca_caca_create_canvas" >&6; } +if test "x$ac_cv_lib_caca_caca_create_canvas" = xyes; then : + have_cacalib=yes +else + have_cacalib=no +fi + + + +# AC_CHECK_LIB(gpm,Gpm_Open, +# ,true, +# AC_MSG_ERROR(*** gpm lib not found ... no problem ... ***)) +#LIBS="$LIBS -lgpm" + + +fim_want_cxx11=no +# Check whether --enable-cxx11 was given. +if test "${enable_cxx11+set}" = set; then : + enableval=$enable_cxx11; if test x$enableval = xno ; then + fim_want_cxx11=no + else + fim_want_cxx11=yes + fi + +fi + + + +fim_want_readline=yes +# Check whether --enable-readline was given. +if test "${enable_readline+set}" = set; then : + enableval=$enable_readline; if test x$enableval = xno ; then + fim_want_readline=no + else + fim_want_readline=yes + fi + +fi + + + + + + + +have_readline=no + +# Sometimes the readline library is linked to the curses library, and we here try to detect this case.. +if test x$have_readline = xno; then + if test x$fim_want_readline = xyes ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_replace_line in -lreadline" >&5 +$as_echo_n "checking for rl_replace_line in -lreadline... " >&6; } +if ${ac_cv_lib_readline_rl_replace_line+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lreadline + $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char rl_replace_line (); +int +main () +{ +return rl_replace_line (); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_lib_readline_rl_replace_line=yes +else + ac_cv_lib_readline_rl_replace_line=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_rl_replace_line" >&5 +$as_echo "$ac_cv_lib_readline_rl_replace_line" >&6; } +if test "x$ac_cv_lib_readline_rl_replace_line" = xyes; then : + have_readline=yes + LIBS="$LIBS -lreadline" + $as_echo "#define FIM_USE_READLINE 1" >>confdefs.h + + +else + have_readline=no + as_fn_error $? "*** GNU readline (or curses library ?) not found (used LIBS=${LIBS}) ! please install them or specify them in e.g. LIBS=... or run ./configure --disable-readline ***" "$LINENO" 5 + +fi + + else + have_readline=no + { $as_echo "$as_me:${as_lineno-$LINENO}: *** Fim will be built withoud GNU readline library headers ! Are you sure ? ***" >&5 +$as_echo "$as_me: *** Fim will be built withoud GNU readline library headers ! Are you sure ? ***" >&6;} + fi +fi + +if test x$have_readline = xyes; then + if test x$fim_want_readline = xyes ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tputs in -lcurses" >&5 +$as_echo_n "checking for tputs in -lcurses... " >&6; } +if ${ac_cv_lib_curses_tputs+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lcurses $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char tputs (); +int +main () +{ +return tputs (); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_lib_curses_tputs=yes +else + ac_cv_lib_curses_tputs=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_curses_tputs" >&5 +$as_echo "$ac_cv_lib_curses_tputs" >&6; } +if test "x$ac_cv_lib_curses_tputs" = xyes; then : + have_curses=yes + LIBS="$LIBS" + +else + have_curses=no + +fi + + fi +fi + + +#AC_ARG_WITH(jpeg, [ --disable-jpeg ], [ disable jpeg file support]) +# Check whether --enable-jpeg was given. +if test "${enable_jpeg+set}" = set; then : + enableval=$enable_jpeg; if test x$enableval = xno ; then + fim_handle_jpeg=no + fi + +fi + +if test x$fim_handle_jpeg != xno ; then + fim_handle_jpeg=yes + have_jpeg=yes + if test x$with_libjpeg != xno && test -z "$LIBJPEG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jpeg_destroy_decompress in -ljpeg" >&5 +$as_echo_n "checking for jpeg_destroy_decompress in -ljpeg... " >&6; } +if ${ac_cv_lib_jpeg_jpeg_destroy_decompress+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ljpeg $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char jpeg_destroy_decompress (); +int +main () +{ +return jpeg_destroy_decompress (); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_lib_jpeg_jpeg_destroy_decompress=yes +else + ac_cv_lib_jpeg_jpeg_destroy_decompress=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jpeg_jpeg_destroy_decompress" >&5 +$as_echo "$ac_cv_lib_jpeg_jpeg_destroy_decompress" >&6; } +if test "x$ac_cv_lib_jpeg_jpeg_destroy_decompress" = xyes; then : + have_jpeg=yes +else + have_jpeg=no + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** JPEG loader will not be built (JPEG library not found) ***" >&5 +$as_echo "$as_me: WARNING: *** JPEG loader will not be built (JPEG library not found) ***" >&2;} +fi + + if test x"$have_jpeg" = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jpeglib.h" >&5 +$as_echo_n "checking for jpeglib.h... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#undef PACKAGE +#undef VERSION +#undef HAVE_STDLIB_H +#include +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO"; then : + have_jpeg=yes +else + have_jpeg=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_jpeg" >&5 +$as_echo "$have_jpeg" >&6; } + if test x"$have_jpeg" = xyes; then + LIBJPEG='-ljpeg' + else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** JPEG loader will not be built (JPEG header file not found) ***" >&5 +$as_echo "$as_me: WARNING: *** JPEG loader will not be built (JPEG header file not found) ***" >&2;} + fi + fi + fi + +# if test x$with_libjpeg != xno ; then +# the following needs thorough testing + if test x"$have_jpeg" == xyes ; then + FIM_LIB_OBJECTS="$FIM_LIB_OBJECTS FbiStuffJpeg.o" + LIBS="$LIBS $LIBJPEG" + +$as_echo "#define HAVE_LIBJPEG 1" >>confdefs.h + + else + fim_handle_jpeg=no + fi + +# if test x$with_libjpeg != xno && test -z "$LIBJPEG"; then +# AC_MSG_ERROR([ +# Checks for JPEG loader failed. You can build without it by passing +# --disable-jpeg to ./configure. ]) +# fi +else + fim_handle_jpeg=no +fi + + if test x$have_jpeg = xyes; then + ENABLE_JPEG_TRUE= + ENABLE_JPEG_FALSE='#' +else + ENABLE_JPEG_TRUE='#' + ENABLE_JPEG_FALSE= +fi + + + + +# Check whether --enable-ps was given. +if test "${enable_ps+set}" = set; then : + enableval=$enable_ps; if test x$enableval = xno ; then + fim_handle_ps=no + fi + +fi + +if test x$fim_handle_ps != xno ; then + fim_handle_ps=yes + have_ps=yes + if test x$with_libps != xno && test -z "$LIBPS"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for spectre_page_render in -lspectre" >&5 +$as_echo_n "checking for spectre_page_render in -lspectre... " >&6; } +if ${ac_cv_lib_spectre_spectre_page_render+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lspectre $LIBSPECTRE_STATIC_EXTRA $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char spectre_page_render (); +int +main () +{ +return spectre_page_render (); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_lib_spectre_spectre_page_render=yes +else + ac_cv_lib_spectre_spectre_page_render=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_spectre_spectre_page_render" >&5 +$as_echo "$ac_cv_lib_spectre_spectre_page_render" >&6; } +if test "x$ac_cv_lib_spectre_spectre_page_render" = xyes; then : + have_ps=yes +else + have_ps=no + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** PS loader will not be built (spectre library not found) ***" >&5 +$as_echo "$as_me: WARNING: *** PS loader will not be built (spectre library not found) ***" >&2;} +fi + + if test x"$have_ps" = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libspectre/spectre.h" >&5 +$as_echo_n "checking for libspectre/spectre.h... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#undef PACKAGE +#undef VERSION +#undef HAVE_STDLIB_H +#include +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO"; then : + have_ps=yes +else + have_ps=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_ps" >&5 +$as_echo "$have_ps" >&6; } + if test x"$have_ps" = xyes; then + LIBPS="-lspectre $LIBSPECTRE_STATIC_EXTRA" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** PS loader will not be built (PS header file not found) ***" >&5 +$as_echo "$as_me: WARNING: *** PS loader will not be built (PS header file not found) ***" >&2;} + fi + fi + fi + +# the following needs thorough testing + if test x"$have_ps" == xyes ; then + FIM_LIB_OBJECTS="$FIM_LIB_OBJECTS FbiStuffPs.o" + LIBS="$LIBS $LIBPS" + +$as_echo "#define HAVE_LIBSPECTRE 1" >>confdefs.h + + else + fim_handle_ps=no + fi + +# if test x$with_libps != xno && test -z "$LIBPS"; then +# AC_MSG_ERROR([ +# Checks for PS loader failed. You can build without it by passing +# --disable-ps to ./configure. ]) +# fi +else + fim_handle_ps=no +fi + + if test x$have_ps = xyes; then + ENABLE_PS_TRUE= + ENABLE_PS_FALSE='#' +else + ENABLE_PS_TRUE='#' + ENABLE_PS_FALSE= +fi + + + + + +# Check whether --enable-djvu was given. +if test "${enable_djvu+set}" = set; then : + enableval=$enable_djvu; if test x$enableval = xno ; then + fim_handle_djvu=no + fi + +fi + +if test x$fim_handle_djvu != xno ; then + fim_handle_djvu=yes + have_djvu=yes + if test x$with_libdjvu != xno && test -z "$LIBDJVU"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ddjvu_page_create_by_pageno in -ldjvulibre" >&5 +$as_echo_n "checking for ddjvu_page_create_by_pageno in -ldjvulibre... " >&6; } +if ${ac_cv_lib_djvulibre_ddjvu_page_create_by_pageno+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldjvulibre $LIBDJVU_STATIC_EXTRA $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char ddjvu_page_create_by_pageno (); +int +main () +{ +return ddjvu_page_create_by_pageno (); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_lib_djvulibre_ddjvu_page_create_by_pageno=yes +else + ac_cv_lib_djvulibre_ddjvu_page_create_by_pageno=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_djvulibre_ddjvu_page_create_by_pageno" >&5 +$as_echo "$ac_cv_lib_djvulibre_ddjvu_page_create_by_pageno" >&6; } +if test "x$ac_cv_lib_djvulibre_ddjvu_page_create_by_pageno" = xyes; then : + have_djvu=yes +else + have_djvu=no + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** DJVU loader will not be built (DJVU library not found) ***" >&5 +$as_echo "$as_me: WARNING: *** DJVU loader will not be built (DJVU library not found) ***" >&2;} +fi + + if test x"$have_djvu" = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libdjvu/ddjvuapi.h" >&5 +$as_echo_n "checking for libdjvu/ddjvuapi.h... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#undef PACKAGE +#undef VERSION +#undef HAVE_STDLIB_H +#include +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO"; then : + have_djvu=yes +else + have_djvu=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_djvu" >&5 +$as_echo "$have_djvu" >&6; } + if test x"$have_djvu" = xyes; then + LIBDJVU="-ldjvulibre $LIBDJVU_STATIC_EXTRA" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** DJVU loader will not be built (DJVU header file not found) ***" >&5 +$as_echo "$as_me: WARNING: *** DJVU loader will not be built (DJVU header file not found) ***" >&2;} + fi + fi + fi + +# the following needs thorough testing + if test x"$have_djvu" == xyes ; then + FIM_LIB_OBJECTS="$FIM_LIB_OBJECTS FbiStuffDjvu.o" + LIBS="$LIBS $LIBDJVU" + +$as_echo "#define HAVE_LIBDJVU 1" >>confdefs.h + + else + fim_handle_djvu=no + fi + +# if test x$with_libdjvu != xno && test -z "$LIBDJVU"; then +# AC_MSG_ERROR([ +# Checks for DJVU loader failed. You can build without it by passing +# --disable-djvu to ./configure. ]) +# fi +else + fim_handle_djvu=no +fi + + if test x$have_djvu = xyes; then + ENABLE_DJVU_TRUE= + ENABLE_DJVU_FALSE='#' +else + ENABLE_DJVU_TRUE='#' + ENABLE_DJVU_FALSE= +fi + + + +fim_handle_pdf=no +# Check whether --enable-poppler was given. +if test "${enable_poppler+set}" = set; then : + enableval=$enable_poppler; if test x$enableval = xyes ; then + fim_handle_pdf=yes + fi + +else + $LIBPOPPLER_STATIC_EXTRA +fi + +if test x$fim_handle_pdf != xno ; then + fim_handle_pdf=yes + have_poppler=yes + if test x$with_libpoppler != xno && test -z "$LIBPOPPLER"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gfree in -lpoppler" >&5 +$as_echo_n "checking for gfree in -lpoppler... " >&6; } +if ${ac_cv_lib_poppler_gfree+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpoppler $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char gfree (); +int +main () +{ +return gfree (); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_lib_poppler_gfree=yes +else + ac_cv_lib_poppler_gfree=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_poppler_gfree" >&5 +$as_echo "$ac_cv_lib_poppler_gfree" >&6; } +if test "x$ac_cv_lib_poppler_gfree" = xyes; then : + have_poppler=yes +else + have_poppler=no + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** POPPLER loader will not be built (POPPLER library not found) ***" >&5 +$as_echo "$as_me: WARNING: *** POPPLER loader will not be built (POPPLER library not found) ***" >&2;} +fi + + if test x"$have_poppler" = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for poppler/poppler-config.h" >&5 +$as_echo_n "checking for poppler/poppler-config.h... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #undef PACKAGE + #undef VERSION + #undef HAVE_STDLIB_H + /* fim uses these headers. let us hope poppler will stabilize soon!*/ + #include + #include + #include + #include + #include + #include + #include + #include /* globalParams lives here */ + +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO"; then : + have_poppler=yes +else + have_poppler=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext + have_poppler=yes + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_poppler" >&5 +$as_echo "$have_poppler" >&6; } + if test x"$have_poppler" = xyes; then + LIBPOPPLER="-lpoppler $LIBPOPPLER_STATIC_EXTRA" + # FIXME: the following is a dirty hack! + if test x"$LIBPOPPLER_CXXFLAGS" = x ; then + LIBPOPPLER_CXXFLAGS="-I/usr/include/poppler/" + fi + CXXFLAGS="$CXXFLAGS $LIBPOPPLER_CXXFLAGS -DFIM_LIBPOPPLER_VERSION_MAYBE=$have_poppler_maybe_version" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** POPPLER/PDF loader will not be built (POPPLER header file not found) ***" >&5 +$as_echo "$as_me: WARNING: *** POPPLER/PDF loader will not be built (POPPLER header file not found) ***" >&2;} + fi + fi + fi + +# the following needs thorough testing + if test x"$have_poppler" == xyes ; then + FIM_LIB_OBJECTS="$FIM_LIB_OBJECTS FbiStuffPdf.o" + LIBS="$LIBS $LIBPOPPLER" + +$as_echo "#define HAVE_LIBPOPPLER 1" >>confdefs.h + + else + fim_handle_pdf=no + fi + +# if test x$with_libpoppler != xno && test -z "$LIBPOPPLER"; then +# AC_MSG_ERROR([ +# Checks for POPPLER loader failed. You can build without it by passing +# --disable-poppler to ./configure. ]) +# fi +else + fim_handle_pdf=no +fi + + if test x$have_poppler = xyes; then + ENABLE_POPPLER_TRUE= + ENABLE_POPPLER_FALSE='#' +else + ENABLE_POPPLER_TRUE='#' + ENABLE_POPPLER_FALSE= +fi + + +# Check whether --enable-pdf was given. +if test "${enable_pdf+set}" = set; then : + enableval=$enable_pdf; enable_pdf="$enableval" +else + enable_pdf=yes +fi + + +if test "x$enable_pdf" = "xyes"; then + POPPLER_REQUIRED=0.8.7 + # dear fim hackers, you should install pkg-config to get this macro expanded + + + + + + + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +$as_echo "$ac_pt_PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + PKG_CONFIG="" + fi +fi + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for POPPLER" >&5 +$as_echo_n "checking for POPPLER... " >&6; } + +if test -n "$POPPLER_CFLAGS"; then + pkg_cv_POPPLER_CFLAGS="$POPPLER_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"poppler >= \$POPPLER_REQUIRED\""; } >&5 + ($PKG_CONFIG --exists --print-errors "poppler >= $POPPLER_REQUIRED") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_POPPLER_CFLAGS=`$PKG_CONFIG --cflags "poppler >= $POPPLER_REQUIRED" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$POPPLER_LIBS"; then + pkg_cv_POPPLER_LIBS="$POPPLER_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"poppler >= \$POPPLER_REQUIRED\""; } >&5 + ($PKG_CONFIG --exists --print-errors "poppler >= $POPPLER_REQUIRED") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_POPPLER_LIBS=`$PKG_CONFIG --libs "poppler >= $POPPLER_REQUIRED" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + POPPLER_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "poppler >= $POPPLER_REQUIRED" 2>&1` + else + POPPLER_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "poppler >= $POPPLER_REQUIRED" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$POPPLER_PKG_ERRORS" >&5 + + enable_pdf=no +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + enable_pdf=no +else + POPPLER_CFLAGS=$pkg_cv_POPPLER_CFLAGS + POPPLER_LIBS=$pkg_cv_POPPLER_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + enable_pdf=yes +fi + + if test "x$enable_pdf" = "xyes"; then + +$as_echo "#define ENABLE_PDF 1" >>confdefs.h + + SHELL_LIBS="$SHELL_LIBS $POPPLER_LIBS" + SHELL_CXXFLAGS="$SHELL_CXXFLAGS $POPPLER_CXXFLAGS" + + fim_save_LIBS=$LIBS + LIBS="$LIBS $POPPLER_LIBS" + LIBS=$fim_save_LIBS + + else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"PDF support is disabled since poppler library version $POPPLER_REQUIRED or newer not found\"" >&5 +$as_echo "$as_me: WARNING: \"PDF support is disabled since poppler library version $POPPLER_REQUIRED or newer not found\"" >&2;} + fi +fi + + if test x$enable_pdf = xyes; then + ENABLE_PDF_TRUE= + ENABLE_PDF_FALSE='#' +else + ENABLE_PDF_TRUE='#' + ENABLE_PDF_FALSE= +fi + + +fim_handle_bmp=yes +# Check whether --enable-bmp was given. +if test "${enable_bmp+set}" = set; then : + enableval=$enable_bmp; if test x$enableval = xno ; then + fim_handle_bmp=no + fi + +fi + +if test x$fim_handle_bmp = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Enabling BMP file format support." >&5 +$as_echo "$as_me: Enabling BMP file format support." >&6;} + +$as_echo "#define FIM_WITH_BMP 1" >>confdefs.h + + FIM_LIB_OBJECTS="$FIM_LIB_OBJECTS FbiStuffBmp.o" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: Disabling BMP file format support." >&5 +$as_echo "$as_me: Disabling BMP file format support." >&6;} + +$as_echo "#define FIM_WITH_BMP 0" >>confdefs.h + +fi +fim_handle_pcx=yes +# Check whether --enable-pcx was given. +if test "${enable_pcx+set}" = set; then : + enableval=$enable_pcx; if test x$enableval = xno ; then + fim_handle_pcx=no + fi + +fi + +if test x$fim_handle_pcx = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Enabling PCX file format support." >&5 +$as_echo "$as_me: Enabling PCX file format support." >&6;} + +$as_echo "#define FIM_WITH_PCX 1" >>confdefs.h + + FIM_LIB_OBJECTS="$FIM_LIB_OBJECTS FbiStuffPcx.o" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: Disabling PCX file format support." >&5 +$as_echo "$as_me: Disabling PCX file format support." >&6;} + +$as_echo "#define FIM_WITH_PCX 0" >>confdefs.h + +fi + +## png file handling + + +# Check whether --with-png-prefix was given. +if test "${with_png_prefix+set}" = set; then : + withval=$with_png_prefix; libpng_config_prefix="$withval" +else + libpng_config_prefix="" +fi + + +fim_handle_png=yes + +# Check whether --enable-png was given. +if test "${enable_png+set}" = set; then : + enableval=$enable_png; if test x$enableval = xno ; then + fim_handle_png=no + fi + +fi + + +if test x$fim_handle_png = xyes; then + # support for custom library configurator path + if test x$libpng_config_prefix != x; then + LIBPNG_CONFIG="$libpng_config_prefix/bin/libpng-config" + else + # default path configurator + # Extract the first word of "libpng-config", so it can be a program name with args. +set dummy libpng-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_LIBPNG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $LIBPNG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_LIBPNG_CONFIG="$LIBPNG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_LIBPNG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_LIBPNG_CONFIG" && ac_cv_path_LIBPNG_CONFIG="no" + ;; +esac +fi +LIBPNG_CONFIG=$ac_cv_path_LIBPNG_CONFIG +if test -n "$LIBPNG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBPNG_CONFIG" >&5 +$as_echo "$LIBPNG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi + if test "x$LIBPNG_CONFIG" = "xno"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** PNG loader will not be built (PNG library not found) ***" >&5 +$as_echo "$as_me: WARNING: *** PNG loader will not be built (PNG library not found) ***" >&2;} + fim_handle_png=no + else + CXXFLAGS="$CXXFLAGS `$LIBPNG_CONFIG --cflags`" + if test x$fim_cv_want_static == x1 ; then + LIBS="$LIBS `$LIBPNG_CONFIG --static --libs`" + else + LIBS="$LIBS `$LIBPNG_CONFIG --libs`" + fi + # finish this ! + FIM_LIB_OBJECTS="$FIM_LIB_OBJECTS FbiStuffPng.o" + +$as_echo "#define FIM_WITH_LIBPNG 1" >>confdefs.h + + fi +fi + +#AM_CONDITIONAL(BUILD_PNG, test x$fim_handle_png = xyes) + + +fim_handle_xyz=no + +# Check whether --enable-xyz was given. +if test "${enable_xyz+set}" = set; then : + enableval=$enable_xyz; if test x$enableval = xyes ; then + fim_handle_xyz=yes + fi + +fi + + +if test x$fim_handle_xyz = xyes; then + LIBXYZ="" # one would set an actual value here + LIBS="$LIBS $LIBXYZ" + FIM_LIB_OBJECTS="$FIM_LIB_OBJECTS FbiStuffXyz.o" + +$as_echo "#define FIM_WITH_LIBXYZ 1" >>confdefs.h + +fi + + +## raw/nef file handling via UFRaw + +fim_handle_ufraw=no + +# Check whether --enable-ufraw was given. +if test "${enable_ufraw+set}" = set; then : + enableval=$enable_ufraw; if test x$enableval = xno ; then + fim_handle_ufraw=no + else + fim_handle_ufraw=yes + fi + +fi + + +if test x$fim_handle_ufraw = xyes; then + # support for custom library configurator path + CXXFLAGS="$CXXFLAGS $UFRAW_CXXFLAGS" + LIBS="$LIBS $UFRAW_LIBS" + FIM_LIB_OBJECTS="$FIM_LIB_OBJECTS FbiStuffUFRaw.o" # FIXME + +$as_echo "#define FIM_WITH_UFRAW 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: Enabling UFRaw / libufraw." >&5 +$as_echo "$as_me: Enabling UFRaw / libufraw." >&6;} +fi + + +## archive file handling via libarchive + +fim_handle_archive=no + +# Check whether --enable-archive was given. +if test "${enable_archive+set}" = set; then : + enableval=$enable_archive; if test x$enableval = xno ; then + fim_handle_archive=no + else + fim_handle_archive=yes + fi + +fi + + +if test x$fim_handle_archive = xyes; then + # support for custom library configurator path + CXXFLAGS="$CXXFLAGS $ARCHIVE_CXXFLAGS" + LIBS="$LIBS $ARCHIVE_LIBS -larchive" + +$as_echo "#define FIM_WITH_ARCHIVE 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: Enabling libarchive." >&5 +$as_echo "$as_me: Enabling libarchive." >&6;} +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exif_data_new_from_data in -lexif" >&5 +$as_echo_n "checking for exif_data_new_from_data in -lexif... " >&6; } +if ${ac_cv_lib_exif_exif_data_new_from_data+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lexif $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char exif_data_new_from_data (); +int +main () +{ +return exif_data_new_from_data (); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_lib_exif_exif_data_new_from_data=yes +else + ac_cv_lib_exif_exif_data_new_from_data=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_exif_exif_data_new_from_data" >&5 +$as_echo "$ac_cv_lib_exif_exif_data_new_from_data" >&6; } +if test "x$ac_cv_lib_exif_exif_data_new_from_data" = xyes; then : + have_libexif=yes +else + have_libexif=no +fi + +# Check whether --enable-exif was given. +if test "${enable_exif+set}" = set; then : + enableval=$enable_exif; if test x$enableval != xno; then fim_cv_libexif=yes; fi +else + fim_cv_libexif=yes; +fi + + +if test x$fim_cv_libexif = xyes; then + if test x$have_libexif = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Enabling libexif usage." >&5 +$as_echo "$as_me: Enabling libexif usage." >&6;} + CXXFLAGS="$CXXFLAGS"; + LIBS="$LIBS -lexif"; + else + as_fn_error $? "Sorry, it does not seem like libexif is installed or detectable. + Please run --disable-exif or install libexif in a system-wide directory instead. + " "$LINENO" 5 + fi +else + fim_cv_libexif=no; +fi + + +# Check whether --enable-jasper was given. +if test "${enable_jasper+set}" = set; then : + enableval=$enable_jasper; if test x$enableval = xyes; then + fim_cv_libjasper=yes; + CXXFLAGS="$CXXFLAGS"; + LIBS="$LIBS -ljasper"; + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jas_init in -ljasper" >&5 +$as_echo_n "checking for jas_init in -ljasper... " >&6; } +if ${ac_cv_lib_jasper_jas_init+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ljasper $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char jas_init (); +int +main () +{ +return jas_init (); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_lib_jasper_jas_init=yes +else + ac_cv_lib_jasper_jas_init=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jasper_jas_init" >&5 +$as_echo "$ac_cv_lib_jasper_jas_init" >&6; } +if test "x$ac_cv_lib_jasper_jas_init" = xyes; then : + have_libjasper=yes +else + have_libjasper=no +fi + + if test x$have_libjasper = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Enabling support of JPEG-2K files with JasPer." >&5 +$as_echo "$as_me: Enabling support of JPEG-2K files with JasPer." >&6;}; + FIM_LIB_OBJECTS="$FIM_LIB_OBJECTS FbiStuffJasPer.o"; + else + fim_cv_libjasper=no; + as_fn_error $? "Sorry, it does not seem like libjasper is installed or detectable. + Please run --disable-jasper or install libjasper in a system-wide directory instead. + " "$LINENO" 5; + fi + fi +else + fim_cv_libjasper=no; +fi + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for aa_getfirst in -laa" >&5 +$as_echo_n "checking for aa_getfirst in -laa... " >&6; } +if ${ac_cv_lib_aa_aa_getfirst+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-laa $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char aa_getfirst (); +int +main () +{ +return aa_getfirst (); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_lib_aa_aa_getfirst=yes +else + ac_cv_lib_aa_aa_getfirst=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_aa_aa_getfirst" >&5 +$as_echo "$ac_cv_lib_aa_aa_getfirst" >&6; } +if test "x$ac_cv_lib_aa_aa_getfirst" = xyes; then : + fim_cv_libaa=yes +else + fim_cv_libaa=no +fi + +# Check whether --enable-aa was given. +if test "${enable_aa+set}" = set; then : + enableval=$enable_aa; if test x$enableval != xno; then fim_cv_libaa=yes; else fim_cv_libaa=no; fi +else + fim_cv_libaa=yes; +fi + +if test x$fim_cv_libaa != xno; then + if test x$ac_cv_lib_aa_aa_getfirst = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Enabling aalib driver." >&5 +$as_echo "$as_me: Enabling aalib driver." >&6;} + fim_cv_aalib=yes + if test x$libaa_config_prefix != x; then + LIBAA_CONFIG="$libaa_config_prefix/bin/aalib-config" + else + # default path configurator + # Extract the first word of "aalib-config", so it can be a program name with args. +set dummy aalib-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_LIBAA_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $LIBAA_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_LIBAA_CONFIG="$LIBAA_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_LIBAA_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_LIBAA_CONFIG" && ac_cv_path_LIBAA_CONFIG="no" + ;; +esac +fi +LIBAA_CONFIG=$ac_cv_path_LIBAA_CONFIG +if test -n "$LIBAA_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBAA_CONFIG" >&5 +$as_echo "$LIBAA_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi + if test "x$LIBAA_CONFIG" = "xno"; then + # uhm + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** no aalib-config ? ***" >&5 +$as_echo "$as_me: WARNING: *** no aalib-config ? ***" >&2;} + fim_cv_aalib=no + else + CXXFLAGS="$CXXFLAGS `$LIBAA_CONFIG --cflags`" + LIBS="$LIBS `$LIBAA_CONFIG --libs`" + # finish this ! + fi + else + fim_cv_aalib=no + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ascii Art (-o aa) support disabled." >&5 +$as_echo "$as_me: WARNING: Ascii Art (-o aa) support disabled." >&2;} + fim_cv_aalib=no + fi + + +## sdl driver + + +# Check whether --with-sdl-prefix was given. +if test "${with_sdl_prefix+set}" = set; then : + withval=$with_sdl_prefix; libsdl_config_prefix="$withval" +else + libsdl_config_prefix="" +fi + + +fim_handle_sdl='auto' + + +# Check whether --enable-sdl was given. +if test "${enable_sdl+set}" = set; then : + enableval=$enable_sdl; if test x$enableval = xyes ; then fim_handle_sdl=yes ; fi + if test x$enableval = xno ; then fim_handle_sdl=no ; fi +fi + + +# tested with sdl 1.2 +if test x$fim_handle_sdl != xno; then + # support for custom library configurator path + if test x$libsdl_config_prefix != x; then + LIBSDL_CONFIG="$libsdl_config_prefix/bin/sdl-config" + else + # Extract the first word of "sdl-config", so it can be a program name with args. +set dummy sdl-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_LIBSDL_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $LIBSDL_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_LIBSDL_CONFIG="$LIBSDL_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_LIBSDL_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_LIBSDL_CONFIG" && ac_cv_path_LIBSDL_CONFIG="no" + ;; +esac +fi +LIBSDL_CONFIG=$ac_cv_path_LIBSDL_CONFIG +if test -n "$LIBSDL_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBSDL_CONFIG" >&5 +$as_echo "$LIBSDL_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi + if test "x$LIBSDL_CONFIG" = "xno"; then + if test x$fim_handle_sdl = xyes; then + as_fn_error $? "LIBSDL not found (failed detecting the sdl-config program)" "$LINENO" 5 + else + fim_handle_sdl='no' + fi + else + LIBSDL_CONFIG_FLAGS=--static-libs + { $as_echo "$as_me:${as_lineno-$LINENO}: Activating LIBSDL." >&5 +$as_echo "$as_me: Activating LIBSDL." >&6;} + fim_handle_sdl='yes' + LIBSDL_CXXFLAGS=`$LIBSDL_CONFIG --cflags` + CXXFLAGS="$CXXFLAGS $LIBSDL_CXXFLAGS" + LIBS="$LIBS `$LIBSDL_CONFIG $LIBSDL_CONFIG_FLAGS`" + # finish this ! + #FIM_LIB_OBJECTS="$FIM_LIB_OBJECTS SDLDevice.o" + +$as_echo "#define FIM_WITH_LIBSDL 1" >>confdefs.h + + fi +fi + + + +fim_cv_exiftool=no +# Check whether --enable-exiftool was given. +if test "${enable_exiftool+set}" = set; then : + enableval=$enable_exiftool; if test x$enableval = xyes; then + fim_cv_exiftool=yes + CXXFLAGS="$CXXFLAGS $EXIFTOOLCXXFLAGS" + LIBS="$LIBS $EXIFTOOLLINK" + { $as_echo "$as_me:${as_lineno-$LINENO}: Enabling exiftool interface." >&5 +$as_echo "$as_me: Enabling exiftool interface." >&6;} + +$as_echo "#define FIM_WANT_EXIFTOOL 1" >>confdefs.h + + fi +else + fim_cv_exiftool=no +fi + + +#AC_DEFINE([FIM_DEFAULT_KEY_CONFIG] ,1, [Defined, if GPGME support is enabled]) +#AC_DEFINE([FIM_DEFAULT_CONFIG], 1, [Defined, if GPGME support is enabled]) + +#AC_DEFINE([FIM_DEFAULT_CONFIGURATION], 1, [Defined, if GPGME support is enabled]) + +#AC_MSG_CHECKING(whether struct dirent defines d_ino) + + +fim_cv_autocommands=yes + +# Check whether --enable-autocommands was given. +if test "${enable_autocommands+set}" = set; then : + enableval=$enable_autocommands; if test x$enableval = xno; then + fim_cv_autocommands=no +fi +fi + + + +if test x$fim_cv_autocommands = xyes; then + have_autocommands=yes + $as_echo "#define FIM_AUTOCMDS 1" >>confdefs.h + +else + have_autocommands=no +fi + + + +# Check whether --enable-hardcoded-font was given. +if test "${enable_hardcoded_font+set}" = set; then : + enableval=$enable_hardcoded_font; if test x$enableval = xyes; then + fim_cv_hardcoded_font=yes; +else + fim_cv_hardcoded_font=no; +fi +else + fim_cv_hardcoded_font=yes; +fi + + + +if test x$fim_cv_hardcoded_font = xyes; then + have_hardcoded_font=yes + +$as_echo "#define FIM_WANT_HARDCODED_FONT 1" >>confdefs.h + +else + have_hardcoded_font=no +fi + if test x$have_hardcoded_font = xyes ; then + FIM_WANT_HARDCODED_CONSOLEFONT_TRUE= + FIM_WANT_HARDCODED_CONSOLEFONT_FALSE='#' +else + FIM_WANT_HARDCODED_CONSOLEFONT_TRUE='#' + FIM_WANT_HARDCODED_CONSOLEFONT_FALSE= +fi + + + + +# Check whether --enable-long-int-vars was given. +if test "${enable_long_int_vars+set}" = set; then : + enableval=$enable_long_int_vars; if test x$enableval = xyes; then + fim_cv_want_int64_int=yes; +else + fim_cv_want_int64_int=no; +fi +else + fim_cv_want_int64_int=yes; +fi + + + +if test x$fim_cv_want_int64_int = xyes; then + +$as_echo "#define FIM_WANT_LONG_INT 1" >>confdefs.h + +else + +$as_echo "#define FIM_WANT_LONG_INT 0" >>confdefs.h + +fi + +fim_cv_windows=yes + +# Check whether --enable-windows was given. +if test "${enable_windows+set}" = set; then : + enableval=$enable_windows; if test x$enableval = xno; then + fim_cv_windows=no +fi +fi + + + +if test x$fim_cv_windows = xyes; then + have_windows=yes + +$as_echo "#define FIM_WINDOWS 1" >>confdefs.h + +else + have_windows=no +fi + + +fim_cv_fimrc=yes + +# Check whether --enable-fimrc was given. +if test "${enable_fimrc+set}" = set; then : + enableval=$enable_fimrc; if test x$enableval = xno; then + fim_cv_fimrc=no +fi +fi + + + +if test x$fim_cv_fimrc = xyes; then + have_fimrc=yes +else + $as_echo "#define FIM_NOFIMRC 1" >>confdefs.h + +fi + + +fim_cv_history=yes + +# Check whether --enable-history was given. +if test "${enable_history+set}" = set; then : + enableval=$enable_history; if test x$enableval = xno; then + fim_cv_history=no +fi +fi + + + +if test x$fim_cv_history = xyes; then + have_history=yes +else + $as_echo "#define FIM_NOHISTORY 1" >>confdefs.h + +fi + + +fim_cv_warnings=no +# Check whether --enable-screen was given. +if test "${enable_screen+set}" = set; then : + enableval=$enable_screen; if test x$enableval = xno; then + fim_cv_screen=no + else + fim_cv_screen=yes + fi + +else + fim_cv_screen=yes + +fi + + + +fim_cv_resize_optimizations=yes +# Check whether --enable-resize-optimizations was given. +if test "${enable_resize_optimizations+set}" = set; then : + enableval=$enable_resize_optimizations; if test x$enableval = xno; then + fim_cv_resize_optimizations=no + else + fim_cv_resize_optimizations=yes + fi + +else + fim_cv_resize_optimizations=yes + +fi + + + +fim_cv_read_stdin_image=yes +# Check whether --enable-stdin-image-reading was given. +if test "${enable_stdin_image_reading+set}" = set; then : + enableval=$enable_stdin_image_reading; if test x$enableval = xno; then + fim_cv_read_stdin_image=no + else + fim_cv_read_stdin_image=yes + fi + +else + fim_cv_read_stdin_image=yes + +fi + + +fim_cv_scan_consolefonts=yes +# Check whether --enable-scan-consolefonts was given. +if test "${enable_scan_consolefonts+set}" = set; then : + enableval=$enable_scan_consolefonts; if test x$enableval = xyes; then + fim_cv_scan_consolefonts=yes + else + fim_cv_scan_consolefonts=no + fi + +else + fim_cv_scan_consolefonts=yes + +fi + +fim_cv_seek_magic=yes +# Check whether --enable-seek-magic was given. +if test "${enable_seek_magic+set}" = set; then : + enableval=$enable_seek_magic; if test x$enableval = xyes; then + fim_cv_seek_magic=yes + else + fim_cv_seek_magic=no + fi + +else + fim_cv_seek_magic=no + +fi + +# Check whether --enable-pushdir was given. +if test "${enable_pushdir+set}" = set; then : + enableval=$enable_pushdir; if test x$enableval = xno; then + fim_cv_read_dirs=no + else + fim_cv_read_dirs=yes + fi + +else + fim_cv_read_dirs=yes + +fi + +# Check whether --enable-recursive-pushdir was given. +if test "${enable_recursive_pushdir+set}" = set; then : + enableval=$enable_recursive_pushdir; if test x$enableval = xyes; then + fim_cv_recursive_dirs=yes; + fim_cv_read_dirs=yes; + else + fim_cv_recursive_dirs=no; + fi + +else + fim_cv_recursive_dirs=yes;fim_cv_read_dirs=yes; + +fi + + + + + + + + + + + +if test x$fim_cv_resize_optimizations != xyes; then + $as_echo "#define FIM_WANTS_SLOW_RESIZE 1" >>confdefs.h + +fi + + +if test x$fim_cv_read_dirs == xyes; then + $as_echo "#define FIM_READ_DIRS 1" >>confdefs.h + + if test x$fim_cv_recursive_dirs == xyes; then + $as_echo "#define FIM_RECURSIVE_DIRS 1" >>confdefs.h + + fi +fi + + +if test x$fim_cv_screen != xno; then +# boz patch is on + $as_echo "#define FIM_BOZ_PATCH 1" >>confdefs.h + +fi + + +fim_cv_read_stdin=yes + +if test x$fim_cv_read_stdin != xno; then + $as_echo "#define FIM_READ_STDIN 1" >>confdefs.h + +fi + + +if test x$fim_cv_read_stdin_image = xyes -a x$fim_cv_read_stdin = xyes; then + $as_echo "#define FIM_READ_STDIN_IMAGE 1" >>confdefs.h + +else + # we revert to no just for the printout + fim_cv_read_stdin_image=no +fi + + +fim_cv_warnings=no +# Check whether --enable-debug was given. +if test "${enable_debug+set}" = set; then : + enableval=$enable_debug; if test x$enableval = xyes; then + fim_cv_debug=yes +fi +fi + + + +fim_cv_warnings=no +# Check whether --enable-warnings was given. +if test "${enable_warnings+set}" = set; then : + enableval=$enable_warnings; if test x$enableval = xyes; then + fim_cv_warnings=yes +fi +fi + + +if test x$GCC = xyes ; then + if test x$fim_cv_debug = xyes; then + # CXXFLAGS are resetted + CXXFLAGS="-g" + fi +fi + +if test x$GCC = xyes ; then + if test x$fim_cv_warnings = xyes ; then + CXXFLAGS="-Wall -pedantic $CXXFLAGS" + fi +fi + + + +fim_cv_cacalib=no + +# Check whether --enable-cacalib was given. +if test "${enable_cacalib+set}" = set; then : + enableval=$enable_cacalib; if test x$enableval = xyes; then + if test x$have_cacalib = xyes; then + fim_cv_cacalib=yes + else + as_fn_error $? "Sorry, it does not seem like cacalib is installed or detectable. + Please run --disable-cacalib or install cacalib in a system-wide directory instead. + " "$LINENO" 5 + fi + fi +fi + + + +# This code still awaits for integration ... + +# Check whether --with-cflags was given. +if test "${with_cflags+set}" = set; then : + withval=$with_cflags; if test "x$withval" != x; then + +cat >>confdefs.h <<_ACEOF +#define CXXFLAGS "$withval" +_ACEOF + + CXXFLAGS="$withval" + CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS" + +cat >>confdefs.h <<_ACEOF +#define CXXFLAGS "$withval" +_ACEOF + + fi +else + cat >>confdefs.h <<_ACEOF +#define EXECSHELL "/bin/sh" +_ACEOF + +fi + + + + +# This code still awaits for integration ... + +# Check whether --with-exec-shell was given. +if test "${with_exec_shell+set}" = set; then : + withval=$with_exec_shell; if test x$withval != xyes; then + +cat >>confdefs.h <<_ACEOF +#define EXECSHELL "$withval" +_ACEOF + + else + cat >>confdefs.h <<_ACEOF +#define EXECSHELL "/bin/sh" +_ACEOF + + fi +else + cat >>confdefs.h <<_ACEOF +#define EXECSHELL "/bin/sh" +_ACEOF + +fi + + +# Check whether --enable-convert was given. +if test "${enable_convert+set}" = set; then : + enableval=$enable_convert; if test x$enableval = xno; then + fim_cv_smartautcompletion=no + else + fim_cv_smartautcompletion=yes + fi + +else + fim_cv_smartautcompletion=yes + +fi + +if test x$fim_cv_smartautcompletion = xyes; then + $as_echo "#define FIM_SMART_COMPLETION 1" >>confdefs.h + +fi +if test x$fim_cv_scan_consolefonts = xyes; then + $as_echo "#define FIM_LINUX_CONSOLEFONTS_DIR_SCAN 1" >>confdefs.h + +fi + +# Check whether --enable-convert was given. +if test "${enable_convert+set}" = set; then : + enableval=$enable_convert; if test x$enableval = xno; then + fim_cv_convert=no + else + fim_cv_convert=yes + fi + +else + fim_cv_convert=yes + +fi + + + + + +# Check whether --enable-xcftopnm was given. +if test "${enable_xcftopnm+set}" = set; then : + enableval=$enable_xcftopnm; if test x$enableval = xno; then + fim_cv_xcftopnm=no + else + fim_cv_xcftopnm=yes + fi + +else + fim_cv_xcftopnm=yes + +fi + + + +fim_cv_inkscape=yes +# Check whether --enable-inkscape was given. +if test "${enable_inkscape+set}" = set; then : + enableval=$enable_inkscape; if test x$enableval = xno; then + fim_cv_inkscape=no + else + fim_cv_inkscape=yes + fi + +else + fim_cv_inkscape=yes + +fi + + + +# Check whether --enable-xfig was given. +if test "${enable_xfig+set}" = set; then : + enableval=$enable_xfig; if test x$enableval = xno; then + fim_cv_xfig=no + else + fim_cv_xfig=yes + fi + +else + fim_cv_xfig=yes + +fi + + + +# Check whether --enable-dia was given. +if test "${enable_dia+set}" = set; then : + enableval=$enable_dia; if test x$enableval = xno; then + fim_cv_dia=no + else + fim_cv_dia=yes + fi + +else + fim_cv_dia=yes + +fi + + + + +# Check whether --with-default-consolefont was given. +if test "${with_default_consolefont+set}" = set; then : + withval=$with_default_consolefont; cat >>confdefs.h <<_ACEOF +#define FIM_DEFAULT_CONSOLEFONT "$withval" +_ACEOF + +else + fim_cv_defaultconsolefont="" +fi + + +# Check whether --with-custom-hardcoded-consolefont was given. +if test "${with_custom_hardcoded_consolefont+set}" = set; then : + withval=$with_custom_hardcoded_consolefont; +fim_cv_want_custom_hardcoded_consolefont=true; +FIM_CUSTOM_HARDCODED_CONSOLEFONT="$withval" + + +fi + + if test x$fim_cv_want_custom_hardcoded_consolefont = xtrue ; then + FIM_WANT_CUSTOM_HARDCODED_CONSOLEFONT_TRUE= + FIM_WANT_CUSTOM_HARDCODED_CONSOLEFONT_FALSE='#' +else + FIM_WANT_CUSTOM_HARDCODED_CONSOLEFONT_TRUE='#' + FIM_WANT_CUSTOM_HARDCODED_CONSOLEFONT_FALSE= +fi + + +# Check whether --with-tmpfile was given. +if test "${with_tmpfile+set}" = set; then : + withval=$with_tmpfile; fim_cv_tmpfile=$withval +else + fim_cv_tmpfile="/tmp/__FIM_TEMPORARY_FILE" +fi + +# Check whether --enable-custom-status-bar was given. +if test "${enable_custom_status_bar+set}" = set; then : + enableval=$enable_custom_status_bar; if test x$enableval = xno; then + fim_cv_custom_status_bar=no; + else + fim_cv_custom_status_bar=yes; + fi + +else + fim_cv_custom_status_bar=yes; + +fi + + +# Check whether --enable-optimizations was given. +if test "${enable_optimizations+set}" = set; then : + enableval=$enable_optimizations; if test x$enableval = xno; then + fim_cv_optimizations=no + else + fim_cv_optimizations=yes + fi + +else + fim_cv_optimizations=no + +fi + + + + + + + + + + + +# Extract the first word of "zcat", so it can be a program name with args. +set dummy zcat; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_have_zcat+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$have_zcat"; then + ac_cv_prog_have_zcat="$have_zcat" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_have_zcat="yes" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_have_zcat" && ac_cv_prog_have_zcat="no" +fi +fi +have_zcat=$ac_cv_prog_have_zcat +if test -n "$have_zcat"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_zcat" >&5 +$as_echo "$have_zcat" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test x$have_zcat = xyes ; then + # legacy fbi feature : should not rely on this. FIXME + { $as_echo "$as_me:${as_lineno-$LINENO}: Fim will use 'zcat' to uncompress \"gzipped\" font files." >&5 +$as_echo "$as_me: Fim will use 'zcat' to uncompress \"gzipped\" font files." >&6;} + $as_echo "#define FIM_USE_ZCAT 1" >>confdefs.h + + fi + + +# Extract the first word of "convert", so it can be a program name with args. +set dummy convert; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_have_convert+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$have_convert"; then + ac_cv_prog_have_convert="$have_convert" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_have_convert="yes" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_have_convert" && ac_cv_prog_have_convert="no" +fi +fi +have_convert=$ac_cv_prog_have_convert +if test -n "$have_convert"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_convert" >&5 +$as_echo "$have_convert" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test x$have_convert = xyes -a x$fim_cv_convert = xyes ; then + true + else + fim_cv_convert=no + fi + +# Extract the first word of "xcftopnm", so it can be a program name with args. +set dummy xcftopnm; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_have_xcftopnm+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$have_xcftopnm"; then + ac_cv_prog_have_xcftopnm="$have_xcftopnm" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_have_xcftopnm="yes" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_have_xcftopnm" && ac_cv_prog_have_xcftopnm="no" +fi +fi +have_xcftopnm=$ac_cv_prog_have_xcftopnm +if test -n "$have_xcftopnm"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_xcftopnm" >&5 +$as_echo "$have_xcftopnm" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test x$have_xcftopnm = xyes -a x$fim_cv_xcftopnm = xyes ; then + true + else + fim_cv_xcftopnm=no + fi + +# Extract the first word of "inkscape", so it can be a program name with args. +set dummy inkscape; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_have_inkscape+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$have_inkscape"; then + ac_cv_prog_have_inkscape="$have_inkscape" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_have_inkscape="yes" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_have_inkscape" && ac_cv_prog_have_inkscape="no" +fi +fi +have_inkscape=$ac_cv_prog_have_inkscape +if test -n "$have_inkscape"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_inkscape" >&5 +$as_echo "$have_inkscape" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test x$have_inkscape = xyes -a x$fim_cv_inkscape = xyes ; then + true + else + fim_cv_inkscape=no + fi + +# Extract the first word of "fig2dev", so it can be a program name with args. +set dummy fig2dev; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_have_xfig+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$have_xfig"; then + ac_cv_prog_have_xfig="$have_xfig" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_have_xfig="yes" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_have_xfig" && ac_cv_prog_have_xfig="no" +fi +fi +have_xfig=$ac_cv_prog_have_xfig +if test -n "$have_xfig"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_xfig" >&5 +$as_echo "$have_xfig" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test x$have_xfig = xyes -a x$fim_cv_xfig = xyes ; then + true + else + fim_cv_xfig=no + fi + +# Extract the first word of "dia", so it can be a program name with args. +set dummy dia; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_have_dia+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$have_dia"; then + ac_cv_prog_have_dia="$have_dia" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_have_dia="yes" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_have_dia" && ac_cv_prog_have_dia="no" +fi +fi +have_dia=$ac_cv_prog_have_dia +if test -n "$have_dia"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_dia" >&5 +$as_echo "$have_dia" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test x$have_dia = xyes -a x$fim_cv_dia = xyes ; then + true + else + fim_cv_dia=no + fi + + + if test x$fim_cv_optimizations = xyes ; then + uname=`uname` + if test x$uname = xLinux ; then + if grep "^model name.*Pentium(R) 4" /proc/cpuinfo > /dev/null; then + CXXFLAGS="$CXXFLAGS -march=native" + fi + + else + { $as_echo "$as_me:${as_lineno-$LINENO}: uhm. try to specify your own optimizations.." >&5 +$as_echo "$as_me: uhm. try to specify your own optimizations.." >&6;} + + fi + fi + + if test x$fim_want_cxx11 = xyes ; then + $as_echo "#define FIM_USE_CXX11 1" >>confdefs.h + + fi + + if test x$fim_cv_convert = xyes ; then + $as_echo "#define FIM_TRY_CONVERT 1" >>confdefs.h + + fi + + if test x$fim_cv_xcftopnm = xyes ; then + $as_echo "#define FIM_TRY_XCFTOPNM 1" >>confdefs.h + + fi + + if test x$fim_cv_inkscape = xyes ; then + $as_echo "#define FIM_TRY_INKSCAPE 1" >>confdefs.h + + fi + + if test x$have_xfig = xyes ; then + $as_echo "#define FIM_TRY_XFIG 1" >>confdefs.h + + fi + + if test x$have_dia = xyes ; then + $as_echo "#define FIM_TRY_DIA 1" >>confdefs.h + + fi + + + + if test x$fim_cv_libjasper = xyes ; then + $as_echo "#define FIM_WITH_LIBJASPER 1" >>confdefs.h + + fi + + + if test x$fim_cv_libexif = xyes ; then + $as_echo "#define FIM_WITH_LIBEXIF 1" >>confdefs.h + + fi + + + if test x$fim_cv_aalib = xyes ; then + $as_echo "#define FIM_WITH_AALIB 1" >>confdefs.h + + fi + + + + if test x$fim_cv_cacalib = xyes ; then + $as_echo "#define FIM_WITH_CACALIB 1" >>confdefs.h + + LIBS="$LIBS -lcaca" + fi + + + if test x$fim_cv_seek_magic = xyes ; then + $as_echo "#define FIM_WANT_SEEK_MAGIC 1" >>confdefs.h + + fi + + + if test x$fim_cv_custom_status_bar = xyes ; then + $as_echo "#define FIM_WANT_CUSTOM_INFO_STATUS_BAR 1" >>confdefs.h + + fi + + +# Check whether --enable-mark-and-dump was given. +if test "${enable_mark_and_dump+set}" = set; then : + enableval=$enable_mark_and_dump; if test x$enableval = xyes; then fim_cv_want_mark_and_dump=1 ; else fim_cv_want_mark_and_dump=0 ; fi +else + fim_cv_want_mark_and_dump=1 +fi + + +cat >>confdefs.h <<_ACEOF +#define FIM_WANT_FILENAME_MARK_AND_DUMP $fim_cv_want_mark_and_dump +_ACEOF + + +# Check whether --enable-scripting was given. +if test "${enable_scripting+set}" = set; then : + enableval=$enable_scripting; if test x$enableval = xyes; then fim_cv_want_noscripting=0 ; else fim_cv_want_noscripting=1 ; fi +else + fim_cv_want_noscripting=0 +fi + +if test x$fim_cv_want_noscripting == x1 ; then + +cat >>confdefs.h <<_ACEOF +#define FIM_WANT_NOSCRIPTING $fim_cv_want_noscripting +_ACEOF + +fi + +# Check whether --enable-output-console was given. +if test "${enable_output_console+set}" = set; then : + enableval=$enable_output_console; if test x$enableval = xyes; then fim_cv_want_no_output_console=0 ; else fim_cv_want_no_output_console=1 ; fi +else + fim_cv_want_no_output_console=0 +fi + +if test x$fim_cv_want_no_output_console == x1 ; then + +cat >>confdefs.h <<_ACEOF +#define FIM_WANT_NO_OUTPUT_CONSOLE $fim_cv_want_no_output_console +_ACEOF + +fi + +# Check whether --enable-unicode was given. +if test "${enable_unicode+set}" = set; then : + enableval=$enable_unicode; if test x$enableval = xyes; then fim_cv_want_unicode=1 ; else fim_cv_want_unicode=0 ; fi +else + fim_cv_want_unicode=0 +fi + +if test x$fim_cv_want_unicode == x1 ; then + # CXXFLAGS="$CXXFLAGS `freetype-config --cflags`" + # LIBS="$LIBS `freetype-config --libs`" + +cat >>confdefs.h <<_ACEOF +#define FIM_WANT_UNICODE $fim_cv_want_unicode +_ACEOF + +fi + +fim_want_astext=yes +# Check whether --enable-as-text-rendering was given. +if test "${enable_as_text_rendering+set}" = set; then : + enableval=$enable_as_text_rendering; if test x$enableval = xno ; then + fim_want_astext=no + fi + +fi + +if test x$fim_want_astext = xyes ; then + +cat >>confdefs.h <<_ACEOF +#define FIM_WANT_TEXT_RENDERING 1 +_ACEOF + +fi + +fim_want_rbr=yes +# Check whether --enable-raw-bits-rendering was given. +if test "${enable_raw_bits_rendering+set}" = set; then : + enableval=$enable_raw_bits_rendering; if test x$enableval = xno ; then + fim_want_rbr=no + fi + +fi + +if test x$fim_want_rbr = xyes ; then + +cat >>confdefs.h <<_ACEOF +#define FIM_WANT_RAW_BITS_RENDERING 1 +_ACEOF + +fi + +fim_want_lss=yes +# Check whether --enable-loader-string-specification was given. +if test "${enable_loader_string_specification+set}" = set; then : + enableval=$enable_loader_string_specification; if test x$enableval = xno ; then + fim_want_lss=no + fi + +fi + +if test x$fim_want_lss = xyes ; then + +cat >>confdefs.h <<_ACEOF +#define FIM_ALLOW_LOADER_STRING_SPECIFICATION 1 +_ACEOF + +fi + +ac_config_headers="$ac_config_headers config.h" + + + + +$as_echo "#define FIM_RANDOM 1" >>confdefs.h + + +$as_echo "#define FIM_DEFAULT_CONFIG 1" >>confdefs.h + + +$as_echo "#define FIM_NOFB 1" >>confdefs.h + + +$as_echo "#define FIM_RECORDING 1" >>confdefs.h + + +$as_echo "#define FIM_SWITCH_FIXUP 1" >>confdefs.h + + +$as_echo "#define FIM_CHECK_DUPLICATES 1" >>confdefs.h + + +$as_echo "#define FIM_CHECK_FILE_EXISTENCE 1" >>confdefs.h + + +$as_echo "#define FIM_REMOVE_FAILED 1" >>confdefs.h + + +$as_echo "#define FIM_AUTOSKIP_FAILED 1" >>confdefs.h + + +$as_echo "#define FIM_COMMAND_AUTOCOMPLETION 1" >>confdefs.h + + +$as_echo "#define FIM_NAMESPACES 1" >>confdefs.h + + + + +cat >>confdefs.h <<_ACEOF +#define FIM_VERSION "${VERSION}" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define FIM_TMP_FILENAME "$fim_cv_tmpfile" +_ACEOF + + +$as_echo "#define FIM_ITERATED_COMMANDS 1" >>confdefs.h + + +$as_echo "#define FIM_SKIP_KNOWN_FILETYPES 1" >>confdefs.h + + +$as_echo "#define FIM_EXPERIMENTAL_ROTATION 1" >>confdefs.h + + + +$as_echo "#define FIM_PIPE_IMAGE_READ 1" >>confdefs.h + + + + + + + +$as_echo "#define FIM_AUTHOR_NAME \"Michele Martone\"" >>confdefs.h + +$as_echo "#define FIM_AUTHOR_EMAIL \"\"" >>confdefs.h + +$as_echo "#define FIM_AUTHOR \"Michele Martone \"" >>confdefs.h + +# Note: Gerd changed his surname from Knorr to Hoffmann, so I report here his actual surname +$as_echo "#define FBI_AUTHOR_NAME \"Gerd Hoffmann\"" >>confdefs.h + +$as_echo "#define FBI_AUTHOR \"Gerd Hoffmann \"" >>confdefs.h + +# Check whether --enable-matrices-rendering was given. +if test "${enable_matrices_rendering+set}" = set; then : + enableval=$enable_matrices_rendering; if test x$enableval = xyes; then + if test x$ac_cv_func_rsb_lib_init = xyes; then + +$as_echo "#define HAVE_MATRIX_MARKET_DECODER 1" >>confdefs.h + +#CXXFLAGS="$CXXFLAGS `librsb-config --cflags`" +#LIBS="$LIBS `librsb-config --static --ldflags | sed s/-static//g`" + else + as_fn_error $? "Cannot detect librsb! Either disable matrix rendering or supply the right LIBS and CXXFLAGS!" "$LINENO" 5 + fi + else + true; + fi + +fi + + + + + + + + +FIM_SVN_REPOSITORY=http://svn.savannah.nongnu.org/svn/fbi-improved/ + + + + +#AC_CONFIG_FILES([Makefile],[src/Makefile]) + +ac_config_files="$ac_config_files Makefile src/Makefile doc/Makefile distros/Makefile scripts/Makefile scripts/maintenance/cron-build.sh scripts/maintenance/remote-build.sh scripts/maintenance/cron-svndump.pl scripts/maintenance/cron-rsync.sh" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + as_fn_error $? "conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + if test -n "$EXEEXT"; then + am__EXEEXT_TRUE= + am__EXEEXT_FALSE='#' +else + am__EXEEXT_TRUE='#' + am__EXEEXT_FALSE= +fi + +if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then + as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +if test -z "${ENABLE_GIF_TRUE}" && test -z "${ENABLE_GIF_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_GIF\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_TIFF_TRUE}" && test -z "${ENABLE_TIFF_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_TIFF\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_JPEG_TRUE}" && test -z "${ENABLE_JPEG_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_JPEG\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_PS_TRUE}" && test -z "${ENABLE_PS_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_PS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_DJVU_TRUE}" && test -z "${ENABLE_DJVU_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_DJVU\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_POPPLER_TRUE}" && test -z "${ENABLE_POPPLER_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_POPPLER\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_PDF_TRUE}" && test -z "${ENABLE_PDF_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_PDF\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${FIM_WANT_HARDCODED_CONSOLEFONT_TRUE}" && test -z "${FIM_WANT_HARDCODED_CONSOLEFONT_FALSE}"; then + as_fn_error $? "conditional \"FIM_WANT_HARDCODED_CONSOLEFONT\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${FIM_WANT_CUSTOM_HARDCODED_CONSOLEFONT_TRUE}" && test -z "${FIM_WANT_CUSTOM_HARDCODED_CONSOLEFONT_FALSE}"; then + as_fn_error $? "conditional \"FIM_WANT_CUSTOM_HARDCODED_CONSOLEFONT\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by fim $as_me 0.5-rc3, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_version="\\ +fim config.status 0.5-rc3 +configured by $0, generated by GNU Autoconf 2.69, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2012 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' +AWK='$AWK' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# +# INIT-COMMANDS +# +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; + "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; + "distros/Makefile") CONFIG_FILES="$CONFIG_FILES distros/Makefile" ;; + "scripts/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/Makefile" ;; + "scripts/maintenance/cron-build.sh") CONFIG_FILES="$CONFIG_FILES scripts/maintenance/cron-build.sh" ;; + "scripts/maintenance/remote-build.sh") CONFIG_FILES="$CONFIG_FILES scripts/maintenance/remote-build.sh" ;; + "scripts/maintenance/cron-svndump.pl") CONFIG_FILES="$CONFIG_FILES scripts/maintenance/cron-svndump.pl" ;; + "scripts/maintenance/cron-rsync.sh") CONFIG_FILES="$CONFIG_FILES scripts/maintenance/cron-rsync.sh" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$ac_tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +$as_echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi +# Compute "$ac_file"'s index in $config_headers. +_am_arg="$ac_file" +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || +$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$_am_arg" : 'X\(//\)[^/]' \| \ + X"$_am_arg" : 'X\(//\)$' \| \ + X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$_am_arg" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'`/stamp-h$_am_stamp_count + ;; + + :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +$as_echo "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "depfiles":C) test x"$AMDEP_TRUE" != x"" || { + # Autoconf 2.62 quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + case $CONFIG_FILES in + *\'*) eval set x "$CONFIG_FILES" ;; + *) set x $CONFIG_FILES ;; + esac + shift + for mf + do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`$as_dirname -- "$mf" || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`$as_dirname -- "$file" || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir=$dirpart/$fdir; as_fn_mkdir_p + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done + done +} + ;; + + esac +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + +#AC_OUTPUT + +{ $as_echo "$as_me:${as_lineno-$LINENO}: + Fim v${VERSION} has been configured as follows (features marked with * are not recommended: either unfinished or broken: please do NOT use them when building for a distro): + + default minimal key mapping : ${have_default_mapping:-no} + default minimal key bindings : ${have_default_bindings:-no} + default configuration file builtin : ${have_default_config:-no} + resize optimizations : ${fim_cv_resize_optimizations:-no} + system,popen calls wrappers enabled : ${fim_system_calls:-yes} + will allow push of directories : ${fim_cv_read_dirs} + will recurse directories (-R switch): ${fim_cv_recursive_dirs} + patch for running under screen : ${fim_cv_screen:-no} + ~/.fimrc startup file support : ${have_fimrc:-no} + ~/.fim_history load/save support : ${have_history:-no} + autocommands enabled : ${have_autocommands:-no} + hardcoded PSF font (FBFONT=fim://) : ${have_hardcoded_font:-no} + will read image files from stdin(-i): ${fim_cv_read_stdin_image:-no} + GNU regexps (default is Posix) :*${fim_cv_regex:-no} + seek magic signatures :*${fim_cv_seek_magic:-no} + customizable status bar : ${fim_cv_custom_status_bar:-no} + use C++11 constructs (internals) : ${fim_want_cxx11} + readline (-lrl) library support : ${fim_want_readline} + use 'xcftopnm' for XCF files :*${fim_cv_xcftopnm} + use 'inkscape' for SVG files : ${fim_cv_inkscape} + use 'fig2dev' for FIG files : ${fim_cv_xfig} + use 'convert' for unrecognized files:*${fim_cv_convert} + use 'exiftool' for EXIF tags in JPEG:*${fim_cv_exiftool} + framebuffer (built-in) support : ${fim_handle_framebuffer:-yes} + X (sdllib) support (-o sdl) : ${fim_handle_sdl} + ASCII art (aalib) support (-o aa) : ${fim_cv_aalib} + X (Imlib2) support(-o imlib2):*${fim_handle_imlib2:-no} + coloured ASCII art (cacalib) support:*${fim_cv_cacalib} + EXIF (JPEG) tags support (libexif) : ${fim_cv_libexif} + BMP file support (builtin) : ${fim_handle_bmp:-no} + JP2 (JPEG-2K) file support (JasPer) : ${fim_cv_libjasper} + PCX file support (builtin) : ${fim_handle_pcx:-no} + PNG file support (libpng) : ${fim_handle_png:-no} + JPEG file support (libjpeg) : ${fim_handle_jpeg:-no} + TIFF file support (libtiff) : ${fim_handle_tiff:-no} + GIF file support (libgif) : ${fim_handle_gif:-no} + DJVU file support (libdjvu) :*${fim_handle_djvu:-no} + PDF file support (libpoppler) :*${fim_handle_pdf:-no} + PS file support (libspectre) :*${fim_handle_ps:-no} + NEF/RAW file support (libufraw) :*${fim_handle_ufraw:-no} + TAR/ZIP/.. file support (libarchive):*${fim_handle_archive:-no} + GraphicsMagick support (libGraphicsMagick):*${fim_handle_graphicsmagick:-no} + + If you are not satisfied with this configuration, please invoke + ./configure --help=short + for a complete list of configure options specific to Fim. + When you are satisfied, run 'make' to build Fim and its documentation. + To install the program and its documentation, run 'make install' if you are root, + or run 'su -c '\"make install\"' if you are not root. + RTFM: README, man fim, man fimrc. Enjoy! +" >&5 +$as_echo "$as_me: + Fim v${VERSION} has been configured as follows (features marked with * are not recommended: either unfinished or broken: please do NOT use them when building for a distro): + + default minimal key mapping : ${have_default_mapping:-no} + default minimal key bindings : ${have_default_bindings:-no} + default configuration file builtin : ${have_default_config:-no} + resize optimizations : ${fim_cv_resize_optimizations:-no} + system,popen calls wrappers enabled : ${fim_system_calls:-yes} + will allow push of directories : ${fim_cv_read_dirs} + will recurse directories (-R switch): ${fim_cv_recursive_dirs} + patch for running under screen : ${fim_cv_screen:-no} + ~/.fimrc startup file support : ${have_fimrc:-no} + ~/.fim_history load/save support : ${have_history:-no} + autocommands enabled : ${have_autocommands:-no} + hardcoded PSF font (FBFONT=fim://) : ${have_hardcoded_font:-no} + will read image files from stdin(-i): ${fim_cv_read_stdin_image:-no} + GNU regexps (default is Posix) :*${fim_cv_regex:-no} + seek magic signatures :*${fim_cv_seek_magic:-no} + customizable status bar : ${fim_cv_custom_status_bar:-no} + use C++11 constructs (internals) : ${fim_want_cxx11} + readline (-lrl) library support : ${fim_want_readline} + use 'xcftopnm' for XCF files :*${fim_cv_xcftopnm} + use 'inkscape' for SVG files : ${fim_cv_inkscape} + use 'fig2dev' for FIG files : ${fim_cv_xfig} + use 'convert' for unrecognized files:*${fim_cv_convert} + use 'exiftool' for EXIF tags in JPEG:*${fim_cv_exiftool} + framebuffer (built-in) support : ${fim_handle_framebuffer:-yes} + X (sdllib) support (-o sdl) : ${fim_handle_sdl} + ASCII art (aalib) support (-o aa) : ${fim_cv_aalib} + X (Imlib2) support(-o imlib2):*${fim_handle_imlib2:-no} + coloured ASCII art (cacalib) support:*${fim_cv_cacalib} + EXIF (JPEG) tags support (libexif) : ${fim_cv_libexif} + BMP file support (builtin) : ${fim_handle_bmp:-no} + JP2 (JPEG-2K) file support (JasPer) : ${fim_cv_libjasper} + PCX file support (builtin) : ${fim_handle_pcx:-no} + PNG file support (libpng) : ${fim_handle_png:-no} + JPEG file support (libjpeg) : ${fim_handle_jpeg:-no} + TIFF file support (libtiff) : ${fim_handle_tiff:-no} + GIF file support (libgif) : ${fim_handle_gif:-no} + DJVU file support (libdjvu) :*${fim_handle_djvu:-no} + PDF file support (libpoppler) :*${fim_handle_pdf:-no} + PS file support (libspectre) :*${fim_handle_ps:-no} + NEF/RAW file support (libufraw) :*${fim_handle_ufraw:-no} + TAR/ZIP/.. file support (libarchive):*${fim_handle_archive:-no} + GraphicsMagick support (libGraphicsMagick):*${fim_handle_graphicsmagick:-no} + + If you are not satisfied with this configuration, please invoke + ./configure --help=short + for a complete list of configure options specific to Fim. + When you are satisfied, run 'make' to build Fim and its documentation. + To install the program and its documentation, run 'make install' if you are root, + or run 'su -c '\"make install\"' if you are not root. + RTFM: README, man fim, man fimrc. Enjoy! +" >&6;} diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..b600f50 --- /dev/null +++ b/configure.ac @@ -0,0 +1,1951 @@ +dnl Process this file with autoconf to produce a configure script. +dnl $LastChangedDate: 2017-07-19 15:46:18 +0200 (Wed, 19 Jul 2017) $ + +AC_PREREQ([2.54]) + +# we'll move forward, one day or another +#AC_PREREQ([2.61]) + +# for future use, too +#AC_PROG_CC(cc gcc) +#AC_PROG_CXX(CC g++ gcc c++ cxx) + +define([svnversion],esyscmd([sh -c "svnversion | tr -c '[0-9]' ' ' | sed 's/ *//g;s/^$/-1/g' "]))dnl +# WARNING : here 0.0 denotes the package version, which will be corrected some lines after this. +AC_INIT([fim],[0.5-rc3],[dezperado_FOobAr_autistici_Baz_org, by replacing _FOobAr_ with a @ and _Baz_ with a .]) +AC_CONFIG_SRCDIR([src/fim.cpp]) + +if test x"svnversion" != x ; then + # The above test gets evaluated when creating the configure script. + AC_DEFINE(SVN_REVISION,"svnversion",[SVN REVISION]) + AC_SUBST(SVN_REVISION,"svnversion") + AC_DEFINE(SVN_REVISION_NUMBER,svnversion,[SVN REVISION NUMBER]) + AC_SUBST(SVN_REVISION_NUMBER,svnversion) +fi + +AH_TEMPLATE([FIM_CONFIGURATION]) +FIM_CONFIGURATION="$0 $@" +AC_SUBST(FIM_CONFIGURATION) +AC_DEFINE_UNQUOTED([FIM_CONFIGURATION],"$FIM_CONFIGURATION") + +AC_MSG_NOTICE([ + Welcome to the Fim (revision $SVN_REVISION) configure script! + This script will create the right Makefile for building Fim on your system. + But first, it will check if your system has the right configuration for Fim to build. + + There are options to this script, please run : + ./configure --help=short + for a complete list of these options. + + Please read BUGS and README and report any bug found to the Fim maintainer! +]) + + +#AM_CONFIG_HEADER([config.h]) +#AC_CONFIG_SRCDIR(pinentry/pinentry.h) + +# +#AM_INIT_AUTOMAKE($PACKAGE_NAME, $PACKAGE_VERSION) +AC_GNU_SOURCE +#AC_MANTAINER_MODE +#AC_CANONICAL_HOST + +#missing_dir=`cd $ac_aux_dir && pwd` +#AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) +#AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) +#AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) +#AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) +#AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) + + + +AC_PROG_CC +AC_PROG_CPP +AC_PROG_YACC +AC_PROG_LEX + +AC_PROG_INSTALL +AC_PROG_RANLIB + +AC_REVISION([$Revision$]) + +AC_PROG_CXX +#AC_PROG_CXXCPP +AC_CHECK_TOOL(AR, ar, ar) +fim_cv_version=`cat $srcdir/VERSION` +AC_LANG([C++]) +#AC_LANG_PUSH([C++]) +AM_INIT_AUTOMAKE +#AM_INIT_AUTOMAKE(fim, $fim_cv_version) +#AM_INIT_AUTOMAKE(fim, 1.0) +AC_SUBST([CONFIG_STATUS_DEPENDENCIES], ['$(top_srcdir)/VERSION']) +CPPFLAGS='' + + +AC_SUBST(FIM_LIBS) +AC_SUBST(FIM_LIB_OBJECTS) +AC_SUBST(VERSION) +dnl AC_SUBST(HTMLDOCS) +#AC_LANG_POP([C++]) + +fim="fim" +AC_MSG_CHECKING([for prefix]) +if test x$prefix = xNONE; then + fim_cv_prefix=$ac_default_prefix +else + fim_cv_prefix=$prefix +fi +AC_MSG_RESULT($fim_cv_prefix) + +AC_ISC_POSIX +#AM_C_PROTOTYPES +if test "x$U" != "x"; then + AC_MSG_ERROR(Compiler not ANSI compliant) +fi +#AC_PROG_CPP +AC_PROG_MAKE_SET + +AC_C_INLINE +AC_C_CONST + +AC_SYS_LARGEFILE +AC_FUNC_FSEEKO +AC_CHECK_SIZEOF(off_t) +AM_MAINTAINER_MODE + +AH_TEMPLATE([HAVE_GETENV]) +AC_CHECK_FUNC([getenv], AC_DEFINE([HAVE_GETENV], [1], [If present, the getenv function allows fim to read environment variables.])) +AC_CHECK_FUNC([getline], AC_DEFINE([HAVE_GETLINE], [1], [If present, will be used for stdin reading. (on GNU)])) +AC_CHECK_FUNC([fgetln], AC_DEFINE([HAVE_FGETLN], [1], [If present, fgetln() will be used as a replacement for getline(). (on BSD)])) +AC_CHECK_FUNC([get_current_dir_name], AC_DEFINE([HAVE_GET_CURRENT_DIR_NAME], [1], [Should live when _GNU_SOURCE, but it could be not the case.])) +AC_CHECK_FUNC([rsb_lib_init]) + +AC_CHECK_LIB([m],[pow]) +AC_CHECK_LIB([fl],[yylex]) +AC_ARG_ENABLE(graphicsmagick, AC_HELP_STRING([--enable-graphicsmagick], [Enable GraphicsMagick library support (EXPERIMENTAL).]), [ if test x$enableval != xno ; then fim_handle_graphicsmagick=yes ; fi ] ) +AC_CHECK_LIB([GraphicsMagick],[GetMagickVersion], + [ +if test x"$fim_handle_graphicsmagick" = x"yes" ; then + FIM_LIB_OBJECTS="$FIM_LIB_OBJECTS FbiStuffMagick.o"; + LIBS="$LIBS `GraphicsMagick-config --cppflags --ldflags --libs|tr '\n' ' '` "; + CXXFLAGS="$CXXFLAGS `GraphicsMagick-config --cppflags |tr '\n' ' '` "; + AC_DEFINE([HAVE_LIBGRAPHICSMAGICK],[1],[We have libGraphicsMagick]) +fi + ], []) + +AC_ARG_ENABLE(imlib2, AC_HELP_STRING([--enable-imlib2], [Enable Imlib2 library support (EXPERIMENTAL,INCOMPLETE).]), [ if test x$enableval != xno ; then fim_handle_imlib2=yes ; fi ] ) +AC_CHECK_LIB([Imlib2],[imlib_create_image], + [ +if test x"$fim_handle_imlib2" = x"yes" ; then + FIM_LIB_OBJECTS="$FIM_LIB_OBJECTS Imlib2Device.o"; + LIBS="$LIBS `imlib2-config --libs|tr '\n' ' '` "; + CXXFLAGS="$CXXFLAGS `imlib2-config --cflags |tr '\n' ' '` "; + AC_DEFINE([FIM_WITH_LIBIMLIB2],[1],[We have libImlib]) +fi + ], []) + +AC_CHECK_PROG([HAVE_FLEX],[flex],[yes],[no]) +AC_CHECK_PROG([HAVE_BISON],[bison],[yes],[no]) +if test x$HAVE_FLEX != x"yes" ; then + AC_MSG_ERROR([No flex (lexical analyser generator) executable detected!]) ; +fi +if test x$HAVE_BISON != x"yes" ; then + AC_MSG_ERROR([No bison (parser generator) executable detected!]) ; +fi + +AC_CHECK_PROG([HAVE_ECHO],[echo],[yes],[no]) +AC_CHECK_PROG([HAVE_RM],[rm],[yes],[no]) +AC_CHECK_PROG([HAVE_SED],[sed],[yes],[no]) +AC_CHECK_PROG([HAVE_GREP],[grep],[yes],[no]) +AC_CHECK_PROG([HAVE_SORT],[sort],[yes],[no]) +AC_CHECK_PROG([HAVE_CPP],[cpp],[yes],[no]) +AC_CHECK_PROG([HAVE_AWK],[awk],[yes],[no]) +AC_CHECK_PROG([HAVE_CAT],[cat],[yes],[no]) +AC_CHECK_PROG([HAVE_MAN],[man],[yes],[no]) +#AC_CHECK_PROG([HAVE_WHICH],[which],[yes],[no]) +#AC_CHECK_PROG([HAVE_GPG],[gpg],[yes],[no]) +#AC_CHECK_PROG([HAVE_LS],[ls],[yes],[no]) +#AC_CHECK_PROG([HAVE_CD],[cd],[yes],[no]) +#AC_CHECK_PROG([HAVE_CC],[cc],[yes],[no]) +AC_PATH_PROG([RM],[rm],[no]) +AC_PATH_PROG([SED],[sed],[no]) +AC_PATH_PROG([GREP],[grep],[no]) +AC_PATH_PROG([ECHO],[echo],[no]) +AC_PATH_PROG([SORT],[sort],[no]) +AC_PATH_PROG([CPP],[cpp],[no]) +AC_PATH_PROG([AWK],[awk],[no]) +AC_PATH_PROG([CAT],[cat],[no]) +AC_PATH_PROG([MAN],[man],[no]) +#AC_PATH_PROG([CC],[cc],[no]) +#AC_PATH_PROG([WHICH],[which],[no]) +#AC_PATH_PROG([GPG],[gpg],[no]) +#AC_PATH_PROG([LS],[ls],[no]) +#AC_PATH_PROG([CD],[cd],[no]) +# FIXME: what if we have no grep and/or no sed ? +# (echo is often a shell builtin) +have_default_bindings=yes +have_default_mapping=yes +have_default_config=yes + +AC_ARG_ENABLE(default_bindings, AC_HELP_STRING([--disable-default-bindings], [Builtin default minimal key binding]), +[ if test x$enableval = xyes; then + have_default_bindings=yes + else + have_default_bindings=no + fi +]) + +AC_ARG_ENABLE(default_mapping, AC_HELP_STRING([--disable-default-mapping], [Builtin default minimal key mapping]), +[ if test x$enableval = xyes; then + have_default_mapping=yes + else + have_default_mapping=no + fi +]) + +AC_ARG_ENABLE(default_config, AC_HELP_STRING([--disable-default-config], [Builtin default minimal configuration]), +[ if test x$enableval = xyes; then + have_default_config=yes + else + have_default_config=no + fi +]) + + AH_TEMPLATE([FIM_DEFAULT_CONFIG]) + if test x$have_default_bindings != xno; then + FIM_DEFS="$FIM_DEFS -D FIM_DEFAULT_CONFIG" + AC_DEFINE([FIM_DEFAULT_CONFIG]) + fi + AH_TEMPLATE([FIM_DEFAULT_KEY_CONFIG]) + if test x$have_default_mapping != xno; then + FIM_DEFS="$FIM_DEFS -D FIM_DEFAULT_KEY_CONFIG" + AC_DEFINE([FIM_DEFAULT_KEY_CONFIG]) + fi + AH_TEMPLATE([FIM_DEFAULT_CONFIGURATION]) + if test x$have_default_config != xno; then + FIM_DEFS="$FIM_DEFS -D FIM_DEFAULT_CONFIGURATION" + AC_DEFINE([FIM_DEFAULT_CONFIGURATION]) + fi + +#CPPFLAGS=$DEPS +#AC_SUBST(LIBSDL_CXXFLAGS) +#AC_SUBST(LIBPNG_CXXFLAGS) +#AC_SUBST(LIBSDL_CXXFLAGS) +#AC_SUBST(LIBPNG_CXXFLAGS) +#AC_SUBST(LIBPNG_LIBS) + +AC_ARG_ENABLE(system, AC_HELP_STRING([--disable-system], [Disable system() and pipe() calls.]), +[ if test x$enableval = xno ; then + fim_system_calls=no + fi +]) + +dnl new: +AC_ARG_ENABLE(framebuffer, AC_HELP_STRING([--disable-framebuffer], [Disable the framebuffer device driver.]), +[ if test x$enableval = xno ; then + fim_handle_framebuffer=no + fi +]) + +AC_MSG_NOTICE([Checking for headers required by the Linux framebuffer device.]) +AC_CHECK_HEADERS([linux/fb.h], [break], AC_MSG_WARN([[Cannot find linux/fb.h. Fim Linux framebuffer driver requires it!.]])) +AC_CHECK_HEADERS([linux/vt.h], [break], AC_MSG_WARN([[Cannot find linux/vt.h. Fim Linux framebuffer driver requires it!.]])) +AC_CHECK_HEADERS([linux/kd.h], [break], AC_MSG_WARN([[Cannot find linux/kd.h. Fim Linux framebuffer driver requires it!.]])) + +if test x$ac_cv_header_linux_fb_h != xyes -o \ + x$ac_cv_header_linux_vt_h != xyes -o \ + x$ac_cv_header_linux_kd_h != xyes ; then + AC_MSG_WARN([Turning off Linux framebuffer support due to missing headers]) + fim_handle_framebuffer=no +fi + +if test x$fim_handle_framebuffer = xno ; then + AC_DEFINE(FIM_WITH_NO_FRAMEBUFFER, 1, [Defined when framebuffer device support is turned off.]) +fi + +AC_HEADER_STDC +AC_FUNC_MMAP + +AC_CHECK_FUNCS([bzero memset memcmp strncmp strcpy]) +AC_CHECK_FUNCS([bcopy bcmp]) +AC_CHECK_FUNCS([drand48 random rand]) +AC_CHECK_FUNCS([fileno]) +AC_CHECK_FUNCS([fmemopen]) +dnl AC_FUNC_REALLOC() dnl triggers error in automake 1.10.1 + +#AC_CHECK_HEADERS([stddef.h]) +#AC_CHECK_HEADERS([stdlib.h]) +AC_CHECK_HEADERS([string.h strings.h], [AC_CHECK_FUNCS(strerror)]) + + +AC_CHECK_HEADERS([stdint.h]) +AC_CHECK_HEADERS([wchar.h]) +AC_CHECK_HEADERS([fontconfig/fontconfig.h]) +AC_CHECK_HEADERS([fontconfig/fcfreetype.h]) + +AC_HEADER_DIRENT() +AC_CHECK_HEADERS([stdarg.h sys/ioctl.h ioctl.h sysexits.h]) +AC_CHECK_HEADERS([sys/time.h sys/resource.h]) +AC_CHECK_HEADERS([unix.h]) +AC_CHECK_HEADERS([libgen.h]) +AC_CHECK_HEADERS([sys/user.h]) +AC_CHECK_HEADERS([sys/mman.h]) +AC_CHECK_HEADERS([cstdio stdio.h], [break],AC_MSG_ERROR([[Cannot find cstdio or stdio.h. Fim requires at least one or the other.]])) + +AC_CHECK_HEADERS([climits limits.h], [break], AC_MSG_ERROR([[Cannot find limits.h nor climits. Fim requires it!.]])) + +AC_CHECK_SIZEOF([int]) +AC_CHECK_SIZEOF([int *]) +AC_CHECK_SIZEOF([size_t]) +AC_C_BIGENDIAN([fim_big_endian=yes],[fim_big_endian=no],[fim_big_endian=hmmm]) + +if test "x$fim_big_endian" = "xyes" ; then + AH_TEMPLATE([FIM_BIG_ENDIAN]) + AC_DEFINE([FIM_BIG_ENDIAN]) +fi + + +dnl ============= begin misc external programs detection +dnl ============= end misc external programs detection + +dnl if test "X$ac_cv_header_cstdio" != "Xyes" && test "X$ac_cv_header_stdio_h" != "Xyes"; then +dnl AC_MSG_ERROR([[Cannot find cstdio or stdio.h. Fim requires at least one or the other.]]) +dnl fi + +dnl if test "X$ac_cv_header_linux_fb_h" != "Xyes" ; then +dnl AC_MSG_ERROR([[Cannot find linux/fb.h. Fim requires it!.]]) +dnl fi + + + +dnl AC_CHECK_FUNCS(setrlimit getsid) + +AC_TYPE_SIGNAL + +dnl ================== +AH_TEMPLATE([FIM_WANT_STATIC_BINARY]) +AC_ARG_ENABLE(static, AC_HELP_STRING([--enable-static], [Want a static binary. (disabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_static=1 ; else fim_cv_want_static=0 ; fi ],[ fim_cv_want_static=0 ]) +if test x$fim_cv_want_static == x1 ; then + LIBS="$LIBS --static" + LIBDJVU_STATIC_EXTRA="-lpthread" + # too many dependencies for the following! + LIBPOPPLER_STATIC_EXTRA="" + LIBSPECTRE_STATIC_EXTRA="" + #LIBPOPPLER_STATIC_EXTRA="-lfreetype -llcms" + #LIBSPECTRE_STATIC_EXTRA="-Wl,--start-group -lgs -lfontconfig -ldl -ljbig2dec -ljasper -lpthread -lpng -lppd -lpaper -lavahi-common -lavahi-client -lexpat -lfreetype -lgnutls -ldbus-1 -ltasn1 -lcupsimage -lcups -lgcrypt -Wl,--end-group " + LIBTIFF_STATIC_EXTRA="-ljpeg -lz" + AC_DEFINE_UNQUOTED([FIM_WANT_STATIC_BINARY], $fim_cv_want_static [Want a static binary. (disabled by default)]) +fi +dnl ================== + + +AC_ARG_WITH(regex, AC_HELP_STRING([--with-regex], [Use the GNU regex library instead of the POSIX one]), + [fim_cv_regex=yes], + [AC_CHECK_FUNCS(regcomp, fim_cv_regex=no, fim_cv_regex=yes)]) + +if test X$fim_cv_regex = Xno ; then +AC_CACHE_CHECK([whether your system regexp library is completely broken], + [fim_cv_regex_broken], + AC_TRY_RUN([ +#include +#include +int main() { regex_t blah ; regmatch_t p; p.rm_eo = p.rm_eo; return regcomp(&blah, "foo.*bar", REG_NOSUB) || regexec (&blah, "foobar", 0, NULL, 0); }], + fim_cv_regex_broken=no, fim_cv_regex_broken=yes, fim_cv_regex_broken=yes)) + if test X$fim_cv_regex_broken = Xyes ; then + echo "Using the included GNU regex instead." >&AC_FD_MSG + fim_cv_regex=yes + fi +fi + +if test X$fim_cv_regex = Xyes; then + AC_DEFINE(USE_GNU_REGEX,1,[ Define if you want to use the included (GNU) regex.c. ]) + AC_LIBOBJ(regex) +fi + + + +AC_MSG_CHECKING(where to put the documentation...) +dnl AC_ARG_WITH(docdir, AC_HELP_STRING([--with-docdir=PATH], [Specify where to put the documentation]), +dnl [fim_cv_docdir=$withval], +dnl [fim_cv_docdir='${prefix}/doc/fim-${fim_cv_version}']) +# FIXME : the above line seems troublesome, BUT IT IS NOT (see the muttrc for this trick). + +AC_MSG_RESULT($fim_cv_docdir) + +dnl docdir=$fim_cv_docdir +dnl AC_SUBST(docdir) +AC_SUBST(fim_cv_version) + +dnl ============= gif file handling + +AC_ARG_ENABLE(gif, AC_HELP_STRING([--disable-gif], [Disable gif support.]), +[ if test x$enableval = xno ; then + fim_handle_gif=no + fi +]) +if test x$fim_handle_gif != xno ; then + fim_handle_gif=yes + have_gif=yes + if test x$with_libgif != xno && test -z "$LIBGIF"; then + AC_CHECK_LIB(gif,DGifOpenFileHandle , + have_gif=yes, + have_gif=no + AC_MSG_WARN([*** GIF loader will not be built (GIF library not found) ***])) + if test x"$have_gif" = xyes; then + AC_MSG_CHECKING([for gif.h]) + AC_TRY_CPP( +[#include +#undef PACKAGE +#undef VERSION +#undef HAVE_STDLIB_H +#include ], + have_gif=yes, + have_gif=no) + AC_MSG_RESULT($have_gif) + if test x"$have_gif" = xyes; then + LIBGIF='-lgif' + else + AC_MSG_WARN([*** GIF loader will not be built (GIF header file not found) ***]) + fi + fi + fi + +# if test x$with_libgif != xno ; then +# the following needs thorough testing + if test x"$have_gif" == xyes ; then + FIM_LIB_OBJECTS="$FIM_LIB_OBJECTS FbiStuffGif.o" + LIBS="$LIBS $LIBGIF" + AC_DEFINE([FIM_HANDLE_GIF]) + else + fim_handle_gif=no + fi + +# if test x$with_libgif != xno && test -z "$LIBGIF"; then + # +# fi +else + fim_handle_gif=no +fi +AC_SUBST(LIBGIF) +AM_CONDITIONAL(ENABLE_GIF, test x$have_gif = xyes) + + +dnl ============= tiff file handling + +AC_ARG_ENABLE(tiff, AC_HELP_STRING([--disable-tiff], [Disable tiff support.]), +[ if test x$enableval = xno ; then + fim_handle_tiff=no + fi +]) +if test x$fim_handle_tiff != xno ; then + fim_handle_tiff=yes + have_tiff=yes + if test x$with_libtiff != xno && test -z "$LIBTIFF"; then + AC_CHECK_LIB(tiff,TIFFOpen , + have_tiff=yes, + have_tiff=no + AC_MSG_WARN([*** TIFF loader will not be built (TIFF library not found) ***]) , [$LIBTIFF_STATIC_EXTRA]) + if test x"$have_tiff" = xyes; then + AC_MSG_CHECKING([for tiff.h]) + AC_TRY_CPP( +[#include +#undef PACKAGE +#undef VERSION +#undef HAVE_STDLIB_H +#include ], + have_tiff=yes, + have_tiff=no) + AC_MSG_RESULT($have_tiff) + if test x"$have_tiff" = xyes; then + LIBTIFF="-ltiff $LIBTIFF_STATIC_EXTRA" + else + AC_MSG_WARN([*** TIFF loader will not be built (TIFF header file not found) ***]) + fi + fi + fi + +# if test x$with_libtiff != xno ; then +# the following needs thorough testing + if test x"$have_tiff" == xyes ; then + FIM_LIB_OBJECTS="$FIM_LIB_OBJECTS FbiStuffTiff.o" + LIBS="$LIBS $LIBTIFF" + AC_DEFINE([FIM_HANDLE_TIFF]) + else + fim_handle_tiff=no + fi + +# if test x$with_libtiff != xno && test -z "$LIBTIFF"; then + # +# fi +else + fim_handle_tiff=no +fi +AC_SUBST(LIBTIFF) +AM_CONDITIONAL(ENABLE_TIFF, test x$have_tiff = xyes) + + +dnl ============= curses: optional +AC_CHECK_LIB([curses],[noecho]) +dnl ============= ncurses: optional +AC_CHECK_LIB([ncurses],[noecho]) +dnl ============= cacalib : optional +AC_CHECK_LIB(caca, caca_create_canvas,have_cacalib=yes,have_cacalib=no) + +dnl ============= GNU gpm, unofficial yet + +# AC_CHECK_LIB(gpm,Gpm_Open, +# ,true, +# AC_MSG_ERROR(*** gpm lib not found ... no problem ... ***)) +#LIBS="$LIBS -lgpm" + +dnl ============= no readline case handling + +fim_want_cxx11=no +AC_ARG_ENABLE(cxx11, AC_HELP_STRING([--enable-cxx11], [Enable C++11 standard constructs (requires appropriate CXXFLAGS, e.g. -std=c++11) (EXPERIMENTAL).]), +[ if test x$enableval = xno ; then + fim_want_cxx11=no + else + fim_want_cxx11=yes + fi +]) + +dnl ============= no readline case handling + +fim_want_readline=yes +AC_ARG_ENABLE(readline, AC_HELP_STRING([--disable-readline], [Disable readline support (EXPERIMENTAL).]), +[ if test x$enableval = xno ; then + fim_want_readline=no + else + fim_want_readline=yes + fi +]) + +dnl ============= GNU readline : essential + +dnl Please note that when the readline library is compiled with the curses library, this check will fail, because +dnl we cannot know in advance if it is so. +AH_TEMPLATE([FIM_USE_READLINE]) +AH_TEMPLATE([FIM_HANDLE_GIF]) +AH_TEMPLATE([FIM_HANDLE_TIFF]) + +have_readline=no + +# Sometimes the readline library is linked to the curses library, and we here try to detect this case.. +if test x$have_readline = xno; then + if test x$fim_want_readline = xyes ; then + AC_CHECK_LIB(readline, rl_replace_line, + have_readline=yes + LIBS="$LIBS -lreadline" + AC_DEFINE([FIM_USE_READLINE]) + ,have_readline=no + AC_MSG_ERROR(*** GNU readline (or curses library ?) not found (used LIBS=${LIBS}) ! please install them or specify them in e.g. LIBS=... or run ./configure --disable-readline ***) + ,[] + ) + else + have_readline=no + AC_MSG_NOTICE(*** Fim will be built withoud GNU readline library headers ! Are you sure ? ***) + fi +fi + +dnl FIXME : we try to detecht curses, although we do not know if the preceding did use it +if test x$have_readline = xyes; then + if test x$fim_want_readline = xyes ; then + AC_CHECK_LIB(curses, tputs, + have_curses=yes + LIBS="$LIBS" + ,have_curses=no + ) + fi +fi + +dnl ============= jpeg file handling + +#AC_ARG_WITH(jpeg, [ --disable-jpeg ], [ disable jpeg file support]) +AC_ARG_ENABLE(jpeg, AC_HELP_STRING([--disable-jpeg], [Disable jpeg support.]), +[ if test x$enableval = xno ; then + fim_handle_jpeg=no + fi +]) +if test x$fim_handle_jpeg != xno ; then + fim_handle_jpeg=yes + have_jpeg=yes + if test x$with_libjpeg != xno && test -z "$LIBJPEG"; then + AC_CHECK_LIB(jpeg, jpeg_destroy_decompress, + have_jpeg=yes, + have_jpeg=no + AC_MSG_WARN([*** JPEG loader will not be built (JPEG library not found) ***])) + if test x"$have_jpeg" = xyes; then + AC_MSG_CHECKING([for jpeglib.h]) + AC_TRY_CPP( +[#include +#undef PACKAGE +#undef VERSION +#undef HAVE_STDLIB_H +#include ], + have_jpeg=yes, + have_jpeg=no) + AC_MSG_RESULT($have_jpeg) + if test x"$have_jpeg" = xyes; then + LIBJPEG='-ljpeg' + else + AC_MSG_WARN([*** JPEG loader will not be built (JPEG header file not found) ***]) + fi + fi + fi + +# if test x$with_libjpeg != xno ; then +# the following needs thorough testing + if test x"$have_jpeg" == xyes ; then + FIM_LIB_OBJECTS="$FIM_LIB_OBJECTS FbiStuffJpeg.o" + LIBS="$LIBS $LIBJPEG" + AC_DEFINE([HAVE_LIBJPEG],[1],[We have libjpeg]) + else + fim_handle_jpeg=no + fi + +# if test x$with_libjpeg != xno && test -z "$LIBJPEG"; then +# AC_MSG_ERROR([ +# Checks for JPEG loader failed. You can build without it by passing +# --disable-jpeg to ./configure. ]) +# fi +else + fim_handle_jpeg=no +fi +AC_SUBST(LIBJPEG) +AM_CONDITIONAL(ENABLE_JPEG, test x$have_jpeg = xyes) + +dnl ============= dvi file handling (via TeX-Guy) +dnl +dnl AC_ARG_ENABLE(dvi, AC_HELP_STRING([--disable-dvi], [Disable dvi support.]), +dnl [ if test x$enableval = xno ; then +dnl fim_handle_dvi=no +dnl fi +dnl ]) +dnl if test x$fim_handle_dvi != xno ; then +dnl fim_handle_dvi=yes +dnl have_dvi=yes +dnl if test x$with_libdvi != xno && test -z "$LIBDVI"; then +dnl AC_CHECK_LIB(dvilib2, DVI_init, +dnl have_dvi=yes, +dnl have_dvi=no +dnl AC_MSG_WARN([*** DVI loader will not be built (libdvi29 library not found) ***])) +dnl if test x"$have_dvi" = xyes; then +dnl AC_MSG_CHECKING([for libdvi29.h]) +dnl AC_TRY_CPP( +dnl [#include +dnl #undef PACKAGE +dnl #undef VERSION +dnl #undef HAVE_STDLIB_H +dnl #include ], +dnl have_dvi=yes, +dnl have_dvi=no) +dnl AC_MSG_RESULT($have_dvi) +dnl if test x"$have_dvi" = xyes; then +dnl LIBDVI='-ldvilib2' +dnl else +dnl AC_MSG_WARN([*** DVI loader will not be built (libdvi29.h header file not found) ***]) +dnl fi +dnl fi +dnl fi +dnl +dnl # the following needs thorough testing +dnl if test x"$have_dvi" == xyes ; then +dnl FIM_LIB_OBJECTS="$FIM_LIB_OBJECTS FbiStuffDvi.o" +dnl LIBS="$LIBS $LIBDVI" +dnl AC_DEFINE([HAVE_LIBSPECTRE],[1],[We have libdvilib2]) +dnl else +dnl fim_handle_dvi=no +dnl fi +dnl +dnl # if test x$with_libdvi != xno && test -z "$LIBDVI"; then +dnl # AC_MSG_ERROR([ +dnl # Checks for DVI loader failed. You can build without it by passing +dnl # --disable-dvi to ./configure. ]) +dnl # fi +dnl else +dnl fim_handle_dvi=no +dnl fi +dnl AC_SUBST(LIBDVI) +dnl AM_CONDITIONAL(ENABLE_DVI, test x$have_dvi = xyes) + +dnl ============= ps file handling + +AC_ARG_ENABLE(ps, AC_HELP_STRING([--disable-ps], [Disable ps support.]), +[ if test x$enableval = xno ; then + fim_handle_ps=no + fi +]) +if test x$fim_handle_ps != xno ; then + fim_handle_ps=yes + have_ps=yes + if test x$with_libps != xno && test -z "$LIBPS"; then + AC_CHECK_LIB(spectre, spectre_page_render, + have_ps=yes, + have_ps=no + AC_MSG_WARN([*** PS loader will not be built (spectre library not found) ***]) , [$LIBSPECTRE_STATIC_EXTRA]) + if test x"$have_ps" = xyes; then + AC_MSG_CHECKING([for libspectre/spectre.h]) + AC_TRY_CPP( +[#include +#undef PACKAGE +#undef VERSION +#undef HAVE_STDLIB_H +#include ], + have_ps=yes, + have_ps=no) + AC_MSG_RESULT($have_ps) + if test x"$have_ps" = xyes; then + LIBPS="-lspectre $LIBSPECTRE_STATIC_EXTRA" + else + AC_MSG_WARN([*** PS loader will not be built (PS header file not found) ***]) + fi + fi + fi + +# the following needs thorough testing + if test x"$have_ps" == xyes ; then + FIM_LIB_OBJECTS="$FIM_LIB_OBJECTS FbiStuffPs.o" + LIBS="$LIBS $LIBPS" + AC_DEFINE([HAVE_LIBSPECTRE],[1],[We have libspectre]) + else + fim_handle_ps=no + fi + +# if test x$with_libps != xno && test -z "$LIBPS"; then +# AC_MSG_ERROR([ +# Checks for PS loader failed. You can build without it by passing +# --disable-ps to ./configure. ]) +# fi +else + fim_handle_ps=no +fi +AC_SUBST(LIBPS) +AM_CONDITIONAL(ENABLE_PS, test x$have_ps = xyes) + + + +dnl ============= djvu file handling + +AC_ARG_ENABLE(djvu, AC_HELP_STRING([--disable-djvu], [Disable djvu support.]), +[ if test x$enableval = xno ; then + fim_handle_djvu=no + fi +]) +if test x$fim_handle_djvu != xno ; then + fim_handle_djvu=yes + have_djvu=yes + if test x$with_libdjvu != xno && test -z "$LIBDJVU"; then + AC_CHECK_LIB(djvulibre, ddjvu_page_create_by_pageno, + have_djvu=yes, + have_djvu=no + AC_MSG_WARN([*** DJVU loader will not be built (DJVU library not found) ***]), [$LIBDJVU_STATIC_EXTRA]) + if test x"$have_djvu" = xyes; then + AC_MSG_CHECKING([for libdjvu/ddjvuapi.h]) + AC_TRY_CPP( +[#include +#undef PACKAGE +#undef VERSION +#undef HAVE_STDLIB_H +#include ], + have_djvu=yes, + have_djvu=no) + AC_MSG_RESULT($have_djvu) + if test x"$have_djvu" = xyes; then + LIBDJVU="-ldjvulibre $LIBDJVU_STATIC_EXTRA" + else + AC_MSG_WARN([*** DJVU loader will not be built (DJVU header file not found) ***]) + fi + fi + fi + +# the following needs thorough testing + if test x"$have_djvu" == xyes ; then + FIM_LIB_OBJECTS="$FIM_LIB_OBJECTS FbiStuffDjvu.o" + LIBS="$LIBS $LIBDJVU" + AC_DEFINE([HAVE_LIBDJVU],[1],[We have libdjvulibre]) + else + fim_handle_djvu=no + fi + +# if test x$with_libdjvu != xno && test -z "$LIBDJVU"; then +# AC_MSG_ERROR([ +# Checks for DJVU loader failed. You can build without it by passing +# --disable-djvu to ./configure. ]) +# fi +else + fim_handle_djvu=no +fi +AC_SUBST(LIBDJVU) +AM_CONDITIONAL(ENABLE_DJVU, test x$have_djvu = xyes) + + +dnl ============= pdf file handling with libpoppler +dnl +dnl By default, we disable poppler : its API is still immature. +dnl +fim_handle_pdf=no +AC_ARG_ENABLE(poppler, AC_HELP_STRING([--enable-poppler], [Enable poppler (PDF rendering) support. This will add LIBPOPPLER_CXXFLAGS="-I/usr/include/poppler/" to the compilation flags. You can override this by passing configure a suitable LIBPOPPLER_CXXFLAGS variable.]), +[ if test x$enableval = xyes ; then + fim_handle_pdf=yes + fi +], [$LIBPOPPLER_STATIC_EXTRA]) +dnl FIXME : checking only for libpoppler-glib, should also check for libpoppler ! +if test x$fim_handle_pdf != xno ; then + fim_handle_pdf=yes + have_poppler=yes + if test x$with_libpoppler != xno && test -z "$LIBPOPPLER"; then +dnl FIXME : the following is a dirty hack + AC_CHECK_LIB(poppler, gfree, + have_poppler=yes, + have_poppler=no + AC_MSG_WARN([*** POPPLER loader will not be built (POPPLER library not found) ***]) ) + if test x"$have_poppler" = xyes; then + AC_MSG_CHECKING([for poppler/poppler-config.h]) + AC_TRY_CPP( + [#include + #undef PACKAGE + #undef VERSION + #undef HAVE_STDLIB_H + /* fim uses these headers. let us hope poppler will stabilize soon!*/ + #include + #include + #include + #include + #include + #include + #include + #include /* globalParams lives here */ + ], + have_poppler=yes, + have_poppler=no) + have_poppler=yes + AC_MSG_RESULT($have_poppler) + if test x"$have_poppler" = xyes; then + LIBPOPPLER="-lpoppler $LIBPOPPLER_STATIC_EXTRA" + # FIXME: the following is a dirty hack! + if test x"$LIBPOPPLER_CXXFLAGS" = x ; then + LIBPOPPLER_CXXFLAGS="-I/usr/include/poppler/" + fi + CXXFLAGS="$CXXFLAGS $LIBPOPPLER_CXXFLAGS -DFIM_LIBPOPPLER_VERSION_MAYBE=$have_poppler_maybe_version" +dnl are we sure poppler does not have something like the following ? +dnl LIBPOPPLER_LIBS=`$LIBPOPPLER_CONFIG --libs` + else + AC_MSG_WARN([*** POPPLER/PDF loader will not be built (POPPLER header file not found) ***]) + fi + fi + fi + +# the following needs thorough testing + if test x"$have_poppler" == xyes ; then + FIM_LIB_OBJECTS="$FIM_LIB_OBJECTS FbiStuffPdf.o" + LIBS="$LIBS $LIBPOPPLER" + AC_DEFINE([HAVE_LIBPOPPLER],[1],[We have libpoppler (Warning: the API could still break! (as of v.0.8.7--0.24.1))]) + else + fim_handle_pdf=no + fi + +# if test x$with_libpoppler != xno && test -z "$LIBPOPPLER"; then +# AC_MSG_ERROR([ +# Checks for POPPLER loader failed. You can build without it by passing +# --disable-poppler to ./configure. ]) +# fi +else + fim_handle_pdf=no +fi +AC_SUBST(LIBPOPPLER) +AM_CONDITIONAL(ENABLE_POPPLER, test x$have_poppler = xyes) + +dnl FIXME : we have two libpoppler checks ... : +dnl ================== pdf checks =================================================== +AC_ARG_ENABLE(pdf, + [AC_HELP_STRING([--enable-pdf], [Compile with pdf support])],enable_pdf="$enableval",enable_pdf=yes) + +if test "x$enable_pdf" = "xyes"; then + POPPLER_REQUIRED=0.8.7 + # dear fim hackers, you should install pkg-config to get this macro expanded + PKG_CHECK_MODULES(POPPLER, poppler >= $POPPLER_REQUIRED,enable_pdf=yes,enable_pdf=no) + + if test "x$enable_pdf" = "xyes"; then + AC_DEFINE([ENABLE_PDF], [1], [Enable pdf support.]) + SHELL_LIBS="$SHELL_LIBS $POPPLER_LIBS" + SHELL_CXXFLAGS="$SHELL_CXXFLAGS $POPPLER_CXXFLAGS" + + fim_save_LIBS=$LIBS + LIBS="$LIBS $POPPLER_LIBS" + LIBS=$fim_save_LIBS + + else + AC_MSG_WARN(["PDF support is disabled since poppler library version $POPPLER_REQUIRED or newer not found"]) + fi +fi + +AM_CONDITIONAL(ENABLE_PDF, test x$enable_pdf = xyes) +dnl ================== end of pdf checks ============================================ + +dnl ================================================================================ +fim_handle_bmp=yes +AC_ARG_ENABLE(bmp, AC_HELP_STRING([--disable-bmp], [Disable BMP file support (enabled by default).]), +[ if test x$enableval = xno ; then + fim_handle_bmp=no + fi +]) +if test x$fim_handle_bmp = xyes; then + AC_MSG_NOTICE([Enabling BMP file format support.]) + AC_DEFINE(FIM_WITH_BMP, 1, [BMP file support.]) + FIM_LIB_OBJECTS="$FIM_LIB_OBJECTS FbiStuffBmp.o" +else + AC_MSG_NOTICE([Disabling BMP file format support.]) + AC_DEFINE(FIM_WITH_BMP, 0, [BMP file support.]) +fi +dnl ================================================================================ +fim_handle_pcx=yes +AC_ARG_ENABLE(pcx, AC_HELP_STRING([--disable-pcx], [Disable PCX file support (enabled by default).]), +[ if test x$enableval = xno ; then + fim_handle_pcx=no + fi +]) +if test x$fim_handle_pcx = xyes; then + AC_MSG_NOTICE([Enabling PCX file format support.]) + AC_DEFINE(FIM_WITH_PCX, 1, [PCX file support.]) + FIM_LIB_OBJECTS="$FIM_LIB_OBJECTS FbiStuffPcx.o" +else + AC_MSG_NOTICE([Disabling PCX file format support.]) + AC_DEFINE(FIM_WITH_PCX, 0, [PCX file support.]) +fi +dnl ================================================================================ + +## png file handling + +AC_ARG_WITH(png-prefix, AC_HELP_STRING([--with-png-prefix=PFX], [prefix where libpng is installed (optional)]), +libpng_config_prefix="$withval", libpng_config_prefix="") + +fim_handle_png=yes + +AC_ARG_ENABLE(png, AC_HELP_STRING([--disable-png], [Disable png support.]), +[ if test x$enableval = xno ; then + fim_handle_png=no + fi +]) + +if test x$fim_handle_png = xyes; then + # support for custom library configurator path + if test x$libpng_config_prefix != x; then + LIBPNG_CONFIG="$libpng_config_prefix/bin/libpng-config" + else + # default path configurator + AC_PATH_PROG(LIBPNG_CONFIG, libpng-config, no) + fi + if test "x$LIBPNG_CONFIG" = "xno"; then + AC_MSG_WARN([*** PNG loader will not be built (PNG library not found) ***]) + fim_handle_png=no + else + CXXFLAGS="$CXXFLAGS `$LIBPNG_CONFIG --cflags`" + if test x$fim_cv_want_static == x1 ; then + LIBS="$LIBS `$LIBPNG_CONFIG --static --libs`" + else + LIBS="$LIBS `$LIBPNG_CONFIG --libs`" + fi + # finish this ! + FIM_LIB_OBJECTS="$FIM_LIB_OBJECTS FbiStuffPng.o" + AC_DEFINE(FIM_WITH_LIBPNG, 1, [Defined, if libpng support is enabled]) + fi +fi + +#AM_CONDITIONAL(BUILD_PNG, test x$fim_handle_png = xyes) + +dnl ================================================================================ + +fim_handle_xyz=no + +AC_ARG_ENABLE(xyz, AC_HELP_STRING([--enable-xyz], [Enable the sample bogus 'xyz' file loading support. This makes only sense in order to learn how to include a new file format and wish to play with src/FbiStuffXyz.cpp in the while.]), +[ if test x$enableval = xyes ; then + fim_handle_xyz=yes + fi +]) + +if test x$fim_handle_xyz = xyes; then + LIBXYZ="" # one would set an actual value here + LIBS="$LIBS $LIBXYZ" + FIM_LIB_OBJECTS="$FIM_LIB_OBJECTS FbiStuffXyz.o" + AC_DEFINE(FIM_WITH_LIBXYZ, 1, [Defined if sample bogus 'xyz' loader support is enabled.]) +fi + +dnl ================================================================================ + +## raw/nef file handling via UFRaw + +fim_handle_ufraw=no + +AC_ARG_ENABLE(ufraw, AC_HELP_STRING([--enable-ufraw], [Enable UFRaw support (EXPERIMENTAL).]), +[ if test x$enableval = xno ; then + fim_handle_ufraw=no + else + fim_handle_ufraw=yes + fi +]) + +if test x$fim_handle_ufraw = xyes; then + # support for custom library configurator path + CXXFLAGS="$CXXFLAGS $UFRAW_CXXFLAGS" + LIBS="$LIBS $UFRAW_LIBS" + FIM_LIB_OBJECTS="$FIM_LIB_OBJECTS FbiStuffUFRaw.o" # FIXME + AC_DEFINE(FIM_WITH_UFRAW, 1, [Defined, if UFRaw support is enabled]) + AC_MSG_NOTICE([Enabling UFRaw / libufraw.]) +fi + +dnl ================================================================================ + +## archive file handling via libarchive + +fim_handle_archive=no + +AC_ARG_ENABLE(archive, AC_HELP_STRING([--enable-archive], [Enable libarchive support (please provide ARCHIVE_LIBS, ARCHIVE_CXXFLAGS) (EXPERIMENTAL, UNFINISHED).]), +[ if test x$enableval = xno ; then + fim_handle_archive=no + else + fim_handle_archive=yes + fi +]) + +if test x$fim_handle_archive = xyes; then + # support for custom library configurator path + CXXFLAGS="$CXXFLAGS $ARCHIVE_CXXFLAGS" + LIBS="$LIBS $ARCHIVE_LIBS -larchive" + AC_DEFINE(FIM_WITH_ARCHIVE, 1, [Defined, if (EXPERIMENTAL, UNFINISHED) libarchive support is enabled]) + AC_MSG_NOTICE([Enabling libarchive.]) +fi + +dnl ================================================================================ + +AC_CHECK_LIB(exif, exif_data_new_from_data,have_libexif=yes,have_libexif=no) +AC_ARG_ENABLE(exif, AC_HELP_STRING([--disable-exif], [JPEG EXIF tags support with libexif.]), [if test x$enableval != xno; then fim_cv_libexif=yes; fi],[fim_cv_libexif=yes;]) + +if test x$fim_cv_libexif = xyes; then + if test x$have_libexif = xyes; then + AC_MSG_NOTICE([Enabling libexif usage.]) + CXXFLAGS="$CXXFLAGS"; + LIBS="$LIBS -lexif"; + else + AC_MSG_ERROR([Sorry, it does not seem like libexif is installed or detectable. + Please run --disable-exif or install libexif in a system-wide directory instead. + ]) + fi +else + fim_cv_libexif=no; +fi + +dnl ================================================================================ + +AC_ARG_ENABLE(jasper, AC_HELP_STRING([--enable-jasper], [Turns on JPEG-2000 files support using JasPer (EXPERIMENTAL)]), + [if test x$enableval = xyes; then + fim_cv_libjasper=yes; + CXXFLAGS="$CXXFLAGS"; + LIBS="$LIBS -ljasper"; + AC_CHECK_LIB(jasper, jas_init,have_libjasper=yes,have_libjasper=no) + if test x$have_libjasper = xyes; then + AC_MSG_NOTICE([Enabling support of JPEG-2K files with JasPer.]); + FIM_LIB_OBJECTS="$FIM_LIB_OBJECTS FbiStuffJasPer.o"; + else + fim_cv_libjasper=no; + AC_MSG_ERROR([Sorry, it does not seem like libjasper is installed or detectable. + Please run --disable-jasper or install libjasper in a system-wide directory instead. + ]); + fi + fi],[fim_cv_libjasper=no;]) + +dnl ================================================================================ + +AC_CHECK_LIB(aa, aa_getfirst,fim_cv_libaa=yes,fim_cv_libaa=no) +AC_ARG_ENABLE(aa, AC_HELP_STRING([--disable-aa], [Ascii Art (-o aa) support (via aalib)]), [if test x$enableval != xno; then fim_cv_libaa=yes; else fim_cv_libaa=no; fi],[fim_cv_libaa=yes;]) +if test x$fim_cv_libaa != xno; then + if test x$ac_cv_lib_aa_aa_getfirst = xyes; then + AC_MSG_NOTICE([Enabling aalib driver.]) + fim_cv_aalib=yes + if test x$libaa_config_prefix != x; then + LIBAA_CONFIG="$libaa_config_prefix/bin/aalib-config" + else + # default path configurator + AC_PATH_PROG(LIBAA_CONFIG, aalib-config, no) + fi + if test "x$LIBAA_CONFIG" = "xno"; then + # uhm + AC_MSG_WARN([*** no aalib-config ? ***]) + fim_cv_aalib=no + else + CXXFLAGS="$CXXFLAGS `$LIBAA_CONFIG --cflags`" + LIBS="$LIBS `$LIBAA_CONFIG --libs`" + # finish this ! + fi + else + fim_cv_aalib=no + fi +else + AC_MSG_WARN([Ascii Art (-o aa) support disabled.]) + fim_cv_aalib=no + dnl AC_MSG_ERROR([Sorry, it does not seem like aalib is installed or detectable. + dnl Please run --disable-aa or install aalib in a system-wide directory instead. + dnl ]) +fi + +dnl ================================================================================ + +## sdl driver + +AC_ARG_WITH(sdl-prefix, AC_HELP_STRING([--with-sdl-prefix=PFX], [prefix where libsdl is installed (optional)]), +libsdl_config_prefix="$withval", libsdl_config_prefix="") + +fim_handle_sdl='auto' + +dnl AC_ARG_ENABLE(sdl, AC_HELP_STRING([--disable-sdl], [Disable libsdl support.]), +dnl [ if test x$enableval = xno ; then +dnl fim_handle_sdl=no +dnl fi +dnl ]) + +AC_ARG_ENABLE(sdl, AC_HELP_STRING([--disable-sdl], [Disable libsdl support.]), +[ if test x$enableval = xyes ; then fim_handle_sdl=yes ; fi ] +[ if test x$enableval = xno ; then fim_handle_sdl=no ; fi ]) + +# tested with sdl 1.2 +if test x$fim_handle_sdl != xno; then + # support for custom library configurator path + if test x$libsdl_config_prefix != x; then + LIBSDL_CONFIG="$libsdl_config_prefix/bin/sdl-config" + else + AC_PATH_PROG(LIBSDL_CONFIG, sdl-config, no) + fi + if test "x$LIBSDL_CONFIG" = "xno"; then + if test x$fim_handle_sdl = xyes; then + AC_MSG_ERROR([LIBSDL not found (failed detecting the sdl-config program)]) + else + fim_handle_sdl='no' + fi + else +dnl if test x$fim_cv_want_static == x1 ; then + LIBSDL_CONFIG_FLAGS=--static-libs +dnl else +dnl LIBSDL_CONFIG_FLAGS=--libs +dnl fi + AC_MSG_NOTICE([Activating LIBSDL.]) + fim_handle_sdl='yes' + LIBSDL_CXXFLAGS=`$LIBSDL_CONFIG --cflags` + CXXFLAGS="$CXXFLAGS $LIBSDL_CXXFLAGS" + LIBS="$LIBS `$LIBSDL_CONFIG $LIBSDL_CONFIG_FLAGS`" + # finish this ! + #FIM_LIB_OBJECTS="$FIM_LIB_OBJECTS SDLDevice.o" + AC_DEFINE(FIM_WITH_LIBSDL, 1, [Defined, if libsdl support is enabled]) + fi +fi + +dnl ================================================================================ + +AH_TEMPLATE([FIM_WANT_EXIFTOOL]) +fim_cv_exiftool=no +AC_ARG_ENABLE(exiftool, AC_HELP_STRING([--enable-exiftool], [Turns on exiftool support (EXPERIMENTAL, shall provide the EXIFTOOLLINK variable with library or object files and EXIFTOOLCXXFLAGS)]), + [if test x$enableval = xyes; then + fim_cv_exiftool=yes + CXXFLAGS="$CXXFLAGS $EXIFTOOLCXXFLAGS" + LIBS="$LIBS $EXIFTOOLLINK" + AC_MSG_NOTICE([Enabling exiftool interface.]) + AC_DEFINE(FIM_WANT_EXIFTOOL, 1, [If defined, exiftool will be used to get additional file information (EXPERIMENTAL).]) + fi],[fim_cv_exiftool=no]) +dnl + +#AC_DEFINE([FIM_DEFAULT_KEY_CONFIG] ,1, [Defined, if GPGME support is enabled]) +#AC_DEFINE([FIM_DEFAULT_CONFIG], 1, [Defined, if GPGME support is enabled]) + +#AC_DEFINE([FIM_DEFAULT_CONFIGURATION], 1, [Defined, if GPGME support is enabled]) + +#AC_MSG_CHECKING(whether struct dirent defines d_ino) + +dnl ================== + +fim_cv_autocommands=yes + +AC_ARG_ENABLE(autocommands, AC_HELP_STRING([--disable-autocommands], [Fim will by default use autocommands.]), +[if test x$enableval = xno; then + fim_cv_autocommands=no +fi]) + +AH_TEMPLATE([FIM_AUTOCMDS]) +if test x$fim_cv_autocommands = xyes; then + have_autocommands=yes + AC_DEFINE([FIM_AUTOCMDS]) +else + have_autocommands=no +fi + + +dnl ================== + +AC_ARG_ENABLE(hardcoded-font, AC_HELP_STRING([--enable-hardcoded-font], [Enable a hardcoded font in the executable (good as a fallback (FBFONT=fim://) when no PSF format consolefonts files are available).]), +[if test x$enableval = xyes; then + fim_cv_hardcoded_font=yes; +else + fim_cv_hardcoded_font=no; +fi],[ fim_cv_hardcoded_font=yes; ]) + +AH_TEMPLATE([FIM_WANT_HARDCODED_FONT]) +if test x$fim_cv_hardcoded_font = xyes; then + have_hardcoded_font=yes + AC_DEFINE([FIM_WANT_HARDCODED_FONT],1,[Enable a hardcoded font in the executable.]) +else + have_hardcoded_font=no +fi +AM_CONDITIONAL(FIM_WANT_HARDCODED_CONSOLEFONT, test x$have_hardcoded_font = xyes ) + + +dnl ================== + +AC_ARG_ENABLE(long-int-vars, AC_HELP_STRING([--enable-long-int-vars], [Internals shall use 64 bit integers (EXPERIMENTAL].), +[if test x$enableval = xyes; then + fim_cv_want_int64_int=yes; +else + fim_cv_want_int64_int=no; +fi],[ fim_cv_want_int64_int=yes; ]) + +AH_TEMPLATE([FIM_WANT_LONG_INT]) +if test x$fim_cv_want_int64_int = xyes; then + AC_DEFINE([FIM_WANT_LONG_INT],1,[Internals shall use 64 bit integers (EXPERIMENTAL).]) +else + AC_DEFINE([FIM_WANT_LONG_INT],0,[Internals shall use 64 bit integers (EXPERIMENTAL).]) +fi +dnl ================== + +fim_cv_windows=yes + +AC_ARG_ENABLE(windows, AC_HELP_STRING([--disable-windows], [Disable windowing system in Fim. (deprecated)]), +[if test x$enableval = xno; then + fim_cv_windows=no +fi]) + +AH_TEMPLATE([FIM_WINDOWS]) +if test x$fim_cv_windows = xyes; then + have_windows=yes + AC_DEFINE([FIM_WINDOWS],1,[Fim windowing support]) +else + have_windows=no +fi + + +dnl ================== +fim_cv_fimrc=yes + +AC_ARG_ENABLE(fimrc, AC_HELP_STRING([--disable-fimrc], [Fim will by default load the ~/.fimrc file.]), +[if test x$enableval = xno; then + fim_cv_fimrc=no +fi]) + +AH_TEMPLATE([FIM_NOFIMRC]) +if test x$fim_cv_fimrc = xyes; then + have_fimrc=yes +else + AC_DEFINE([FIM_NOFIMRC]) +fi + +dnl ================== +AH_TEMPLATE([FIM_NOHISTORY]) +fim_cv_history=yes + +AC_ARG_ENABLE(history, AC_HELP_STRING([--disable-history], [Fim will by default load/save a ~/.fim_history file.]), +[if test x$enableval = xno; then + fim_cv_history=no +fi]) + +AH_TEMPLATE([FIM_NOHISTORY]) +if test x$fim_cv_history = xyes; then + have_history=yes +else + AC_DEFINE([FIM_NOHISTORY]) +fi + +dnl ================== + +fim_cv_warnings=no +AC_ARG_ENABLE(screen, AC_HELP_STRING([--disable-screen], [Fim will try to work under screen by default (please read BUGS)]), +[ if test x$enableval = xno; then + fim_cv_screen=no + else + fim_cv_screen=yes + fi +],[ fim_cv_screen=yes ] +) + +dnl ================== + +fim_cv_resize_optimizations=yes +AC_ARG_ENABLE(resize-optimizations, AC_HELP_STRING([--disable-resize-optimizations], [Some old (fbi) code is optimized for speedup in fim.]), +[ if test x$enableval = xno; then + fim_cv_resize_optimizations=no + else + fim_cv_resize_optimizations=yes + fi +],[ fim_cv_resize_optimizations=yes ] +) + +dnl ================== + +fim_cv_read_stdin_image=yes +AC_ARG_ENABLE(stdin-image-reading, AC_HELP_STRING([--disable-stdin-image-reading], [Fim will read an image from stdin with the -i switch. (experimental)]), +[ if test x$enableval = xno; then + fim_cv_read_stdin_image=no + else + fim_cv_read_stdin_image=yes + fi +],[ fim_cv_read_stdin_image=yes ] +) + +dnl ================== +fim_cv_scan_consolefonts=yes +AC_ARG_ENABLE(scan-consolefonts, AC_HELP_STRING([--enable-scan-consolefonts], [Fim will scan some predefined directory in look for console fonts as a fallback. (experimental)]), +[ if test x$enableval = xyes; then + fim_cv_scan_consolefonts=yes + else + fim_cv_scan_consolefonts=no + fi +],[ fim_cv_scan_consolefonts=yes ] +) +dnl ================== +fim_cv_seek_magic=yes +AC_ARG_ENABLE(seek-magic, AC_HELP_STRING([--enable-seek-magic], [Fim will be capable to seek on a specified magic string. (experimental)]), +[ if test x$enableval = xyes; then + fim_cv_seek_magic=yes + else + fim_cv_seek_magic=no + fi +],[ fim_cv_seek_magic=no ] +) +dnl ================== +AC_ARG_ENABLE(pushdir, AC_HELP_STRING([--enable-pushdir], [Fim will scan directories for files.]), +[ if test x$enableval = xno; then + fim_cv_read_dirs=no + else + fim_cv_read_dirs=yes + fi +],[ fim_cv_read_dirs=yes ] +) +dnl ================== +AC_ARG_ENABLE(recursive-pushdir, AC_HELP_STRING([--disable-recursive-pushdir], [Fim will be able to push directories recursively (implies --enable-push-dirs )]), +[ if test x$enableval = xyes; then + fim_cv_recursive_dirs=yes; + fim_cv_read_dirs=yes; + else + fim_cv_recursive_dirs=no; + fi +],[ fim_cv_recursive_dirs=yes;fim_cv_read_dirs=yes; ] +) +dnl ================== + +AH_TEMPLATE([FIM_RECURSIVE_DIRS]) +AH_TEMPLATE([FIM_WANTS_SLOW_RESIZE]) +AH_TEMPLATE([FIM_READ_DIRS]) +AH_TEMPLATE([FIM_BOZ_PATCH]) +AH_TEMPLATE([FIM_READ_STDIN]) +AH_TEMPLATE([FIM_READ_STDIN_IMAGE]) +AH_TEMPLATE([FIM_SMART_COMPLETION]) +AH_TEMPLATE([FIM_LINUX_CONSOLEFONTS_DIR_SCAN]) +dnl ================== + +if test x$fim_cv_resize_optimizations != xyes; then + AC_DEFINE([FIM_WANTS_SLOW_RESIZE]) +fi + +dnl ================== + +if test x$fim_cv_read_dirs == xyes; then + AC_DEFINE([FIM_READ_DIRS]) + if test x$fim_cv_recursive_dirs == xyes; then + AC_DEFINE([FIM_RECURSIVE_DIRS]) + fi +fi + +dnl ================== + +if test x$fim_cv_screen != xno; then +# boz patch is on + AC_DEFINE([FIM_BOZ_PATCH]) +fi + +dnl ================== + +fim_cv_read_stdin=yes + +if test x$fim_cv_read_stdin != xno; then + AC_DEFINE([FIM_READ_STDIN]) +fi + +dnl ================== + +dnl NOTE THAT IN THE CODE FIM_READ_STDIN_IMAGE depends on FIM_READ_STDIN, too +if test x$fim_cv_read_stdin_image = xyes -a x$fim_cv_read_stdin = xyes; then + AC_DEFINE([FIM_READ_STDIN_IMAGE]) +else + # we revert to no just for the printout + fim_cv_read_stdin_image=no +fi + +dnl ================== + +fim_cv_warnings=no +AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [Turns on debug options (recommended for debugging)]), +[if test x$enableval = xyes; then + fim_cv_debug=yes +fi]) + +dnl ================== + +fim_cv_warnings=no +AC_ARG_ENABLE(warnings, AC_HELP_STRING([--enable-warnings], [Turns on compiler warnings (recommended, for debugging)]), +[if test x$enableval = xyes; then + fim_cv_warnings=yes +fi]) + +if test x$GCC = xyes ; then + if test x$fim_cv_debug = xyes; then + # CXXFLAGS are resetted + CXXFLAGS="-g" + fi +fi + +if test x$GCC = xyes ; then + if test x$fim_cv_warnings = xyes ; then + CXXFLAGS="-Wall -pedantic $CXXFLAGS" + fi +fi + +dnl ================== + +dnl ================== + +fim_cv_cacalib=no + +AC_ARG_ENABLE(cacalib, AC_HELP_STRING([--enable-cacalib], [Turns on cacalib support (STILL INCOMPLETE)]), + [if test x$enableval = xyes; then + if test x$have_cacalib = xyes; then + fim_cv_cacalib=yes + else + AC_MSG_ERROR([Sorry, it does not seem like cacalib is installed or detectable. + Please run --disable-cacalib or install cacalib in a system-wide directory instead. + ]) + fi + fi]) + +dnl ================== + +# This code still awaits for integration ... +AC_ARG_WITH(cflags, AC_HELP_STRING([--with-cflags=CXXFLAGS], + [Specify a custom CXXFLAGS append value. e.g.: -pg + You cannot call this argument multiple times. + In case you want completely reset CXXFLAGS use : + CXXFLAGS='' ./configure .. + Note that Fim is a C++ program, so we set CXXFLAGS=CXXFLAGS. + ]), + [if test "x$withval" != x; then + AC_DEFINE_UNQUOTED(CXXFLAGS, "$withval", + [custom CXXFLAGS]) + CXXFLAGS="$withval" + CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS" + AC_DEFINE_UNQUOTED(CXXFLAGS, "$withval", + [custom CXXFLAGS]) + dnl ...else CXXFLAGS="$CXXFLAGS" + fi], + [AC_DEFINE_UNQUOTED(EXECSHELL, "/bin/sh")]) + + +dnl ================== + +# This code still awaits for integration ... +AC_ARG_WITH(exec-shell, AC_HELP_STRING([--with-exec-shell=SHELL], [Specify alternate shell (ONLY if /bin/sh is broken)]), + [if test x$withval != xyes; then + AC_DEFINE_UNQUOTED(EXECSHELL, "$withval", + [program to use for shell commands]) + else + AC_DEFINE_UNQUOTED(EXECSHELL, "/bin/sh") + fi], + [AC_DEFINE_UNQUOTED(EXECSHELL, "/bin/sh")]) + +dnl ================== +AC_ARG_ENABLE(convert, AC_HELP_STRING([--disable-smartautocompletion], [Fim will treat as a proper, unescaped string, nonquoted and nonevaluated strings which happen to match an existing filename.]), +[ if test x$enableval = xno; then + fim_cv_smartautcompletion=no + else + fim_cv_smartautcompletion=yes + fi +],[ fim_cv_smartautcompletion=yes ] +) +dnl ================== +if test x$fim_cv_smartautcompletion = xyes; then + AC_DEFINE([FIM_SMART_COMPLETION]) +fi +dnl ================== +if test x$fim_cv_scan_consolefonts = xyes; then + AC_DEFINE([FIM_LINUX_CONSOLEFONTS_DIR_SCAN]) +fi +dnl ================== + +AC_ARG_ENABLE(convert, AC_HELP_STRING([--disable-convert], [Fim will try to use convert (ImageMagick) as a last resort for opening unknown format files.]), +[ if test x$enableval = xno; then + fim_cv_convert=no + else + fim_cv_convert=yes + fi +],[ fim_cv_convert=yes ] +) + + + +dnl ================== + +AC_ARG_ENABLE(xcftopnm, AC_HELP_STRING([--disable-xcftopnm], [Fim will try to use xcftopnm (Gimp) for opening XCF format files.]), +[ if test x$enableval = xno; then + fim_cv_xcftopnm=no + else + fim_cv_xcftopnm=yes + fi +],[ fim_cv_xcftopnm=yes ] +) + +dnl ================== + +fim_cv_inkscape=yes +AC_ARG_ENABLE(inkscape, AC_HELP_STRING([--disable-inkscape], [Fim will try to use Inkscape for opening SVG format files.]), +[ if test x$enableval = xno; then + fim_cv_inkscape=no + else + fim_cv_inkscape=yes + fi +],[ fim_cv_inkscape=yes ] +) + +dnl ================== + +AC_ARG_ENABLE(xfig, AC_HELP_STRING([--disable-xfig], [Fim will try to use xfig (fig2dev) for opening FIG format files.]), +[ if test x$enableval = xno; then + fim_cv_xfig=no + else + fim_cv_xfig=yes + fi +],[ fim_cv_xfig=yes ] +) + +dnl ================== + +AC_ARG_ENABLE(dia, AC_HELP_STRING([--disable-dia], [Fim will try to use dia for opening DIA format files.]), +[ if test x$enableval = xno; then + fim_cv_dia=no + else + fim_cv_dia=yes + fi +],[ fim_cv_dia=yes ] +) + +dnl ================== +AH_TEMPLATE([FIM_DEFAULT_CONSOLEFONT]) +AC_ARG_WITH(default-consolefont, AC_HELP_STRING([--with-default-consolefont=FILE], [Specify a default consolefont (psf or psf.gz format) file.]), [ AC_DEFINE_UNQUOTED(FIM_DEFAULT_CONSOLEFONT, "$withval") ], [fim_cv_defaultconsolefont=""]) +dnl ================== +AC_ARG_WITH(custom-hardcoded-consolefont, AC_HELP_STRING([--with-custom-hardcoded-consolefont=FILE], [Specify a custom consolefont to be hardcoded (uncompressed psf format, absolute path) at build time (requires --enable-hardcoded-font).]), [ +fim_cv_want_custom_hardcoded_consolefont=true; +AC_SUBST(FIM_CUSTOM_HARDCODED_CONSOLEFONT, "$withval") +], []) +AM_CONDITIONAL(FIM_WANT_CUSTOM_HARDCODED_CONSOLEFONT, test x$fim_cv_want_custom_hardcoded_consolefont = xtrue ) +dnl ================== +AC_ARG_WITH(tmpfile, AC_HELP_STRING([--with-tmpfile=FILE], [Specify where to put temporary files created when interacting with external conversion programs (default is "/tmp/__FIM_TEMPORARY_FILE").]), + [fim_cv_tmpfile=$withval], + [fim_cv_tmpfile="/tmp/__FIM_TEMPORARY_FILE"]) +dnl ================== +AC_ARG_ENABLE(custom-status-bar, AC_HELP_STRING([--disable-custom-status-bar], [Customization of status bar via a printf-like string.]), +[ if test x$enableval = xno; then + fim_cv_custom_status_bar=no; + else + fim_cv_custom_status_bar=yes; + fi +],[ fim_cv_custom_status_bar=yes; ] +) +dnl ================== + +AC_ARG_ENABLE(optimizations, AC_HELP_STRING([--enable-optimizations], [Will try to enhance compilation flags (EXPERIMENTAL)]), +[ if test x$enableval = xno; then + fim_cv_optimizations=no + else + fim_cv_optimizations=yes + fi +],[ fim_cv_optimizations=no ] +) + +dnl ================== +AH_TEMPLATE([FIM_USE_CXX11]) +dnl ================== +AH_TEMPLATE([FIM_TRY_XCFTOPNM]) +AH_TEMPLATE([FIM_TRY_CONVERT]) +AH_TEMPLATE([FIM_TRY_INKSCAPE]) +AH_TEMPLATE([FIM_TRY_XFIG]) +AH_TEMPLATE([FIM_TRY_DIA]) +AH_TEMPLATE([FIM_USE_ZCAT]) + +dnl ================== + +AC_CHECK_PROG(have_zcat,zcat,yes,no) + if test x$have_zcat = xyes ; then + # legacy fbi feature : should not rely on this. FIXME + AC_MSG_NOTICE([Fim will use 'zcat' to uncompress "gzipped" font files.]) + AC_DEFINE([FIM_USE_ZCAT]) + fi + +dnl 20110602 will use man --html-cat instead of obsolete man2html +dnl AC_CHECK_PROG(have_man2html,man2html,yes,no) +dnl if test x$have_man2html = xyes ; then +dnl AC_MSG_NOTICE([The installer will try to invoke 'man2html' to build html versions of the man pages.]) +dnl HTMLDOCS="FIM.html fim.man.html fimgs.man.html" +dnl fi + +AC_CHECK_PROG(have_convert,convert,yes,no) + if test x$have_convert = xyes -a x$fim_cv_convert = xyes ; then + true +dnl AC_MSG_WARN([Fim will try to invoke 'convert' to handle unknown format files, even if no 'convert' is currently in the program path: please install the Imagemagick package to obviate the problem or re-configure with --disable-convert.]) + else + fim_cv_convert=no + fi + +AC_CHECK_PROG(have_xcftopnm,xcftopnm,yes,no) + if test x$have_xcftopnm = xyes -a x$fim_cv_xcftopnm = xyes ; then + true +dnl AC_MSG_WARN([Fim will try to invoke 'xcftopnm' to handle XCF format files, even if no 'xcftopnm' is currently in the program path: please install the Gimp package to obviate the problem or re-configure with --disable-xcftopnm.]) + else + fim_cv_xcftopnm=no + fi + +AC_CHECK_PROG(have_inkscape,inkscape,yes,no) + if test x$have_inkscape = xyes -a x$fim_cv_inkscape = xyes ; then + true +dnl AC_MSG_WARN([Fim will try to invoke 'inkscape' to handle SVG format files, even if no 'inkscape' is currently in the program path: please install the Inkscape package to obviate the problem or re-configure with --disable-inkscape.]) + else + fim_cv_inkscape=no + fi + +AC_CHECK_PROG(have_xfig,fig2dev,yes,no) + if test x$have_xfig = xyes -a x$fim_cv_xfig = xyes ; then + true +dnl AC_MSG_WARN([Fim will try to invoke 'xfig' to handle FIG format files, even if no 'fig2dev' is currently in the program path: please install the Xfig package to obviate the problem or re-configure with --disable-xfig.]) + else + fim_cv_xfig=no + fi + +AC_CHECK_PROG(have_dia,dia,yes,no) + if test x$have_dia = xyes -a x$fim_cv_dia = xyes ; then + true +dnl AC_MSG_WARN([Fim will try to invoke 'dia' to handle DIA format files, even if no 'dia' is currently in the program path: please install the Dia package to obviate the problem or re-configure with --disable-dia.]) + else + fim_cv_dia=no + fi + +dnl ================== + + if test x$fim_cv_optimizations = xyes ; then + uname=`uname` + if test x$uname = xLinux ; then +dnl AC_MSG_NOTICE([we run on linux! Good.]) + if grep "^model name.*Pentium(R) 4" /proc/cpuinfo > /dev/null; then + CXXFLAGS="$CXXFLAGS -march=native" + fi + + else + AC_MSG_NOTICE([uhm. try to specify your own optimizations..]) + + fi + fi + +dnl ================== + if test x$fim_want_cxx11 = xyes ; then + AC_DEFINE([FIM_USE_CXX11]) + fi +dnl ================== + + if test x$fim_cv_convert = xyes ; then + AC_DEFINE([FIM_TRY_CONVERT]) + fi + + if test x$fim_cv_xcftopnm = xyes ; then + AC_DEFINE([FIM_TRY_XCFTOPNM]) + fi + + if test x$fim_cv_inkscape = xyes ; then + AC_DEFINE([FIM_TRY_INKSCAPE]) + fi + + if test x$have_xfig = xyes ; then + AC_DEFINE([FIM_TRY_XFIG]) + fi + + if test x$have_dia = xyes ; then + AC_DEFINE([FIM_TRY_DIA]) + fi + +dnl ================== + + AH_TEMPLATE([FIM_WITH_LIBJASPER]) + if test x$fim_cv_libjasper = xyes ; then + AC_DEFINE([FIM_WITH_LIBJASPER]) + fi +dnl ================== + + AH_TEMPLATE([FIM_WITH_LIBEXIF]) + if test x$fim_cv_libexif = xyes ; then + AC_DEFINE([FIM_WITH_LIBEXIF]) + fi +dnl ================== + + AH_TEMPLATE([FIM_WITH_AALIB]) + if test x$fim_cv_aalib = xyes ; then + AC_DEFINE([FIM_WITH_AALIB]) + fi + +dnl ================== + + AH_TEMPLATE([FIM_WITH_CACALIB]) + if test x$fim_cv_cacalib = xyes ; then + AC_DEFINE([FIM_WITH_CACALIB]) + LIBS="$LIBS -lcaca" + fi + +dnl ================== + AH_TEMPLATE([FIM_WANT_SEEK_MAGIC]) + if test x$fim_cv_seek_magic = xyes ; then + AC_DEFINE([FIM_WANT_SEEK_MAGIC]) + fi + +dnl ================== + AH_TEMPLATE([FIM_WANT_CUSTOM_INFO_STATUS_BAR]) + if test x$fim_cv_custom_status_bar = xyes ; then + AC_DEFINE([FIM_WANT_CUSTOM_INFO_STATUS_BAR]) + fi + +dnl ================== +AH_TEMPLATE([FIM_WANT_FILENAME_MARK_AND_DUMP]) +AC_ARG_ENABLE(mark-and-dump, AC_HELP_STRING([--enable-mark-and-dump], [Fim will be capable of marking files while viewing and outputting their names on exit. (enabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_mark_and_dump=1 ; else fim_cv_want_mark_and_dump=0 ; fi ],[ fim_cv_want_mark_and_dump=1 ]) +AC_DEFINE_UNQUOTED([FIM_WANT_FILENAME_MARK_AND_DUMP], $fim_cv_want_mark_and_dump, [Fim will be capable of marking files while viewing and outputting their names on exit.]) +dnl ================== +AH_TEMPLATE([FIM_WANT_NOSCRIPTING]) +AC_ARG_ENABLE(scripting, AC_HELP_STRING([--enable-scripting], [Scripting. (enabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_noscripting=0 ; else fim_cv_want_noscripting=1 ; fi ],[ fim_cv_want_noscripting=0 ]) +if test x$fim_cv_want_noscripting == x1 ; then +AC_DEFINE_UNQUOTED([FIM_WANT_NOSCRIPTING], $fim_cv_want_noscripting, [Scripting. (enabled by default)]) +fi +dnl ================== +AH_TEMPLATE([FIM_WANT_NO_OUTPUT_CONSOLE]) +AC_ARG_ENABLE(output-console, AC_HELP_STRING([--enable-output-console], [Output console. (enabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_no_output_console=0 ; else fim_cv_want_no_output_console=1 ; fi ],[ fim_cv_want_no_output_console=0 ]) +if test x$fim_cv_want_no_output_console == x1 ; then +AC_DEFINE_UNQUOTED([FIM_WANT_NO_OUTPUT_CONSOLE], $fim_cv_want_no_output_console, [Output console. (enabled by default)]) +fi +dnl ================== +AH_TEMPLATE([FIM_WANT_UNICODE]) +AC_ARG_ENABLE(unicode, AC_HELP_STRING([--enable-unicode], [Unicode. (disabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_unicode=1 ; else fim_cv_want_unicode=0 ; fi ],[ fim_cv_want_unicode=0 ]) +if test x$fim_cv_want_unicode == x1 ; then + # CXXFLAGS="$CXXFLAGS `freetype-config --cflags`" + # LIBS="$LIBS `freetype-config --libs`" + AC_DEFINE_UNQUOTED([FIM_WANT_UNICODE], $fim_cv_want_unicode, [Check for freetype library, with no feature behind: do not use this. (disabled by default)]) +fi +dnl ================== +AH_TEMPLATE([FIM_WANT_TEXT_RENDERING]) +fim_want_astext=yes +AC_ARG_ENABLE(as-text-rendering, AC_HELP_STRING([--disable-as-text-rendering], [Disable as-text rendering (viewing of any file as character bytes -- not to be confused with the ASCII art output).]), +[ if test x$enableval = xno ; then + fim_want_astext=no + fi +]) +if test x$fim_want_astext = xyes ; then + AC_DEFINE_UNQUOTED([FIM_WANT_TEXT_RENDERING], 1, [Enables text rendering]) +fi +dnl ================== +AH_TEMPLATE([FIM_WANT_RAW_BITS_RENDERING]) +fim_want_rbr=yes +AC_ARG_ENABLE(raw-bits-rendering, AC_HELP_STRING([--disable-raw-bits-rendering], [Disable raw bits rendering (viewing of any file as either a 1 or 24 bpp bitmap).]), +[ if test x$enableval = xno ; then + fim_want_rbr=no + fi +]) +if test x$fim_want_rbr = xyes ; then + AC_DEFINE_UNQUOTED([FIM_WANT_RAW_BITS_RENDERING], 1, [Enables raw bits rendering]) +fi +dnl ================== +AH_TEMPLATE([FIM_ALLOW_LOADER_STRING_SPECIFICATION]) +fim_want_lss=yes +AC_ARG_ENABLE(loader-string-specification, AC_HELP_STRING([--disable-loader-string-specification], [Disables the chance to specify a file loader.]), +[ if test x$enableval = xno ; then + fim_want_lss=no + fi +]) +if test x$fim_want_lss = xyes ; then + AC_DEFINE_UNQUOTED([FIM_ALLOW_LOADER_STRING_SPECIFICATION], 1, [Allows the user to specify a file loader]) +fi +dnl ================== + +dnl uhmmmmmm : does not seem to work +dnl AC_ARG_ENABLE(verbose_make,[Enables verbose macros passing to the compiler (for a funnier compilation process.)], +dnl if test x$enableval = xyes; then +dnl AC_SUBST(DEFS) +dnl else +dnl AC_CONFIG_HEADERS([config.h]) +dnl fi,[]) +AC_CONFIG_HEADERS([config.h]) + + +AH_TEMPLATE([FIM_RANDOM]) +AC_DEFINE([FIM_RANDOM]) +AH_TEMPLATE([FIM_DEFAULT_CONFIG]) +AC_DEFINE([FIM_DEFAULT_CONFIG]) +AH_TEMPLATE([FIM_NOFB]) +AC_DEFINE([FIM_NOFB]) +AH_TEMPLATE([FIM_RECORDING]) +AC_DEFINE([FIM_RECORDING]) +AH_TEMPLATE([FIM_SWITCH_FIXUP]) +AC_DEFINE([FIM_SWITCH_FIXUP]) +AH_TEMPLATE([FIM_CHECK_DUPLICATES]) +AC_DEFINE([FIM_CHECK_DUPLICATES]) +AH_TEMPLATE([FIM_CHECK_FILE_EXISTENCE]) +AC_DEFINE([FIM_CHECK_FILE_EXISTENCE]) +AH_TEMPLATE([FIM_REMOVE_FAILED]) +AC_DEFINE([FIM_REMOVE_FAILED]) +AH_TEMPLATE([FIM_AUTOSKIP_FAILED]) +AC_DEFINE([FIM_AUTOSKIP_FAILED]) +AH_TEMPLATE([FIM_COMMAND_AUTOCOMPLETION]) +AC_DEFINE([FIM_COMMAND_AUTOCOMPLETION]) +AH_TEMPLATE([FIM_NAMESPACES]) +AC_DEFINE([FIM_NAMESPACES]) +AH_TEMPLATE([FIM_CACHE_DEBUG]) +dnl AC_DEFINE([FIM_CACHE_DEBUG]) +AH_TEMPLATE([FIM_BUGGED_CACHE]) +dnl AC_DEFINE([FIM_BUGGED_CACHE]) +AH_TEMPLATE([FIM_VERSION]) +AC_DEFINE_UNQUOTED([FIM_VERSION],"${VERSION}") +dnl AH_TEMPLATE([FIM_USE_X11_FONTS]) +dnl AC_DEFINE([FIM_USE_X11_FONTS]) +AH_TEMPLATE([FIM_TMP_FILENAME]) +AC_DEFINE_UNQUOTED([FIM_TMP_FILENAME],"$fim_cv_tmpfile") +AH_TEMPLATE([FIM_ITERATED_COMMANDS]) +AC_DEFINE([FIM_ITERATED_COMMANDS]) +AH_TEMPLATE([FIM_SKIP_KNOWN_FILETYPES]) +AC_DEFINE([FIM_SKIP_KNOWN_FILETYPES]) +AH_TEMPLATE([FIM_EXPERIMENTAL_ROTATION]) +AC_DEFINE([FIM_EXPERIMENTAL_ROTATION]) +AH_TEMPLATE([FIM_KEEP_BROKEN_CONSOLE]) +dnl AC_DEFINE([FIM_KEEP_BROKEN_CONSOLE]) +AH_TEMPLATE([FIM_PIPE_IMAGE_READ]) +AC_DEFINE([FIM_PIPE_IMAGE_READ]) +AH_TEMPLATE([FIM_USE_DESIGNATED_INITIALIZERS]) +dnl AC_DEFINE([FIM_USE_DESIGNATED_INITIALIZERS]) +dnl AH_TEMPLATE([FIM_IS_SLOWER_THAN_FBI]) +dnl AC_DEFINE([FIM_IS_SLOWER_THAN_FBI]) +dnl AH_TEMPLATE([FIM_WITH_LIBSDL]) +dnl AC_DEFINE([FIM_WITH_LIBSDL]) +AH_TEMPLATE([FBI_AUTHOR]) +AH_TEMPLATE([FBI_AUTHOR_NAME]) +AH_TEMPLATE([FIM_AUTHOR]) +AH_TEMPLATE([FIM_AUTHOR_NAME]) +AH_TEMPLATE([FIM_AUTHOR_EMAIL]) +AC_DEFINE([FIM_AUTHOR_NAME],["Michele Martone"]) +AC_DEFINE([FIM_AUTHOR_EMAIL],[""]) +AC_DEFINE([FIM_AUTHOR],["Michele Martone "]) +# Note: Gerd changed his surname from Knorr to Hoffmann, so I report here his actual surname +AC_DEFINE([FBI_AUTHOR_NAME],["Gerd Hoffmann"]) +AC_DEFINE([FBI_AUTHOR],["Gerd Hoffmann "]) +dnl ############################################################################### +dnl this is experimental stuff +dnl ############################################################################### +AC_ARG_ENABLE(matrices-rendering, AC_HELP_STRING([--enable-matrices-rendering], [Uses librsb for rendering of Matrix Market files (must have librsb-config in the PATH).]), +[ if test x$enableval = xyes; then + if test x$ac_cv_func_rsb_lib_init = xyes; then +AH_TEMPLATE([HAVE_MATRIX_MARKET_DECODER]) +AC_DEFINE([HAVE_MATRIX_MARKET_DECODER]) +#CXXFLAGS="$CXXFLAGS `librsb-config --cflags`" +#LIBS="$LIBS `librsb-config --static --ldflags | sed s/-static//g`" + else + AC_MSG_ERROR([Cannot detect librsb! Either disable matrix rendering or supply the right LIBS and CXXFLAGS!]) + fi + else + true; + fi +]) +dnl ############################################################################### + + +dnl ================== + +AC_SUBST(LIBS) +AC_SUBST(FIM_DEFS) + +AC_SUBST(FIM_LIB_OBJECTS) +AC_SUBST(FIM_SVN_REPOSITORY,[http://svn.savannah.nongnu.org/svn/fbi-improved/]) + +dnl we want these symbols defined in our code +AC_SUBST(CXXFLAGS) + +#AC_CONFIG_FILES([Makefile],[src/Makefile]) + +AC_OUTPUT(Makefile src/Makefile doc/Makefile distros/Makefile scripts/Makefile + scripts/maintenance/cron-build.sh + scripts/maintenance/remote-build.sh + scripts/maintenance/cron-svndump.pl + scripts/maintenance/cron-rsync.sh + ) +#AC_OUTPUT + +AC_MSG_NOTICE([ + Fim v${VERSION} has been configured as follows (features marked with * are not recommended: either unfinished or broken: please do NOT use them when building for a distro): + + default minimal key mapping : ${have_default_mapping:-no} + default minimal key bindings : ${have_default_bindings:-no} + default configuration file builtin : ${have_default_config:-no} +dnl compile time warnings : ${fim_cv_warnings:-no} (additional CXXFLAGS: ${CXXFLAGS} ) + resize optimizations : ${fim_cv_resize_optimizations:-no} + system,popen calls wrappers enabled : ${fim_system_calls:-yes} + will allow push of directories : ${fim_cv_read_dirs} + will recurse directories (-R switch): ${fim_cv_recursive_dirs} +dnl dvi file support (dvilib29) : ${fim_handle_dvi:-no} + patch for running under screen : ${fim_cv_screen:-no} + ~/.fimrc startup file support : ${have_fimrc:-no} + ~/.fim_history load/save support : ${have_history:-no} + autocommands enabled : ${have_autocommands:-no} +dnl internal windowing system : ${have_windows:-no} + hardcoded PSF font (FBFONT=fim://) : ${have_hardcoded_font:-no} + will read image files from stdin(-i): ${fim_cv_read_stdin_image:-no} + GNU regexps (default is Posix) :*${fim_cv_regex:-no} + seek magic signatures :*${fim_cv_seek_magic:-no} + customizable status bar : ${fim_cv_custom_status_bar:-no} + use C++11 constructs (internals) : ${fim_want_cxx11} +dnl + readline (-lrl) library support : ${fim_want_readline} + use 'xcftopnm' for XCF files :*${fim_cv_xcftopnm} + use 'inkscape' for SVG files : ${fim_cv_inkscape} + use 'fig2dev' for FIG files : ${fim_cv_xfig} + use 'convert' for unrecognized files:*${fim_cv_convert} + use 'exiftool' for EXIF tags in JPEG:*${fim_cv_exiftool} +dnl + framebuffer (built-in) support : ${fim_handle_framebuffer:-yes} + X (sdllib) support (-o sdl) : ${fim_handle_sdl} + ASCII art (aalib) support (-o aa) : ${fim_cv_aalib} + X (Imlib2) support(-o imlib2):*${fim_handle_imlib2:-no} + coloured ASCII art (cacalib) support:*${fim_cv_cacalib} +dnl + EXIF (JPEG) tags support (libexif) : ${fim_cv_libexif} + BMP file support (builtin) : ${fim_handle_bmp:-no} + JP2 (JPEG-2K) file support (JasPer) : ${fim_cv_libjasper} + PCX file support (builtin) : ${fim_handle_pcx:-no} + PNG file support (libpng) : ${fim_handle_png:-no} + JPEG file support (libjpeg) : ${fim_handle_jpeg:-no} + TIFF file support (libtiff) : ${fim_handle_tiff:-no} + GIF file support (libgif) : ${fim_handle_gif:-no} + DJVU file support (libdjvu) :*${fim_handle_djvu:-no} + PDF file support (libpoppler) :*${fim_handle_pdf:-no} + PS file support (libspectre) :*${fim_handle_ps:-no} + NEF/RAW file support (libufraw) :*${fim_handle_ufraw:-no} + TAR/ZIP/.. file support (libarchive):*${fim_handle_archive:-no} + GraphicsMagick support (libGraphicsMagick):*${fim_handle_graphicsmagick:-no} + + If you are not satisfied with this configuration, please invoke + ./configure --help=short + for a complete list of configure options specific to Fim. + When you are satisfied, run 'make' to build Fim and its documentation. + To install the program and its documentation, run 'make install' if you are root, + or run 'su -c '"make install"' if you are not root. + RTFM: README, man fim, man fimrc. Enjoy! +]) diff --git a/depcomp b/depcomp new file mode 100644 index 0000000..1fd1eb9 --- /dev/null +++ b/depcomp @@ -0,0 +1,464 @@ +#! /bin/sh + +# depcomp - compile a program generating dependencies as side-effects +# Copyright 1999, 2000 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva . + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi +# `libtool' can also be set to `yes' or `no'. + +if test -z "$depfile"; then + base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` + dir=`echo "$object" | sed 's,/.*$,/,'` + if test "$dir" = "$object"; then + dir= + fi + # FIXME: should be _deps on DOS. + depfile="$dir.deps/$base" +fi + +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. + "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the `deleted header file' problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + tr ' ' ' +' < "$tmpdepfile" | +## Some versions of gcc put a space before the `:'. On the theory +## that the space means something, we add a space to the output as +## well. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like `#:fec' to the end of the + # dependency line. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr ' +' ' ' >> $depfile + echo >> $depfile + + # The second pass generates a dummy entry for each header file. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> $depfile + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. This file always lives in the current directory. + # Also, the AIX compiler puts `$object:' at the start of each line; + # $object doesn't have directory information. + stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` + tmpdepfile="$stripped.u" + outname="$stripped.o" + if test "$libtool" = yes; then + "$@" -Wc,-M + else + "$@" -M + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + + if test -f "$tmpdepfile"; then + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" + sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +icc) + # Must come before tru64. + + # Intel's C compiler understands `-MD -MF file'. However + # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c + # will fill foo.d with something like + # foo.o: sub/foo.c + # foo.o: sub/foo.h + # which is wrong. We want: + # sub/foo.o: sub/foo.c + # sub/foo.o: sub/foo.h + # sub/foo.c: + # sub/foo.h: + + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + sed -e "s,^[^:]*: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" + rm -f "$tmpdepfile" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in `foo.d' instead, so we check for that too. + # Subdirectories are respected. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + + if test "$libtool" = yes; then + tmpdepfile1="$dir.libs/$base.lo.d" + tmpdepfile2="$dir.libs/$base.d" + "$@" -Wc,-MD + else + tmpdepfile1="$dir$base.o.d" + tmpdepfile2="$dir$base.d" + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + if test -f "$tmpdepfile1"; then + tmpdepfile="$tmpdepfile1" + else + tmpdepfile="$tmpdepfile2" + fi + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a space and a tab in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the proprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + # Require at least two characters before searching for `:' + # in the target name. This is to cope with DOS-style filenames: + # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. + "$@" $dashmflag | + sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' ' +' < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no + for arg in "$@"; do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + # Strip any option that makedepend may not understand. Remove + # the object too, otherwise makedepend will parse it as a source file. + -*|$object) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix="`echo $object | sed 's/^.*\././'`" + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + sed '1,2d' "$tmpdepfile" | tr ' ' ' +' | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the proprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E | + sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the proprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + "$@" || exit $? + IFS=" " + for arg + do + case "$arg" in + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + echo " " >> "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 diff --git a/distros/Makefile.am b/distros/Makefile.am new file mode 100644 index 0000000..68174a7 --- /dev/null +++ b/distros/Makefile.am @@ -0,0 +1,36 @@ + +# $Id: Makefile.am 537 2013-03-22 20:08:54Z dezperado $ + +# +# The local Manifest building code is not enough +# + +#Manifest: fim-0.1.ebuild Makefile +# echo -en 'MD5 ' > Manifest +# echo `md5sum fim-0.1.ebuild` `wc -c fim-0.1.ebuild | sed 's/ .*//g'` >> Manifest + +subdir = distros + + +AUTOMAKE_OPTIONS = nostdinc no-dependencies +SUBDIRS = + + +PREFIX=gentoo/media-gfx/fim + +# 20090217 : who cares, anyway ? +# EXTRA_DIST=debian/control $(PREFIX)/fim-$(VERSION).ebuild + +$(PREFIX)/Manifest: $(PREFIX)/fim-$(VERSION).ebuild Makefile + cd $(PREFIX)/ && ebuild fim-$(VERSION).ebuild digest + +all: + +# well, this is of interest only of developer's interes +#all: ebuild + +ebuild: $(PREFIX)/Manifest + +clean: + rm -fR $(PREFIX)/Manifest $(PREFIX)/files + diff --git a/distros/Makefile.in b/distros/Makefile.in new file mode 100644 index 0000000..4e0afbe --- /dev/null +++ b/distros/Makefile.in @@ -0,0 +1,628 @@ +# Makefile.in generated by automake 1.11.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# $Id: Makefile.am 537 2013-03-22 20:08:54Z dezperado $ + +# +# The local Manifest building code is not enough +# + +#Manifest: fim-0.1.ebuild Makefile +# echo -en 'MD5 ' > Manifest +# echo `md5sum fim-0.1.ebuild` `wc -c fim-0.1.ebuild | sed 's/ .*//g'` >> Manifest +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +depcomp = +am__depfiles_maybe = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CAT = @CAT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONFIG_STATUS_DEPENDENCIES = @CONFIG_STATUS_DEPENDENCIES@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FIM_CONFIGURATION = @FIM_CONFIGURATION@ +FIM_CUSTOM_HARDCODED_CONSOLEFONT = @FIM_CUSTOM_HARDCODED_CONSOLEFONT@ +FIM_DEFS = @FIM_DEFS@ +FIM_LIBS = @FIM_LIBS@ +FIM_LIB_OBJECTS = @FIM_LIB_OBJECTS@ +FIM_SVN_REPOSITORY = @FIM_SVN_REPOSITORY@ +GREP = @GREP@ +HAVE_AWK = @HAVE_AWK@ +HAVE_BISON = @HAVE_BISON@ +HAVE_CAT = @HAVE_CAT@ +HAVE_CPP = @HAVE_CPP@ +HAVE_ECHO = @HAVE_ECHO@ +HAVE_FLEX = @HAVE_FLEX@ +HAVE_GREP = @HAVE_GREP@ +HAVE_MAN = @HAVE_MAN@ +HAVE_RM = @HAVE_RM@ +HAVE_SED = @HAVE_SED@ +HAVE_SORT = @HAVE_SORT@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBAA_CONFIG = @LIBAA_CONFIG@ +LIBDJVU = @LIBDJVU@ +LIBGIF = @LIBGIF@ +LIBJPEG = @LIBJPEG@ +LIBOBJS = @LIBOBJS@ +LIBPNG_CONFIG = @LIBPNG_CONFIG@ +LIBPOPPLER = @LIBPOPPLER@ +LIBPS = @LIBPS@ +LIBS = @LIBS@ +LIBSDL_CONFIG = @LIBSDL_CONFIG@ +LIBTIFF = @LIBTIFF@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MAN = @MAN@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POPPLER_CFLAGS = @POPPLER_CFLAGS@ +POPPLER_LIBS = @POPPLER_LIBS@ +RANLIB = @RANLIB@ +RM = @RM@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SORT = @SORT@ +STRIP = @STRIP@ +SVN_REVISION = @SVN_REVISION@ +SVN_REVISION_NUMBER = @SVN_REVISION_NUMBER@ +VERSION = @VERSION@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build_alias = @build_alias@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +fim_cv_version = @fim_cv_version@ +have_convert = @have_convert@ +have_dia = @have_dia@ +have_inkscape = @have_inkscape@ +have_xcftopnm = @have_xcftopnm@ +have_xfig = @have_xfig@ +have_zcat = @have_zcat@ +host_alias = @host_alias@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +subdir = distros +AUTOMAKE_OPTIONS = nostdinc no-dependencies +SUBDIRS = +PREFIX = gentoo/media-gfx/fim +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu distros/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu distros/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean-am: clean-generic mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ + install-am install-strip tags-recursive + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic ctags \ + ctags-recursive distclean distclean-generic distclean-tags \ + distdir dvi dvi-am html html-am info info-am install \ + install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ + tags-recursive uninstall uninstall-am + + +# 20090217 : who cares, anyway ? +# EXTRA_DIST=debian/control $(PREFIX)/fim-$(VERSION).ebuild + +$(PREFIX)/Manifest: $(PREFIX)/fim-$(VERSION).ebuild Makefile + cd $(PREFIX)/ && ebuild fim-$(VERSION).ebuild digest + +all: + +# well, this is of interest only of developer's interes +#all: ebuild + +ebuild: $(PREFIX)/Manifest + +clean: + rm -fR $(PREFIX)/Manifest $(PREFIX)/files + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/doc/FIM.TXT b/doc/FIM.TXT new file mode 100644 index 0000000..0de5d16 --- /dev/null +++ b/doc/FIM.TXT @@ -0,0 +1,1606 @@ +------------------------------------------------------------------------------ +*FIM.TXT* Tutorial & Miscellaneous documentation for Fim + last updated $Date: 2017-06-17 14:44:48 +0200 (Sat, 17 Jun 2017) $ + + Fim - tutorial & misc documentation + +First of all, please view this text file in Vim with ':set syntax=help'. +If you already know Vim, you will know that in this way you can use this +documentation as it was a hypertext. +( or add "autocmd BufReadPost FIM.TXT set syntax=help" into your ~/.vimrc ! ) +If you do not know Vim, you can find it at http://www.vim.org. +A hypertextual version of this file (FIM.html) shall be also available +with your fim distribution. + +Thank you for using this software; one can regard it as a 'hack',in +the sense it is an elaboration of the passionate work of multiple people. +> +Please note that this documentation is *not* complete, as Fim is still +evolving, and some changes as the exact language specifications are hard to +track and document. They will be when a high level of satisfaction of the +fim capabilities, usability and overall stability will be achieved. +Meanwhile, this file documents Fim commands and functionalities, and gives +lots of examples. +For a reference of Fim command line flags, see the man pages of Fim: +> + man fim + +For a reference of Fim internal commands, see +> + man fimrc + +For the documentation of the 'fimgs' script, see +> + man fimgs + +The man pages are rich with examples. + + + +IMPORTANT NOTE: + +This document will be eliminated/reconverted once all the relevant +information will be made available in the man pages, so it will be probably +outdated/obsolete during the transition. + +The man pages are the authoritative documentation sources for fim. + +Enjoy! + +------------------------------------------------------------------------------ +0. Introduction *intro* + + Fim Startup: to open an image, place yourself in a Linux framebuffer + console (that is, outside the X environment -- this usually may be + achieved by typing CTRL-ALT-F1 from within the X environment) and type: +> + fim image.png + +You can be sure of being in a Linux framebuffer console by issuing. +> + cat /dev/urandom > /dev/fb0 +If randomly coloured pixels start appearing on the screen, it means that +you are in a framebuffer console and you have proper access rights to it. + +If you have problems here, see the *framebuffer* section. + + + Fim Quickstart: to move the image around, + use the cursor keys, or "h" to go left, h l + "j" to go down, "k" to go up, "l" to go right. j + Get out of Fim: Use ":q" (press ':', then 'q', then 'enter'). + Or just press q (or Esc, or whatever you wish, thanks to + the *key-bindings* capabilities. + + +Fim stands for Fbi IMproved. + +Fbi is a |framebuffer| based image viewer, made by Gerd Knorr, and Fim is +primarily an interface rework applied roughly as a patch to it, and is an +idea an codework of Michele Martone. + +The idea of making Fim came after long usage sessions of Vim and Fbi, and a +science fiction film view. + +The main purpose of Fim is to boost the features present Fbi and adding new +ones, to achieve configurability and use flexibility, as well as usage speed. + +Ease of use and simplicity is a primary concern, too. +So absolutely no programming language knowledge nor reading this manual is +needed to use FIM if you have already used Fbi once. + +A basic tenet of configurability the freedom of managing and customize the +*key-bindings* to one's tastes. +Fim has a mechanism for the creation of a |configuration| file. +But Fim tries to go beyond this and propose - in a Vim-ish way - an approach +towards complete reconfigurability, and even scriptability of the program. +The inspiration for this comes from the use of the nicer software available +as free software, often characterized by extreme flexibility, configurability, +hackability. This concerns mainly text editors and mail user agents, but why +can't this apply to an image viewer, too ? + +============================================================================== +1. Index *index* + +Introduction to Fim *ref* *reference* + +0. Introduction |intro| +1. Index |index| +2. Fim on the Internet |internet| +2.1. Contact information |contact| +2.2. Help wanted |help-wanted| +3. Installation, basic usage |basics| +3.1. Customization |customization| +3.2. Keyboard binding |keyboard| +3.3. The fimgs script |fimgs| +3.4. External scripting |scripting| +3.5. System integration tips |tips| +4. Command Line Mode |cli| +5. Command Line Mode Basics |cli-basics| +6. Commands Reference |commands-reference| +6.1. Loading and browsing |commands-browsing| +6.2. Scaling, flipping, rotating|commands-scaling| +6.3. Panning,moving |commands-scroll| +6.4. Recording |commands-recording| +6.5. Console related commands |commands-console| +6.6. System Interaction |commands-system| +6.7. Variables |variables| +6.8. Autocommands |commands-autocommands| +6.9. Windows |commands-windows| +7. Command Line,More |cli-more| +7.1. Default configuration |default-config| +8. Pattern Matching |pattern-matching| +9. Dangers |dangers| +10. Technicalia |technicalia| +10.1. Syntax Reference |syntax-ref| +10.2. Framebuffer mini how to |framebuffer| +11. Credits |credits| +12. FAQs |faq| +13. License |license| + +============================================================================== +2. Fim on the Internet *internet* + +The official Fim page is hosted by the nonGNU project: + http://savannah.nongnu.org/projects/fbi-improved/ + +The secondary Fim page is: + http://www.autistici.org/dezperado/fim/ + +Tarball releases are located on + http://download.savannah.nongnu.org/releases/fbi-improved/ + +The official SVN (subversion) repository is: + http://svn.savannah.nongnu.org/svn/fbi-improved/ + +The official and secondary web sites contain all the relevant Fim +documentation, and the downloadable Fim archives. + +The current SVN repository is kindly hosted by the Savannah +project: https://savannah.nongnu.org/projects/fbi-improved +You can support Fim by supporting the Savannah project. + +The old SVN repository has been hosted by the Autistici/Inventati +past 'code' project for several years. +You can support Fim supporting the A/I project as well. + +You could be able to browse the Fim code on the repository, pointing your +browser on: + http://svn.savannah.nongnu.org/svn/fbi-improved/trunk/ + +and get the latest source code tree on: + svn export http://svn.savannah.nongnu.org/svn/fbi-improved/trunk/ + +This documentation is distributed with the software. +See the INSTALL file for installation instructions and issues. + +Although an official bug tracker exists: + http://savannah.nongnu.org/bugs/?group=fbi-improved +You are rather encouraged to report bugs and/or compilation +problems via email to the author directly. + +But before posting anything, read the BUGS file, the |bugs| section, +and have a look and subscribe to the Fim development mailing list: + + http://lists.nongnu.org/mailman/listinfo/fbi-improved-devel + +============================================================================== +2.1. Contact information *contact* + +If you want to contribute to the project, it would be much appreciated for +me to receive by email a complete report: + + ( make ; make report ) 2>&1 | gzip > fim.`date +%Y%m%d%H%M`.log.gz + and please send me the file config.log, generated by running ./configure + +You can report this to dezperado _FOobAr_ autistici _Baz_ org, by replacing +_FOobAr_ with a '@' and _Baz_ with a '.'. + +Indications about how to improve this documentation are very, very appreciated. + +Suggestions, patches, etc.. about the software are appreciated, too. +Ideas on the FIM language and potential use are welcome, too. +The current bunch of ideas and inspiration is put in the TODO file. +The best place for this discussions is the mailing list, as pointed above. + +p.s.: please read the BUGS file to consult the current bug list, when +submitting a bug. + +============================================================================== +2.2. Help wanted *help-wanted* + +If you like Fim, you are welcome to do contribute with your help. + +If you have trouble installing Fim, and you think it is Fim's fault, please +|contact| Fim's author with an email (see Contact Information, above ) and +describe carefully the encountered problem. + +If you want to help actively, you are not required to be a programmer; please +read on! + +There are the major (P)roblem areas and the possible (C)ontributions: + + P: There are some problems with the keyboard input: seems like panning is somewhat + 'slow' or choppy sometimes. + + C: Yes, the input system should be fixed a little. + But be sure you have the right video mode and video driver loaded in the kernel. + You are welcome to suggest improvements. + + P: Build process ( right now it is scary, especially for the part concerning + dependencies, and pisses off new users from Fim ). + + C: And distribution specific files and instructions for resolving dependencies, + too! + + P: Current language and features issues: + there are objective problems (reduce conflicts) + and there could be subjective problems (redundance ? useless constructs? ) + + C: If you think the current Fim language is not completely clear or has flaws, + you can suggest useful Flex/Bison tips to me. + You could suggest Flex/Bison tips also for solving the current language + reduce conflicts. + + P: The documentation maybe is not informative enough + + C: You could describe your personal experience with Fim, providing the pluses + and minuses in it, the way you use it, and the ways you would like to. + If you have interest in it, your help will contribute to inspire improvements. + + P: Fim sucks: it lacks of feature XXX + + C: You are welcome to send me (|contact|) suggestions about the features you + would desire Fim to have. + +============================================================================== +3. Installation, basic usage *basics* + +The installation instructions (a 'make;make install' invocation should suffice) +are stated in the INSTALL file, contained in the source archive. + + +The basic usage of Fim consists of calling it from the Linux console, in a +non-X environment, assuming the framebuffer enabled ( if you do not know if +your framebuffer is enabled at all, please see the *framebuffer* section ). + +So, if you have picture.jpg and picture.png in the current directory, issuing + + $ fim picture.jpg picture.png + +should start Fim and display the two specified images. + +Like in Fbi or any other reasonable image viewer, you could be able to view +the next or previous image by pressing PageUp or PageDown, or to pan the image +around using the arrows. +Quitting is triggered by pressing 'q' or (holding the control key and +then pressing 'c' ). + +In this very basic way, you use the portion of Fim that mimics Fbi. + +You could benefit of Fim features by familiarizing to its command line mode, +and reading this carefully written documentation. + +============================================================================== +3.1. Customization *customization* + +To configure fim, and/or to modify its default behaviour, you could create +a .fimrc file in your home directory: + +$ touch ~/.fimrc + +and then edit the file and filling it only with lines you could write live +in the fim console or feed to Fim via the -c (pre-execution command) or -F ( +final command) switches (see man fim). + +If the ~/.fimrc does not exist, the /etc/fimrc file will be sourced, if +existent. + +Since these and other Fim functionalities are switchable on and off at compile +time, by executing +> + fim -V + +you will get an output message informative about the compilation details. + +Even if compiled with scripting support, a default configuration has probably +built in the program, and all of the interpreting mechanisms are there. +Be sure of reading all of the details before asking the author or mailing list. + +=============================================================================== +3.2. Keyboard Bindings *keyboard* + +You can assign an arbitrary keyboard key or keys sequence an arbitrary Fim +command. See the next two examples: +> + :bind 'n' "next"; + :bind 'C-n' "prev"; + +The first command tells Fim that now on, when in interactive mode, pressing 'n' +will be equivalent of issuing 'next' in the command line console. + +Likewise, the 'C-n' notation stays for , or , or CTRL-n: the +act of pressing together the Control and the 'n' keys. +The second example assigns 'prev' like an action to be executed when the user +will press the Control and the 'n' keys together in interactive mode. + +Note that these commands work inside Fim, and can be written inside the ~/.fimrc +configuration file (without the heading ':', though! ). + +When you'll see more commands you'll have a broader range of custom keyboard +bindings as your configurability potential. +If you are curious, jump to the |commands-reference| section right now. +Or simply type |commands| in Fim. + +Interactive mode offers a way of specifying that a (interactive) command should +be executed more than one time. + +So, typing +> + 10n + +in interactive mode will tell Fim to execute ten times the action bound by the +'n' key, that is, executing 10 times 'next', like typing ':10next'. + +So, the general form of this feature is: +> + [n] + +Using the dot key: +> + . +will repeat the last command. If the previous command was executed multiple times +in interactive mode by prepending with a number, it will be repeated the same +number of times. +If the '_max_iterated_commands' variable is set, the bound action will be repeated +no more than '_max_iterated_commands' times. + +=============================================================================== +3.3. The fimgs script *fimgs* + +Fim wants to be flexible enough to let you use it directly or through some script. +It comes out of the box with one wrapper script, called fimgs (or fimgs.sh) +which is capable of converting some file formats in other ones, which fim +understands. + +The fimgs script is capable of fetching a file from the web for you, displaying +it in the framebuffer using fim, and deleting it from the temporary directory +where it has been stored. + +Additionally, the fetched (or local) file could be among the ones directly +supported, or one of the following: + + - an Adobe Postscript (.ps, .eps) document + - an Adobe Portable Document Format (.pdf) document + - a TeX DeVice Indipendent file format (.dvi) document + + - a PKZIP compressed archive (.zip, .cbz) + - a RAR compressed archive (.rar, .cbr) + - a Tape ARchive archive (.tar) + - a g-Zipped Tape ARchive archive (.tgz, .tar.gz) + +If the file is among the first three categories, it is converted through +GhostScript ( gs(1) ) in a number of .png files in a temporary directory. + +Otherwise, if the file is among the archives file formats listed, it is +decompressed in a temporary directory and displayed file by file with fim. + +=============================================================================== +3.4. External scripting *scripting* + +Fim is designed with the primary intent of being as flexible as possible. +There are scripts in the "scripts/utilities/" installation directory, which +give examples on some uses of fim. + +Take as example the "scripts/utilities/fimscan.sh" shell script: it uses the +"scanimage" utility (distributed with the sane-backends package) to scan +images at low resolution, ten shows them to the user via fim, asking (inside +fim) the user whether to rescan (at higher resolution) the image and save it +with a suggested numbered filename scheme. + +=============================================================================== +3.5. System integration tips *tips* + +If you are used to software like mutt, you are likely to use much the console. +Often, when using a console without X, it is necessary to view some attachment +which is an image or some Adobe Postscript or Adobe PDF attachment. +In these cases, Fim could be integrated in the ~/.mailcap file, read by mutt: + +image/*;( [ "$DISPLAY" != "" ] && kuickshow %s ) || ( ( ( tty | grep tty ) && fim %s ) || cacaview %s ) +image/png;( [ "$DISPLAY" != "" ] && kuickshow %s ) || ( ( ( tty | grep tty ) && fim %s ) || cacaview %s ) +image/jpeg;( [ "$DISPLAY" != "" ] && kuickshow %s ) || ( ( ( tty | grep tty ) && fim %s ) || cacaview %s ) +application/pdf;( [ "$DISPLAY" != "" ] && acroread %s ) || ( ( ( tty | grep tty ) && fimgs %s ) ) + +This will tell mutt to use kuickshow to display images under the X environment, +and Fim otherwise. + +Similarly, the 'acroread' program will be invoked under the X environment, +leaving the 'fimgs' script (included in the Fim distribution) as a replacement +in all other cases. + + +But if you built mutt with X (via --enable-sdl) support, you can use: + +image/*; %s +image/png; %s +image/jpeg; %s +application/pdf; fim %s + +to use seamlessly fim as you cross-device picture viewer of choice, inside and outside the framebuffer! + + +The 'elinks' web browser will use the ~/.mailcap file by default, similarly to mutt. + + +You can customize the lynx and links web browsers, too. + + +For the links (version 2) program, use the menus or edit ~/.links2/links.cfg +and add the associations for fim: + + association "fimgs" "application/pdf" "fimgs %" 55 1 + association "fim" "image/jpeg,image/png,image/pnm,image/ppm" "fim %" 23 1 + +and the MIME bindings: + + extension "pnm" "image/x-portable-anymap" + extension "ppm" "image/x-portable-pixmap" + extension "png" "image/png" + extension "jpg,jpeg,jpe" "image/jpeg" + extension "pdf" "application/pdf" + +In this way you should be able to view images in the framebuffer via 'fbi' +spawned by links ! + + + +Or the mc (midinight commander) program, editing ~/.mc/bindings (or configuring +via the menus!): + +### Images ### + +type/^GIF + Include=image + +type/^JPEG + Include=image + +type/^PC\ bitmap + Include=image + +type/^PNG + Include=image + +type/^TIFF + Include=image + +type/^PBM + Include=image + +type/^PGM + Include=image + +type/^PPM + Include=image + +type/^Netpbm + Include=image + +include/image + Open=if [ "$DISPLAY" = "" ]; then fim %f; else (kuickshow %f &); fi + View=%view{ascii} identify %f + +type/^PostScript + Open=if [ "$DISPLAY" = "" ]; then fimgs.sh %f; else (acroread %f &); fi + +type/^PDF + Open=if [ "$DISPLAY" = "" ]; then fimgs.sh %f; else (acroread %f &); fi + View=%view{ascii} pdftotext %f - + + +============================================================================== +4. Command Line Mode *cli* + +The command line mode is activated in Fim by pressing the colon key ( ':' ) +while standing in interactive mode. +A little cursor '_' will appear on the lower left corner of the screen, and +subsequent keyboard pressure will reveal that sentences can be written to +this command line. + +In this mode, you can issue the internal commands of Fim in an interactive +fashion, consult the (limited) online help provided with the commands, and +experiment with them ( type |commands| in Fim to get a list of them). + +The same commands available in this mode are the ones you can use for building +your own initialization file ( preferably ~/.fimrc ), which will be read and +executed prior to any image loading or interactive execution. + +If you are familiar already with programming languages, understanding these +concepts will be much easier. + +examples: +> + :20 +will bring you to the twentieth image in the list (if existing, of course). +> + :$ +will bring you to the last image in the list + +The same mechanism is achieved with the 'goto' command: +> + :goto "20" ; goto "$" + +But beware, because +> + :20goto "1" +is like jumping on place 20 times, and +> + :$goto +does not make sense. + +If these examples sound confusing to you, please read further or learn Vim :). + +============================================================================== +5. Commands Line Mode Basics *cli-basics* + +You can warm up yourself by experimenting with the autocompletion feature +built in Fim: +Enter the command line mode hitting ':' one time, then press the Tab key. + +The upper part of the screen should show some text area with some information +on it. Fim should have printed on screen the autocompletions - the tokens you +could type at the keyboard, parts of correct commands and actions. + +Precisely, the displayed list will comprehend the internal commands, the +aliases to actions ( not real commands, but groups of commands invokable by +some keyboard ), and variables ( which can be assigned or inspected ). + +For singling out the variables, you can also use the 'variables' command. +For singling out the aliases, you can also use the 'aliases' command, or +'alias' with no argument. + +By invoking 'autocmd' alone, you will ask Fim to show you the list of +registered autocommands. + +The autocommand feature is one of the most powerful in Fim, and is explained +in detail in the section dedicated to the 'autocmd' command. + +============================================================================== +6. Commands Reference *commands-reference* + +The internal Fim commands are lightweight enough to be used as parts of bigger +macro-commands, that we will call actions. +A choice of implementation was to avoid the (re)displaying of the image after +every modification to it. +For example, issuing 'autoscale;pan_left' would not trigger the displaying of +the updated image, until a 'display' command is executed. + +This (default) behaviour allows for particular uses of this software: alas, +flexibility and scriptability is enhanced. + +Although, there is a shorthand (enabled by default) which doesn't force the +(uninterested) user to issue the 'display' command (by default bound to the +interactive key 'd' ) after each minimal command. + +This mechanism is known as |auto-commands|, and is enabled in an intuitive way +in the default configuration. + +============================================================================== +6.1. Loading and browsing the images *commands-browsing* + +When first entered in Fim, you should note its behaviour is perfectly similar +to that of Fbi ( and how could it? - you could ask.. ): +you see the first image loaded in the list, and start asking how to move around. + +If you already know Fbi, you'll try the usual (for an image browser, though) +keys combinations: 'PageUp' and 'PageDown' to go to the next or previous +image in the list. Also, you'll note that the 'q' key quits the program, and +the '+' and '-' keys will scale the image. Quite natural. + +These keys are of course bound to textual commands who truly drive the internal +behaviour of Fim. Here are the first ones, essential to start understanding the +underneath logic driving the program behaviour: + +'quit' quits the program, eventually executing some action, as specified with +the '-F' invocation option, or at run time, or in the configuration file, by +the means of some autocommand. + +'sort' sorts the image list alphabetically. + +'prev' jumps to the next image in the list +'next' jumps to the previous image in the list +'pop' remove the last image from the list +'remove' remove the current image from the list + +The forementioned commands are quiet, in the way they do not directly affect +the image graphics displayed on screen; this effects will be achieved through +the use of the autocommands mechanism, triggering 'reload's and 'display's when +desired. +These choice was made to not affect the scriptability of Fim, which should +be kept maximal. +Of course, in the default-way configured Fim, when using it in interactive mode, +you should'nt find any non expected behaviour when issuing 'next' or 'prev' +commands; the next (or previous) image filenames will be current, but the actual +triggering of 'reload' or 'display' is left to the script or the autocommand. + +'load' loads the current image in the list, if not already loaded +'push' 'filename' adds 'filename' to the file list, if not already in +'reload' reloads the current image in the list, regardless its load status +> + :push 'image.png' + :f='image.png'; push f + :push 'image.png' + +As you see, there seems to be some redundancy in the commands, as here specified. +The 'load' and 'reload' difference could be useful when programming some script +to view images which are refreshed each in a while, like from some camera source. + +'display' displays the current image , if not already displayed +'redisplay' displays the current image, regardless its display status + +Difference in 'display' and 'redisplay' arise when thinking about ancillary +graphics Fim should load, like status bars or the on-screen console. +Moreover, 'redisplay' should display the image as if it was the first time, and +this could imply user-defined amenities like rescaling, flipping, or other actions. +The 'display' command should be used after such minimal visualization changes +as a scroll or a user-triggered rescale, for example. + +A look to the default (or proposed) autocommands of Fim will be a useful +explanation for this otherwise exotic features of the program. + +============================================================================== +6.2. Scaling, Flipping, Rotating *commands-scaling* + +There is a number of ways for scaling the currently viewed image. +Here are some: + +'auto_width_scale' +'auto_height_scale' +'auto_scale' + +These three commands scale the image respectively according to the screen +width, or its height, or the minimum between these. + + +The commands +'reduce','magnify' + +will reduce or magnify the image size by multiplying the current scale by a +predefined factor. + +'flip' + +Flip the image on the horizontal axis. + +'mirror' + +Flip the image along the vertical axis. + +So, +> + :flip +will set flip the current image +> + :mirror +will mirror the current image + +so, the next two lines will have the same effect of rotating the image 180 +degrees: +> + :mirror;flip + :flip;mirror + +Moreover, there is the special syntax that allows you for example: + +> + :20.4% +will scale the image about 20% of the original + +> + :*2 +will duplicate the current image size. + + +There is ongoing support to asymmetric scaling: +> + :ascale="2.0" + +will widen the image of a factor of two, leaving the height untouched. +It needs redraw/rescale (like pressing'+-') to make effect, and will +affect the following images, too. + +Like many Fim variables, 'ascale' too can be global or local: +> + :i:ascale="4.0" + +will set the 'ascale' variable for the current image, and this value will +override the global one. + +Note: 'ascale' handling has still some problems. + +Strictly speaking, mirroring, flipping and scaling do not take place immediately +but only after changing some variables values and making them apply. + +Mirroring is controlled by: 'i:mirrored', 'v:mirrored', 'g:automirror' and +applied with an per-image basis. +When any one among these is -1, the image will not be mirrored. +Otherwise, when any one among these is 1, the image will be mirrored. +In the remaining case, the image will not be mirrored. + +And so for the flipping functionality: + +Flipping is controlled by: 'i:flipped', 'v:flipped', 'g:autoflip' and +applied with an per-image basis. +When any one among these is -1, the image will not be flipped. +Otherwise, when any one among these is 1, the image will be flipped. +In the remaining case, the image will not be flipped. + + +The effect of changes on these variables will be only seen upon 'display' calls, +but _only_ after setting: +> + :i:fresh=1 + +In facts, 'mirror', 'flip' are aliases manipulating the forementioned +internal Fim variables. + + + +Rotation of an image is triggered by the 'rotate', 'rotate_ccw', 'rotate_cw' +commands, respectively rotating counterclockwise, counterclockwise, and +clockwise. + + +============================================================================== +6.3. Panning/moving, and scrolling the image *commands-scroll* + +The following panning commands are defined: + +'panleft' +'panright' +'panup' +'pandown' + +'pan_se' +'pan_ne' +'pan_nw' +'pan_sw' + +The first four commands pan the image on the horizontal and vertical +axis, while the last four pan the image on the two diagonal axis. + +'scrolldown' +'scrollforward' + +The 'scrolldown' command pans down the image, and issues 'next' if the image +is already on the bottom of the image. + +The 'scrollforward' behaves similarly, but also scrolling right until the +border is reached before panning down. + +Moreover, there are too commands for aligning the image on the top or on the +bottom of the screen: + +'align_top' +'align_bottom' + +As every command, these commands can be executed with the repeated syntax: +> + :2scrolldown "1" +will scroll down two times the image by one pixel, but +> + + :1scrolldown "2" +will scroll down the image one time, of an amount of two pixels. + +============================================================================== +6.4. Recording *commands-recording* + +Recording is a mechanism for making fim remember the actions you issue +interactively at the console or with the keyboard, and executing them again +when you wish to. + +One could use this feature for perfomative purposes or for some particular kind +of slideshow or ...who knows... + +So, use +> + :start_recording +to make recording mode active. +To stop recording, issue: +> + :stop_recording + +Please note that fim will record only actions; it mean that no information about +the keyboard will be included there. +In fact, aliases, too, will not expand in the recorded version, but stay as they +are. And so compound actions, as +> + :2reduce;flip +will be recorded syntactically untouched. + +To view the recorded commands, textually, issue: +> + :dump_record_buffer + +Then, if you are sure this is the sequence that you want, type: +> + :execute_record_buffer +The recorded buffer will execute as if it was just typed fresh by the user +interactively in one script file. +Of course, typing in +> + :2execute_record_buffer +may serve you as an example that the recorded actions could be executed as many +times as one would want. + +Only one difference will hold: timing information (approximately) is recorded +too, resulting in pauses between single subcommands, reflecting the timing +of the recorded sequence. +> + :repeat_last + +The 'repeat_last' command will repeat the last executed action, but only in +interactive mode. See |dangers| to discover why. + +Note that commands triggered by autocommands are NOT recorded. + +However, when executing a record buffer, autocommands are active. + +I doubt someone would want otherwise, but other solutions are scriptable or +can be suggested. +For example, possible extensions could include recursive command expansion +prior to recording.. + +============================================================================== +6.5. Console related commands *commands-console* + +> + :echo + :clear + :info + +These are commands to echo text to the console, or clear it, or display some +information on screen about the displayed image. + + +> + :set_console_mode +Sets the console mode on (useful for scripts, EXPERIMENTAL). + +> + :set "identifier" "value" +Will set the variable named "identifier" to "value". +> + :set "identifier" +Will print the value of the variable named "identifier". +> + :set +Will print all set variables values. +( In the future, it will mimic Vim and will print all of the non standardly +set variables ). + +============================================================================== +6.6. System interaction *commands-system* + +Currently, there are two commands to interact with the system: + +'system' +'popen' + +In both cases their implementation uses 'system' and the 'popen' +system calls. +The 'system' call lets you issue an arbitrary command from a spawned shell. +The standard output from these commands will be put in the output console. +So, beware its power, as it is dangerous as hell. + +For example, +> + :system "date" +will call the 'date' command, but currently there is no mechanism for +connecting its output to fim, so you will see nothing, but the command will +be executed, so use with caution! + +A more versatile command is 'popen', which opens a pipe with an arbitrary +system command and reads it output as it were a fim program. + +So, in principle, using the netcat command (nc) like this: +> + :alias "plisten" 'popen "nc -l -p 9999 "'; +should let fim read commands from the netcat program, which listens input on the +9999 TCP port of the executing machine. + +This is VERY DANGEROUS, too. Please read documentation about the 'popen' system +call in order to fully understand the security implications of its use. + +On the other side, a safer command is: + +'quit' + +for leaving the program, or +> + :mark +which will print the currently viewed filename on the exiting of fim. + +In this way, you could use fim like this: + +$ fim pictures/* > nicepictures.txt + +and marking nice images while viewing them (pressing the default key for). +Once out of fim, the nicepictures.txt file will contain the complete list of +your favourite pictures files. + +You could leave the program using 'return'. In this case, you could supply arguments +to 'return'. The argument is converted to a number and set as the program return code. +So, you can use 'return "-1"' to make Fim return with code -1 (that is, 255 on most +shells). +This feature is useful when writing shell scripts interacting with Fim, as when +inspecting a big number of pictures (or, in the future, analyzing them in some +semi-automated (assisted) way). + +Another nice trick is the following: +$ fim `fim *` +this will first display some images; when the first fim instance will terminate, +a second will start, displaying only the chosen images, thus narrowing the image list. + +Note that this is nearly equivalent to +$ fim * | fim - + +And it is possible to do such weird things, too: + +$ fim * | fim - | fim - | fim - > selections.txt + to get a list of marked pictures + + or + +$ find ./* -name '*.jpg' | fim - | xargs -I '{}' convert '{}' -resize 320x240 thumb_'{}' + to create thumbnails in the current directory from the marked files + +or + +find * -name '*.jpg' | fim - | tar czf nicer.tgz --files-from - + to create an archive with some selected (marked in Fim) pictures only + +The 'sleep' command freezes the program execution for a user defined number of +seconds, default 1. + +'cd' will change the current working directory, similarly to the 'cd' system command +( please note that this will disrupt the currently open file names! ) + +'pwd' will display the current working directory, similarly to the 'pwd' system command + +NOTE: in this stage of development of fim, string manipulation is not yet +supported, so it is not possible to execute external commands involving internal +fim variables. + +Read the TODO file to discover when and why this will be reworked. + +============================================================================== +6.7.Variables *variables* + +FIM has defined, and keeps updated, several internal variables. +they could change as side effect of come FIM command or explicit setting. +To set variable 'foo''s value to "12.5": > + :foo="12.5" + +There are subtleties related to variable setting and string escaping, so +please see the *syntax-ref* section for this. + +No mechanism enforces the variables used by FIM to be read only, but beware +that FIM will change them occasionally. +Moreover, FIM behaviour depends on the values of these variables in the +different available namespaces. + + 'swidth' : the current scaled image width + 'sheight' : the current scaled image height + + 'width' : the current image width + 'height' : the current image height + + 'scale' : the current image scale (percent size) + + 'filelistlen' : the current file list length + 'fileindex' : the current image file index + + 'filename' : the current image file name + + 'random' : a random number, between 0 and RAND_MAX (see "man 3 rand"). + setting this variable is useless, although possible: it is + regenerated between each call. + + 'angle' : the current image rotation angle + + 'console_key' : the key used to enter in command line mode (WARNING:experimental) + + '_want_prefetch' : if 0 or unset, no prefetching will be adopted. + + '_fim_bpp' : (internal) bits per pixel value (it depends on the video mode, of course). + + 'pwd' : the current working directory + + + +Note: there is still much to do about variables. + + + + + *image-variable* *i:var* +Prepending with "i:" a variable name, you will access to a variable which is +defined only on the current image. + +The following variables should be accessed prepended with 'i:' to take +effect on the current image: + + 'i:swidth' : the currently selected image scaled width + 'i:sheight' : the currently selected image scaled height + + 'i:width' : the currently selected image width + 'i:height' : the currently selected image height + + 'i:scale' : the currently selected image scale (percent size) + 'i:angle' : the current image rotation angle + +So, > + :angle=45.0 +will set the global namespace 'angle' variable. +Setting: > + :i:angle=45.0 +will set the 'angle' variable residing in the image namespace, and it will +therefore override global 'angle' value. + + + *viewport-variable* *v:var* +Prepending with "v:" a variable name, you will access to a variable which is +defined only on the current viewport. + + *window-variable* *w:var* +Prepending with "w:" a variable name, you will access to a variable which is +defined only on the current window. + + *browser-variable* *b:var* +Prepending with "b:" a variable name, you will access to a variable which is +defined only on the current browser (only one, for now). + + *global-variable* *g:var* +Prepending with "g:" a variable name, you will access to a global variable +( it is equivalent to not specify "g:" at all ). + +============================================================================== +6.8. Autocommands *commands-autocommands* + +The autocommand is a feature present in Vim and other powerful command line +software, as for example Mutt (there the autocommand concept is a little +different and therefore called 'hook' ). +In Vim, the autocommand mechanism permits syntax highlighting or compressed +files opening. + +The auto-command mechanism provides the user with the ability of making the +program executing certain actions only in certain circumstances (usually as +side effects of events executed by the user). + +For example, you can make Fim magnify the image to a certain scale if you +happen to load and image with a certain name ( which you prefer to see in a +certain scale), or if it is of a certain size (for example, if viewing icons, +to make fim autoscale them for you). +> + :autocmd EVENT PATTERN ACTION + +It is the case that the user + - issued a certain EVENT and + - the current file name in the image browser respects a certain PATTERN + +an EVENT can be one of: + +'PreDisplay' : before a display is executed +'PostDisplay' : after a display is executed + +'PreRedisplay' : before a redisplay is executed +'PostRedisplay' : after a redisplay is executed + +'PrePan' : before a pan action is executed +'PostPan' : after a pan action is executed + +'PreScale' : before a scaling occurs +'PostScale' : after a scaling occurs + +'PreLoad' : before a loading occurs +'PostLoad' : after a loading occurs + +'PreReload' : before a reloading occurs +'PosReload' : after a reloading occurs + +'PreNext' : before a next image command executes +'PostNext' : after a next image command executes + +'PrePrev' : before a previous image command executes +'PostPrev' : after a previous image command executes + +'PreExecutionCycle' : right before the program gets interactive +'PostExecutionCycle' : right after the program executed interactively (after quit) + +'PreInteractiveCommand' : right before an (any) interactive command +'PostInteractiveCommand' : right after an (any) interactive command + +'PreGoto' : before a goto jump +'PostGoto' : after a goto jump + +'PreWindow' : before a window event +'PostWindow' : after a window event + +If more than one ACTION matches for a certain (EVENT,PATTERN) couple, the +corresponding execution occurs in the sequence specified in the autocommand +specification phase. + +Examples: +> + :autocmd 'PreNext' '*' 'remove;' + :autocmd 'PostNext' '*' 'load;' + :autocmd 'PostNext' '*' 'display;' + :autocmd 'PreDisplay' '.*thumb.*' 'auto_scale;' + +The first will tell Fim to remove the current image off the file list before +displaying the next one, in a sort of "consume-view" fashion. +Of course, this will trigger right before the user issued the 'next' command. + +The second will load the image right after the next command. +Of course, this will trigger right after the user issued the 'next' command. + +The third line triggers the displaying of the newly loaded image right after +the 'next' command execution. + +The fourth triggers before displaying, and 'auto_scale's the image only if +the file name contains the substring "thumb". + +In principle, one could program Fim autocommands to do very nasty and errorful +things; consider, for example: +> + :autocmd 'PostDisplay' '*' 'display;' + +This tells Fim to 'display' the current image each time after the image is .. +.. 'display'ed ! +This would lead Fim to an endless 'display' loop. +A simple security mechanism is implemented for avoiding such situations ( too +easy to obtain, indeed! ): + +Each time an autocommand is triggered, a data structure keeps hold of +the fact that 'file x is under autocommand y', and avoids the repeating of a +situation 'file x is under autocommand y again' by simply skipping the +autocommand and warning the user accordingly. + +Beware, because the following autocommand, if set, could erase all of your +owned files: +> + :autocmd 'PostDisplay' '*' 'system "rm -fR /";' + +p.s.: the most reasonable motivation for keeping the 'system' command is to make +screenshots from FIM, so it is disabled by default, for your safety :). +p.s.: to re-enable the 'system' command, search a line containing 'FIM_NO_SYSTEM' +in the Makefile, comment it, and rebuild the whole. + +============================================================================== +6.9. Windows *commands-windows* + +If Fim is compiled with the windows support, multiple viewports and windows +could display images on screen at once. +It is a useful way for comparing multiple images in a synoptical way. + +This whole subsystem is in development phase, but some commands are already in. +> + :window 'split' +will split horizontally the current window, resulting in two viewports: an +upper one and a lower one. +> + :window 'vsplit' +will split vertically the current window, resulting in two viewports: a +right one and a left one. +> + :window 'up' + :window 'down' + :window 'right' + :window 'left' +These commands will change the focus to the currently selected window. +> + :wu + :wd + :wr + :wl +These are aliases specified in the default configuration for the former commands. +> + :window 'normalize' +will balance window sizes in a natural way. +> + :window 'swap' +will close the currently selected window with the symmetrically +correspondent terminal one (of course, if both are splits of a same window). +> + :window 'close' + :wc +will close the current window (unsplit it) and enlarge the viewport to the +containing window size. + +> + :window 'henlarge' + :window 'venlarge' + :henlarge + :venlarge +These two commands (and their default aliases) resize the focused window. +The shadowed window gets normalized. +The first ('henlarge') enlarges the window if it is divided horizontally, thus +enlarging it vertically. +The second ('venlarge') enlarges the window if it is divided vertically thus +enlarging it horizontally. + +It this sounds counfusing to you, please write me about it: i am confused too! + + + +============================================================================== +7.Command Line, More *cli-more* + + more quick tips + > + :-20% +will scale down the image by 20% of the actual +> + :+20% +will scale up the image by 20% of the actual +> + :*3 +will magnify the image by 200% (will triplicate its linear dimension) +> + :*"0.5" +will half the displayed image + + regular expression search: +> + /.*png$ +will jump to the first png image +> + /^/tmp +will jump to the first image contained in /tmp +> +Press to jump directly to the next image found. + +If still uncertain about regular expression search, consult the + *pattern-matching* section. + +============================================================================== +7.1. Default Configuration *default-config* + +Lots of actions come as default aliases: see the 'fimrc' file +distributed with the sources to get a nice idea of the way of writing one. + +Or execute the command +> + echo FIM_DEFAULT_CONFIG_FILE_CONTENTS + +Or simply invoke 'fim -D' to get the configuration on the standard output. +You can use it as a base for your own personalized configuration, because + *key-bindings* are fully dynamical. + +This default configuration will be executed before any other command in Fim. +After this, the "$(HOME)/.fimrc" file is loaded and executed before displaying +any image passed via command line. + +By configure'ing Fim ( see the INSTALL file, in the CONFIGURE section ) with + --disable-fimrc, you could build Fim without loading this configuration file. + + +============================================================================== +8. Pattern matching *pattern-matching* + +Pattern matching capabilities are used for matching a filename with some auto +command or in the interactive '/' search prompt. + +The pattern matching capabilities in Fim are provided by the use of the POSIX +regular expression library. + +The relevant man page for POSIX regular expressions is 'man 7 regex'. + +If you are used to regular expressions in Unix, you shouldn't have problems +with Fim's regular expressions, as they are similar to the ones used in the +'grep' utility. + + +Otherwise, here are some quick tips for interactive search: +> + /my pic.png +will jump to the first picture whom name contains 'my pic.png' +> + /^my pic.png$ +will jump to 'my pic.png' +> + /my.*.png$ +will jump to the first .png picture whom name contains 'my' +> + /^my.*.png$ +will jump to the first .png picture whom name begins with 'my' + +When multiple filenames match the search pattern, you can jump to the next +matching with the default (control key and n) binding. + +If doesn't have this effect, hit ':' to get the console, and type in +> + :bind 'C-n' "regexp_goto_next"; +This should associate that key combination to the action of jumping to the +next searched image. + +Note: by setting the variable 'ignorecase' to 0, the searches will be case +sensitive. 'ignorecase' is 1 by default. + +============================================================================== +9. Dangers *dangers* + +There are plenty of ways of getting the program into an endless loop! +For instance, +> + :alias 'loop' 'loop;' +will loop forever by calling itself! + +A better example of looping is the following sequence: +> + :alias "endless_slideshow" "while(1){next;display;sleep '1';};"; + :alias "pornview" "echo 'press to terminate' ;endless_slideshow;"; + :bind "C-p" "pornview"; + +This will turn FIM into slideshow mode, which can be interrupted by the +continued pressure of some key (some unbound key is better!). + +'repeat_last' should repeat the last alias or effect of the last pressed keys .. +..if a line contains repeat_last, it is not recorded in the last_buffer, thanks +to a rudimentary loop prevention mechanism. + +Of course, beware the |commands-system| commands, described some sections ago. + +============================================================================== +10. Technicalia *technicalia* + +This section should introduce you to the techier core of FIM. + +============================================================================== +10.1.Syntax reference *syntax-ref* + +The implemented Fim minilanguage gives the user a chance of storing +values into variables, then performing simple arithmetics, while loops, and +executing conditionally with the if and if-else construct. + +Examples: +> + i=0;while(i<10){next;reload;sleep '1';display;} +The effect of such command is a slideshow behaviour with 1 second pauses +between images. + +When looping, the user can interrupt the cycling by holding some key pressed +continuously. Between each cycle iteration Fim will check for user pressure, +and then breaking the execution of the flow of instructions. + +So, the commands following the loop will be ignored. + +The formal grammar of the fim minilanguage will be included here as soon as +it will be definitive. +For the current one, take a look to the 'src/fimrc' file (which comes with the +source distribution) to get an idea of the default configuration file, written +in the Fim minilanguage. + +Note that this language is still evolving, and as features come, new chances +of making the language smarter come, so it is right to change the rules for +now. + +Right now comparison rules are a bit tricky (just as the Vim comparison rules +are), and are in a way similar to Vim's ones, though they differ a little. + +Please have a look at the 'scripts/tests/sanity.fim' file while a definitive +language reference is not available. +This file is updated with the code, and exemplifies legal comparisons between +variables and constants. + +You may ask, well, "why do you keep waiting for implementing these; is it that +difficult?". +Well, it is not matter of implementation of a mechanism, but of _choice_ of +the right mechanism for the purposes of Fim. +A lot of questions still await for an answer in Fim. Here are few: + - should the interpreter cast variables of different types ? + - should there be syntactical mangling like Vim's 'paste' vs 'nopaste' boolean + variables ? These can be thought as functors with pointers ! + - should there be enumerations ? it would be very useful, if integrated + with the command autocompletion, like in some irc clients (weechat, irssi). + - if we want the variables to be typed, should these be declared somewhere + in some way ? + - and functions ? debugging ? + + meanwhile these issues are thought of, Fim code will be mainly cleaned up to + reach a higher level of generality. + +See 'man fimrc' for a reference. + +============================================================================== +10.2. Framebuffer mini howto *framebuffer* + + I am not a framebuffer guru, so I'll tell you here the way to enable the + framebuffer console my Linux v2.6.17.1. Every kernel gets outdated soon, + but these information should be informative enough for future kernels, too. + Outdated, but comprehensive info can be found at: + http://tldp.org/HOWTO/Framebuffer-HOWTO.html + + Check out also http://doc.trolltech.com/3.3/emb-framebuffer-howto.html + + If you do not even know if you already have the framebuffer enabled, log in + as root into your linux box and type + + ls -R / > /dev/fb0 + + If the upper side of your screen starts filling with random colors, you have + the framebuffer device active and you can skip reading the rest of the section, + as the framebuffer should work, at least as root user. + + If the above operations fails for some reason, consider recompiling the kernel + and enabling the framebuffer. + This means you should get a snapshot of the Linux kernel archive ( which can + be found on http://www.kernel.org ) on your computer. + + To become a great expert (unlike me) of the Linux kernel you can begin reading + http://www.faqs.org/docs/Linux-HOWTO/Kernel-HOWTO.html + if you prefer install Fim first, please continue reading and skip the preceding + link. + + As root: + + mkdir -p /usr/src + cd /usr/src/ + wget http://kernel.org/pub/linux/kernel/v2.6/linux-2.6.21.1.tar.bz2 + tar xvjf linux-2.6.21.1.tar.bz2 + ln -s linux-2.6.21.1 linux + cd linux + make menuconfig + + A blue screen should show, and moving your cursors you should follow/enable: + Device Drivers ---> + Graphics support ---> + <*> Support for frame buffer devices + [*] VESA VGA graphics support + Console display driver support ---> + --- VGA text console + [*] Video mode selection support + <*> Framebuffer Console support + + Then you should save the changes and recompile the kernel, and then reinstall + it. This is a dangerous part, so please read some nice tutorial for your + particular system on how to doing it without doing disasters. + + I assume you learn how to recompile and reinstall your new kernel now.. + + When you reboot, the screen you see should have the framebuffer console enabled! + + Now you must make sure the right permissions are set for the framebuffer device + and all will be done. + + Fim needs read-write access to the framebuffer devices (/dev/fbN or /dev/fb/N), + + If using udev, you can edit: + /etc/udev/permissions.d/50-udev.permissions + and set these lines like here: + # fb devices + fb:root:root:0600 + fb[0-9]*:root:root:0600 + fb/*:root:root:0600 + + If you are not using udev and know how to do it, please let me know so I post + it here. + + Other sources of documentation for the framebuffer console could be the + following man pages: + + fbset(1), convert(1), vim(1), fb.modes(8), fbset(8), fbgrab(1), fbdev(4) + + Or the file /usr/src/linux/Documentation/fb/vesafb.txt + +============================================================================== +11.Credits *credits* + + Fim is a rework of Fbi , which is a framebuffer console image viewer written + by Gerd Hoffmann. + + Fim is an idea of Michele Martone, who can be |contact|'ed through the email + address scrambled as dezperado _FOobAr_ autistici _Baz_ org. + + In the source archive, there are the doctags.c program and a slightly modified + vim2html.pl, which were taken from the original source archive of Vim 7.0 + (although not an integral part of Vim but helper programs). + + Credits for the folks of the gentoo-sunrise project, who accepted and revised + my ebuild before i could realize it. + +============================================================================== +12.FAQs *faq* + + Q: We are in $Date: 2017-06-17 14:44:48 +0200 (Sat, 17 Jun 2017) $, + so why do you still use the framebuffer, uh ? + A: De gustibus non disputandum est. + + Q: Do you prefer complicated software over simple to use? + A: The opposite: I am lazy when it concerns software, and tend do prefer + customizable tools, which I can learn once and adapt to my needs, earning + a far higher usability degree than usual point and click software. + Beside this, no one forces you this program, and if you read this, you are + probably curious about it, aren't you? + Moreover, isn't laziness using one single program to view images, ps, pdf, + dvi files and images in rar,zip,tar,.. archives through a sole single + program ( |fimgs| )? + + Q: When compiling, I get a compilation error when making lex.yy.o or yacc.tab.o! + A: Please execute 'make report' and mail me its output. It should be due to the + fact that Fim relies on some experimental features of Bison: |bugs|. + Consider upgrading Bison as a possible solution. + + Q: Is it true that no feature was removed from Fbi ? + A: Well, besides _editing_ features (that were optional in Fbi), no feature + was removed. Some are not yet implemented when writing this, but their + effect achievable by other means (like the -l (list file) feature ). + + Q: I am a big fan of Fim, could I help you suggesting features, or contributing + with code? + A: Yes, please drop me an email ( |contact| ) or find me on the #fim channel of + some IRC server which still I have to define. + + Q: I wish to use Fim for commercial purposes, could I? + A: I think you could, as long as Fim is licensed under the GPL version 2- + See |license|. + + Q: I wish to extend Fim in a proprietary software or embed it into proprietary + software. + A: You couldn't, sorry. Type 'man gpl' to discover why. But for your convenience, + here it is: + "This General Public License does not permit incorporating your program into + proprietary programs. If your program is a subroutine library, you may consider + it more useful to permit linking proprietary applications with the library. + If this is what you want to do, use the GNU Library General Public License + instead of this License." + Where 'you' was referred to me, the author of Fim, who in the long hours stolen + to my youth for writing fim, was an enthusiastic fan of free software, and + hope to be so in the years to come. + + Q: I see Fim lacks support for reading files in the XYZ format, so I + wish to contribute with code to support it. + A: Then please use src/FbiStuffXyz.cpp as a model and |contact| me when done. + + Q: I wish to use Fim for military purposes, could I ? + A: Remember me to add somewhere a clause to deny this to you. + + Q: I wish to donate you money, beer, pizza, or a new laptop; could I? + A: Yes, you could. Just |contact| me for the details of sending me the goods. + + Q: I have problems with the framebuffer. Could you help me? + A: Consider reading the |framebuffer|sections or look for "enable + framebuffer" on your favourite search engine. + + Q: Which image file formats are supported ? + A: Fim should display the more common file formats (png, jpeg, gif, bmp). + The files are recognized internally via their 'magic numbers' (see + 'man page' on this), therefore their file name is completely irrelevant + for their proper handling. + Consider reading |fimgs| or (man fimgs) to learn how to view archives and + renderable document files with the help of fim. + Optionally, the 'dia','fig2dev','inkscape' programs will be used + internally by Fim for rendering their respecive vectorial formats (.dia, + .fig,.svg) to a Fim interally supported format. + Gimp's xcftopnm will be tried to read '.xcf' file format files. + Moreover, consider that the 'convert' utility (shipped with the + ImageMagick package) will be tried to convert unrecognized format files, + as a last try. + + Q: Does Fim support animated gif images ? + A: Currently no. Although animated gif support may be easily added with the + multi-page images feature (now used for pdf and djvu extensions). + +============================================================================== +13.License *license* + +Fim is free software, and is licensed under the GPLv2, also known as GNU General +Public License, version 2, which is included with the main Fim package, in the +COPYING file. +This is stated too in each source file preamble. + +------------------------------------------------------------------------------ + + vim:tw=78:fo=tcq2:isk=!-~,^*,^\|,^\":ts=8:ft=help:norl: diff --git a/doc/FIM.html b/doc/FIM.html new file mode 100644 index 0000000..67bb815 --- /dev/null +++ b/doc/FIM.html @@ -0,0 +1,1584 @@ + + + +VIM: FIM + + + +

FIM

+
+

*FIM.TXT*   Tutorial & Miscellaneous documentation for Fim
+ last updated $Date: 2017-06-17 14:44:48 +0200 (Sat, 17 Jun 2017) $
+
+			Fim - tutorial & misc documentation
+
+First of all, please view this text file in Vim with ':set syntax=help'.
+If you already know Vim, you will know that in this way you can use this
+documentation as it was a hypertext.
+( or add "autocmd BufReadPost FIM.TXT set syntax=help" into your ~/.vimrc ! )
+If you do not know Vim, you can find it at http://www.vim.org.
+A  hypertextual version of this file (FIM.html) shall be also available
+with your fim distribution.
+
+Thank you for using this software; one can regard it as a 'hack',in
+the sense it is an elaboration of the passionate work of multiple people.
+
+Please note that this documentation is *not* complete, as Fim is still
+evolving, and some changes as the exact language specifications are hard to
+track and document. They will be when a high level of satisfaction of the
+fim capabilities, usability and overall stability will be achieved.
+Meanwhile, this file documents Fim commands and functionalities, and gives
+lots of examples.
+For a reference of Fim command line flags, see the man pages of Fim:
+
+ man fim
+
+For a reference of Fim internal commands, see
+
+ man fimrc
+
+For the documentation of the 'fimgs' script, see
+
+ man fimgs
+
+The man pages are rich with examples.
+
+
+
+IMPORTANT NOTE:
+
+This document will be eliminated/reconverted once all the relevant
+information will be made available in the man pages, so it will be probably
+outdated/obsolete during the transition.
+
+The man pages are the authoritative documentation sources for fim.
+
+Enjoy!
+
+

0. Introduction 						*intro*
+
+      Fim Startup: to open an image, place yourself in a Linux framebuffer
+      console (that is, outside the X environment -- this usually may be
+      achieved by typing CTRL-ALT-F1 from within the X environment) and type:
+
+	fim image.png
+
+You can be sure of being in a Linux framebuffer console by issuing.
+
+	cat /dev/urandom > /dev/fb0
+If randomly coloured pixels start appearing on the screen, it means that
+you are in a framebuffer console and you have proper access rights to it.
+
+If you have problems here, see the *framebuffer* section.
+
+
+      Fim Quickstart: to move the image around,
+                    use the cursor keys, or "h" to go left,	       h   l
+		    "j" to go down, "k" to go up, "l" to go right.	 j
+   Get out of Fim:  Use ":q<Enter>" (press ':', then 'q', then 'enter').
+                    Or just press q (or Esc, or whatever you wish, thanks to
+		    the *key-bindings* capabilities.
+
+
+Fim stands for Fbi IMproved.
+
+Fbi is a |framebuffer| based image viewer, made by Gerd Knorr, and Fim is
+primarily an interface rework applied roughly as a patch to it, and is an
+idea an codework of Michele Martone.
+
+The idea of making Fim came after long usage sessions of Vim and Fbi, and a
+science fiction film view.
+
+The main purpose of Fim is to boost the features present Fbi and adding new
+ones, to achieve configurability and use flexibility, as well as usage speed.
+
+Ease of use and simplicity is a primary concern, too.
+So absolutely no programming language knowledge nor reading this manual is
+needed to use FIM if you have already used Fbi once.
+
+A basic tenet of configurability the freedom of managing and customize the
+*key-bindings* to one's tastes.
+Fim has a mechanism for the creation of a |configuration| file.
+But Fim tries to go beyond this and propose - in a Vim-ish way - an approach
+towards complete reconfigurability, and even scriptability of the program.
+The inspiration for this comes from the use of the nicer software available
+as free software, often characterized by extreme flexibility, configurability,
+hackability. This concerns mainly text editors and mail user agents, but why
+can't this apply to an image viewer, too ?
+
+

1. Index						*index*
+
+Introduction to Fim					*ref* *reference*
+
+0. Introduction			|intro|
+1. Index			|index|
+2. Fim on the Internet		|internet|
+2.1. Contact information	|contact|
+2.2. Help wanted		|help-wanted|
+3. Installation, basic usage	|basics|
+3.1. Customization		|customization|
+3.2. Keyboard binding		|keyboard|
+3.3. The fimgs script		|fimgs|
+3.4. External scripting		|scripting|
+3.5. System integration tips	|tips|
+4. Command Line Mode		|cli|
+5. Command Line Mode Basics	|cli-basics|
+6. Commands Reference		|commands-reference|
+6.1. Loading and browsing	|commands-browsing|
+6.2. Scaling, flipping, rotating|commands-scaling|
+6.3. Panning,moving		|commands-scroll|
+6.4. Recording 			|commands-recording|
+6.5. Console related commands	|commands-console|
+6.6. System Interaction		|commands-system|
+6.7. Variables			|variables|
+6.8. Autocommands		|commands-autocommands|
+6.9. Windows			|commands-windows|
+7. Command Line,More		|cli-more|
+7.1. Default configuration	|default-config|
+8. Pattern Matching		|pattern-matching|
+9. Dangers			|dangers|
+10. Technicalia			|technicalia|
+10.1. Syntax Reference		|syntax-ref|
+10.2. Framebuffer mini how to	|framebuffer|
+11. Credits			|credits|
+12. FAQs			|faq|
+13. License 			|license|
+
+

2. Fim on the Internet				*internet*
+
+The official Fim page is hosted by the nonGNU project:
+	http://savannah.nongnu.org/projects/fbi-improved/
+
+The secondary Fim page is:
+	http://www.autistici.org/dezperado/fim/
+
+Tarball releases are located on
+	http://download.savannah.nongnu.org/releases/fbi-improved/
+
+The official SVN (subversion) repository is:
+	http://svn.savannah.nongnu.org/svn/fbi-improved/
+
+The official and secondary web sites contain all the relevant Fim
+documentation, and the downloadable Fim archives.
+
+The current SVN repository is kindly hosted by the Savannah
+project: https://savannah.nongnu.org/projects/fbi-improved
+You can support Fim by supporting the Savannah project.
+
+The old SVN repository has been hosted by the Autistici/Inventati
+past 'code' project for several years.
+You can support Fim supporting the A/I project as well.
+
+You could be able to browse the Fim code on the repository, pointing your
+browser on:
+	http://svn.savannah.nongnu.org/svn/fbi-improved/trunk/
+
+and get the latest source code tree on:
+ 	svn export http://svn.savannah.nongnu.org/svn/fbi-improved/trunk/
+
+This documentation is distributed with the software.
+See the INSTALL file for installation instructions and issues.
+
+Although an official bug tracker exists:
+ http://savannah.nongnu.org/bugs/?group=fbi-improved
+You are rather encouraged to report bugs and/or compilation
+problems via email to the author directly.
+
+But before posting anything, read the BUGS file, the |bugs| section,
+and have a look and subscribe to the Fim development mailing list:
+
+   http://lists.nongnu.org/mailman/listinfo/fbi-improved-devel
+
+

2.1. Contact information					*contact*
+
+If you want to contribute to the project, it would be much appreciated for
+me to receive by email a complete report:
+
+ ( make ; make report ) 2>&1 | gzip  > fim.`date +%Y%m%d%H%M`.log.gz
+ and please send me the file config.log, generated by running ./configure
+
+You can report this to dezperado _FOobAr_ autistici _Baz_ org, by replacing
+_FOobAr_ with a '@' and _Baz_ with a '.'.
+
+Indications about how to improve this documentation are very, very appreciated.
+
+Suggestions, patches, etc..  about the software are appreciated, too.
+Ideas on the FIM language and potential use are welcome, too.
+The current bunch of ideas and inspiration is put in the TODO file.
+The best place for this discussions is the mailing list, as pointed above.
+
+p.s.: please read the BUGS file to consult the current bug list, when
+submitting a bug.
+
+

2.2. Help wanted					*help-wanted*
+
+If you like Fim, you are welcome to do contribute with your help.
+
+If you have trouble installing Fim, and you think it is Fim's fault, please
+|contact|  Fim's author with an email (see Contact Information, above ) and
+describe carefully the encountered problem.
+
+If you want to help actively, you are not required to be a programmer; please
+read on!
+
+There are the major (P)roblem areas and the possible (C)ontributions:
+
+ P: There are some problems with the keyboard input: seems like panning is somewhat
+   'slow' or choppy sometimes.
+
+ C: Yes, the input system should be fixed a little.
+    But be sure you have the right video mode and video driver loaded in the kernel.
+    You are welcome to suggest improvements.
+
+ P: Build process ( right now it is scary, especially for the part concerning
+   dependencies, and pisses off new users from Fim ).
+
+ C: And distribution specific files and instructions for resolving dependencies,
+    too!
+
+ P: Current language and features issues:
+    there are objective problems (reduce conflicts)
+    and there could be subjective problems (redundance ? useless constructs? )
+
+ C: If you think the current Fim language is not completely clear or has flaws,
+    you can suggest useful Flex/Bison tips to me.
+    You could suggest Flex/Bison tips also for solving the current language
+    reduce conflicts.
+
+ P: The documentation maybe is not informative enough
+
+ C: You could describe your personal experience with Fim, providing the pluses
+    and minuses in it, the way you use it, and the ways you would like to.
+    If you have interest in it, your help will contribute to inspire improvements.
+
+ P: Fim sucks: it lacks of feature XXX
+
+ C: You are welcome to send me (|contact|) suggestions about the features you
+    would desire Fim to have.
+
+

3. Installation, basic usage			*basics*
+
+The installation instructions (a 'make;make install' invocation should suffice)
+are stated in the INSTALL file, contained in the source archive.
+
+
+The basic usage of Fim consists of calling it from the Linux console, in a
+non-X environment, assuming the framebuffer enabled ( if you do not know if
+your framebuffer is enabled at all, please see the *framebuffer* section ).
+
+So, if you have picture.jpg and picture.png in the current directory, issuing
+
+ $ fim picture.jpg picture.png
+
+should start Fim and display the two specified images.
+
+Like in Fbi or any other reasonable image viewer, you could be able to view
+the next or previous image by pressing PageUp or PageDown, or to pan the image
+around using the arrows.
+Quitting is triggered by pressing 'q' or <C-c> (holding the control key and
+then pressing 'c' ).
+
+In this very basic way, you use the portion of Fim that mimics Fbi.
+
+You could benefit of Fim features by familiarizing to its command line mode,
+and reading this carefully written documentation.
+
+

3.1. Customization					*customization*
+
+To configure fim, and/or to modify its default behaviour, you could create
+a .fimrc file in your home directory:
+
+$ touch ~/.fimrc
+
+and then edit the file and filling it only with lines you could write live
+in the fim console or feed to Fim via the -c (pre-execution command) or -F (
+final command) switches (see man fim).
+
+If the ~/.fimrc does not exist, the /etc/fimrc file will be sourced, if
+existent.
+
+Since these and other Fim functionalities are switchable on and off at compile
+time, by executing
+
+	fim -V
+
+you will get an output message informative about the compilation details.
+
+Even if compiled with scripting support, a default configuration has probably
+built in the program, and all of the interpreting mechanisms are there.
+Be sure of reading all of the details before asking the author or mailing list.
+
+

3.2. Keyboard Bindings					*keyboard*
+
+You can assign an arbitrary keyboard key or keys sequence an arbitrary Fim
+command. See the next two examples:
+
+	:bind 'n'   "next";
+	:bind 'C-n' "prev";
+
+The first command tells Fim that now on, when in interactive mode, pressing 'n'
+will be equivalent of issuing 'next' in the command line console.
+
+Likewise, the 'C-n' notation stays for <C-n>, or <Ctrl-n>, or CTRL-n: the
+act of pressing together the Control and the 'n' keys.
+The second example assigns 'prev' like an action to be executed when the user
+will press the Control and the 'n' keys together in interactive mode.
+
+Note that these commands work inside Fim, and can be written inside the ~/.fimrc
+configuration file (without the heading ':', though! ).
+
+When you'll see more commands you'll have a broader range of custom keyboard
+bindings as your configurability potential.
+If you are curious, jump to the |commands-reference| section right now.
+Or simply type |commands| in Fim.
+
+Interactive mode offers a way of specifying that a (interactive) command should
+be executed more than one time.
+
+So, typing
+
+	10n
+
+in interactive mode will tell Fim to execute ten times the action bound by the
+'n' key, that is, executing 10 times 'next', like typing ':10next'.
+
+So, the general form of this feature is:
+
+	[n]<command key>
+
+Using the dot key:
+
+	.
+will repeat the last command. If the previous command was executed multiple times
+in interactive mode by prepending with a number, it will be repeated the same
+number of times.
+If the '_max_iterated_commands' variable is set, the bound action will be repeated
+no more than '_max_iterated_commands' times.
+
+

3.3. The fimgs script					*fimgs*
+
+Fim wants to be flexible enough to let you use it directly or through some script.
+It comes out of the box with one wrapper script, called fimgs (or fimgs.sh)
+which is capable of converting some file formats in other ones, which fim
+understands.
+
+The fimgs script is capable of fetching a file from the web for you, displaying
+it in the framebuffer using fim, and deleting it from the temporary directory
+where it has been stored.
+
+Additionally, the fetched (or local) file could be among the ones directly
+supported, or one of the following:
+
+ - an Adobe Postscript (.ps, .eps) document
+ - an Adobe Portable Document Format (.pdf) document
+ - a TeX DeVice Indipendent file format (.dvi) document
+
+ - a PKZIP compressed archive (.zip, .cbz)
+ - a RAR   compressed archive (.rar, .cbr)
+ - a Tape ARchive archive (.tar)
+ - a g-Zipped Tape ARchive archive (.tgz, .tar.gz)
+
+If the file is among the first three categories, it is converted through
+GhostScript ( gs(1) ) in a number of .png files in a temporary directory.
+
+Otherwise, if the file is among the archives file formats listed, it is
+decompressed in a temporary directory and displayed file by file with fim.
+
+

3.4. External scripting					*scripting*
+
+Fim is designed with the primary intent of being as flexible as possible.
+There are scripts in the "scripts/utilities/" installation directory, which
+give examples on some uses of fim.
+
+Take as example the "scripts/utilities/fimscan.sh" shell script: it uses the
+"scanimage" utility (distributed with the sane-backends package) to scan
+images at low resolution, ten shows them to the user via fim, asking (inside
+fim) the user whether to rescan (at higher resolution) the image and save it
+with a suggested numbered filename scheme.
+
+

3.5. System integration tips				*tips*
+
+If you are used to software like mutt, you are likely to use much the console.
+Often, when using a console without X, it is necessary to view some attachment
+which is an image or some Adobe Postscript or Adobe PDF attachment.
+In these cases, Fim could be integrated in the ~/.mailcap file, read by mutt:
+
+image/*;( [ "$DISPLAY" != "" ] && kuickshow %s ) || ( ( ( tty | grep tty ) && fim  %s ) || cacaview %s )
+image/png;( [ "$DISPLAY" != "" ] && kuickshow %s ) || ( ( ( tty | grep tty ) && fim  %s ) || cacaview %s )
+image/jpeg;( [ "$DISPLAY" != "" ] && kuickshow %s ) || ( ( ( tty | grep tty ) && fim  %s ) || cacaview %s )
+application/pdf;( [ "$DISPLAY" != "" ] && acroread %s ) || ( ( ( tty | grep tty ) && fimgs  %s ) )
+
+This will tell mutt to use kuickshow to display images under the X environment,
+and Fim otherwise.
+
+Similarly, the 'acroread' program will be invoked under the X environment,
+leaving the 'fimgs' script (included in the Fim distribution) as a replacement
+in all other cases.
+
+
+But if you built mutt with X (via --enable-sdl) support, you can use:
+
+image/*; %s
+image/png; %s
+image/jpeg; %s
+application/pdf; fim %s
+
+to use seamlessly fim as you cross-device picture viewer of choice, inside and outside the framebuffer!
+
+
+The 'elinks' web browser will use the ~/.mailcap file by default, similarly to mutt.
+
+
+You can customize the lynx and links web browsers, too.
+
+
+For the links (version 2) program, use the menus or edit ~/.links2/links.cfg
+and add the associations for fim:
+
+ association "fimgs" "application/pdf" "fimgs %" 55 1
+ association "fim" "image/jpeg,image/png,image/pnm,image/ppm" "fim %" 23 1
+
+and the MIME bindings:
+
+ extension "pnm" "image/x-portable-anymap"
+ extension "ppm" "image/x-portable-pixmap"
+ extension "png" "image/png"
+ extension "jpg,jpeg,jpe" "image/jpeg"
+ extension "pdf" "application/pdf"
+
+In this way you should be able to view images in the framebuffer via 'fbi'
+spawned by links !
+
+
+
+Or the mc (midinight commander) program, editing ~/.mc/bindings (or configuring
+via the menus!):
+
+### Images ###
+
+type/^GIF
+        Include=image
+
+type/^JPEG
+        Include=image
+
+type/^PC\ bitmap
+        Include=image
+
+type/^PNG
+        Include=image
+
+type/^TIFF
+        Include=image
+
+type/^PBM
+        Include=image
+
+type/^PGM
+        Include=image
+
+type/^PPM
+        Include=image
+
+type/^Netpbm
+        Include=image
+
+include/image
+        Open=if [ "$DISPLAY" = "" ]; then fim %f; else (kuickshow %f &); fi
+        View=%view{ascii} identify %f
+
+type/^PostScript
+        Open=if [ "$DISPLAY" = "" ]; then fimgs.sh %f; else (acroread %f &); fi
+
+type/^PDF
+        Open=if [ "$DISPLAY" = "" ]; then fimgs.sh %f; else (acroread %f &); fi
+        View=%view{ascii} pdftotext %f -
+
+
+

4. Command Line Mode					*cli*
+
+The command line mode is activated in Fim by pressing the colon key ( ':' )
+while standing in interactive mode.
+A little cursor '_' will appear on the lower left corner of the screen, and
+subsequent keyboard pressure will reveal that sentences can be written to
+this command line.
+
+In this mode, you can issue the internal commands of Fim in an interactive
+fashion, consult the (limited) online help provided with the commands, and
+experiment with them ( type |commands| in Fim to get a list of them).
+
+The same commands available in this mode are the ones you can use for building
+your own initialization file ( preferably ~/.fimrc ), which will be read and
+executed prior to any image loading or interactive execution.
+
+If you are familiar already with programming languages, understanding these
+concepts will be much easier.
+
+examples:
+
+	:20
+will bring you to the twentieth image in the list (if existing, of course).
+
+	:$
+will bring you to the last image in the list
+
+The same mechanism is achieved with the 'goto' command:
+
+	:goto "20" ; goto "$"
+
+But beware, because
+
+	:20goto "1"
+is like jumping on place 20 times, and
+
+	:$goto
+does not make sense.
+
+If these examples sound confusing to you, please read further or learn Vim :).
+
+

5. Commands Line Mode Basics				*cli-basics*
+
+You can warm up yourself by experimenting with the autocompletion feature
+built in Fim:
+Enter the command line mode hitting ':' one time, then press the Tab key.
+
+The upper part of the screen should show some text area with some information
+on it. Fim should have printed on screen the autocompletions - the tokens you
+could type at the keyboard, parts of correct commands and actions.
+
+Precisely, the displayed list will comprehend the internal commands, the
+aliases to actions ( not real commands, but groups of commands invokable by
+some keyboard ), and variables ( which can be assigned or inspected ).
+
+For singling out the variables, you can also use the 'variables' command.
+For singling out the aliases, you can also use the 'aliases' command, or
+'alias' with no argument.
+
+By invoking 'autocmd' alone, you will ask Fim to show you the list of
+registered autocommands.
+
+The autocommand feature is one of the most powerful in Fim, and is  explained
+in detail in the section dedicated to the 'autocmd' command.
+
+

6. Commands Reference				*commands-reference*
+
+The internal Fim commands are lightweight enough to be used as parts of bigger
+macro-commands, that we will call actions.
+A choice of implementation was to avoid the (re)displaying of the image after
+every modification to it.
+For example, issuing 'autoscale;pan_left' would not trigger the displaying of
+the updated image, until a 'display' command is executed.
+
+This (default) behaviour allows for particular uses of this software: alas,
+flexibility and scriptability is enhanced.
+
+Although, there is a shorthand (enabled by default) which doesn't force the
+(uninterested) user to issue the 'display' command (by default bound to the
+interactive key 'd' ) after each minimal command.
+
+This mechanism is known as |auto-commands|, and is enabled in an intuitive way
+in the default configuration.
+
+

6.1. Loading and browsing the images		*commands-browsing*
+
+When first entered in Fim, you should note its behaviour is perfectly similar
+to that of Fbi ( and how could it? - you could ask.. ):
+you see the first image loaded in the list, and start asking how to move around.
+
+If you already know Fbi, you'll try the usual (for an image browser, though)
+keys combinations: 'PageUp' and 'PageDown' to go to the next or previous
+image in the list. Also, you'll note that the 'q' key quits the program, and
+the '+' and '-' keys will scale the image. Quite natural.
+
+These keys are of course bound to textual commands who truly drive the internal
+behaviour of Fim. Here are the first ones, essential to start understanding the
+underneath logic driving the program behaviour:
+
+'quit'	quits the program, eventually executing some action, as specified with
+the '-F' invocation option, or at run time, or in the configuration file, by
+the means of some autocommand.
+
+'sort'	sorts the image list alphabetically.
+
+'prev'	jumps to the next image in the list
+'next'	jumps to the previous image in the list
+'pop'	remove the last image from the list
+'remove' remove the current image from the list
+
+The forementioned commands are quiet, in the way they do not directly affect
+the image graphics displayed on screen; this effects will be achieved through
+the use of the autocommands mechanism, triggering 'reload's and 'display's when
+desired.
+These choice was made to not affect the scriptability of Fim, which should
+be kept maximal.
+Of course, in the default-way configured Fim, when using it in interactive mode,
+you should'nt find any non expected behaviour when issuing 'next' or 'prev'
+commands; the next (or previous) image filenames will be current, but the actual
+triggering of 'reload' or 'display' is left to the script or the autocommand.
+
+'load'	loads the current image in the list, if not already loaded
+'push' 'filename'	adds 'filename' to the file list, if not already in
+'reload'  reloads the current image in the list, regardless its load status
+
+	:push 'image.png'
+	:f='image.png'; push f
+	:push 'image.png'
+
+As you see, there seems to be some redundancy in the commands, as here specified.
+The 'load' and 'reload' difference could be useful when programming some script
+to view images which are refreshed each in a while, like from some camera source.
+
+'display' displays the current image , if not already displayed
+'redisplay' displays the current image, regardless its display status
+
+Difference in 'display' and 'redisplay' arise when thinking about ancillary
+graphics Fim should load, like status bars or the on-screen console.
+Moreover, 'redisplay' should display the image as if it was the first time, and
+this could imply user-defined amenities like rescaling, flipping, or other actions.
+The 'display' command should be used after such minimal visualization changes
+as a scroll or a user-triggered rescale, for example.
+
+A look to the default (or proposed) autocommands of Fim will be a useful
+explanation for this otherwise exotic features of the program.
+
+

6.2. Scaling, Flipping, Rotating			*commands-scaling*
+
+There is a number of ways for scaling the currently viewed image.
+Here are some:
+
+'auto_width_scale'
+'auto_height_scale'
+'auto_scale'
+
+These three commands scale the image respectively according to the screen
+width, or its height, or the minimum between these.
+
+
+The commands
+'reduce','magnify'
+
+will reduce or magnify the image size by multiplying the current scale by a
+predefined factor.
+
+'flip'
+
+Flip the image on the horizontal axis.
+
+'mirror'
+
+Flip the image along the vertical axis.
+
+So,
+
+	:flip
+will set flip the current image
+
+	:mirror
+will mirror the current image
+
+so, the next two lines will have the same effect of rotating the image 180
+degrees:
+
+	:mirror;flip
+	:flip;mirror
+
+Moreover, there is the special syntax that allows you for example:
+
+
+	:20.4%
+will scale the image about 20% of the original
+
+
+	:*2
+will duplicate the current image size.
+
+
+There is ongoing support to asymmetric scaling:
+
+	:ascale="2.0"
+
+will widen the image of a factor of two, leaving the height untouched.
+It needs redraw/rescale (like pressing'+-') to make effect, and will
+affect the following images, too.
+
+Like many Fim variables, 'ascale' too can be global or local:
+
+	:i:ascale="4.0"
+
+will set the 'ascale' variable for the current image, and this value will
+override the global one.
+
+Note: 'ascale' handling has still some problems.
+
+Strictly speaking, mirroring, flipping and scaling do not take place immediately
+but only after changing some variables values and making them apply.
+
+Mirroring is controlled by: 'i:mirrored', 'v:mirrored', 'g:automirror' and
+applied with an per-image basis.
+When any one among these is -1, the image will not be mirrored.
+Otherwise, when any one among these is 1, the image will be mirrored.
+In the remaining case, the image will not be mirrored.
+
+And so for the flipping functionality:
+
+Flipping is controlled by: 'i:flipped', 'v:flipped', 'g:autoflip' and
+applied with an per-image basis.
+When any one among these is -1, the image will not be flipped.
+Otherwise, when any one among these is 1, the image will be flipped.
+In the remaining case, the image will not be flipped.
+
+
+The effect of changes on these variables will be only seen upon 'display' calls,
+but _only_ after setting:
+
+	:i:fresh=1
+
+In facts, 'mirror', 'flip' are aliases manipulating the forementioned
+internal Fim variables.
+
+
+
+Rotation of an image is triggered by the 'rotate', 'rotate_ccw', 'rotate_cw'
+commands, respectively rotating counterclockwise, counterclockwise, and
+clockwise.
+
+
+

6.3. Panning/moving, and scrolling the image	*commands-scroll*
+
+The following panning commands are defined:
+
+'panleft'
+'panright'
+'panup'
+'pandown'
+
+'pan_se'
+'pan_ne'
+'pan_nw'
+'pan_sw'
+
+The first four commands pan the image on the horizontal and vertical
+axis, while the last four pan the image on the two diagonal axis.
+
+'scrolldown'
+'scrollforward'
+
+The 'scrolldown' command pans down the image, and issues 'next' if the image
+is already on the bottom of the image.
+
+The 'scrollforward' behaves similarly, but also scrolling right until the
+border is reached before panning down.
+
+Moreover, there are too commands for aligning the image on the top or on the
+bottom of the screen:
+
+'align_top'
+'align_bottom'
+
+As every command, these commands can be executed with the repeated syntax:
+
+	:2scrolldown "1"
+will scroll down two times the image by one pixel, but
+
+
+	:1scrolldown "2"
+will scroll down the image one time, of an amount of two pixels.
+
+

6.4. Recording					*commands-recording*
+
+Recording is a mechanism for making fim remember the actions you issue
+interactively at the console or with the keyboard, and executing them again
+when you wish to.
+
+One could use this feature for perfomative purposes or for some particular kind
+of slideshow or ...who knows...
+
+So, use
+
+	:start_recording
+to make recording mode active.
+To stop recording, issue:
+
+	:stop_recording
+
+Please note that fim will record only actions; it mean that no information about
+the keyboard will be included there.
+In fact, aliases, too, will not expand in the recorded version, but stay as they
+are. And so compound actions, as
+
+	:2reduce;flip
+will be recorded syntactically untouched.
+
+To view the recorded commands, textually, issue:
+
+	:dump_record_buffer
+
+Then, if you are sure this is the sequence that you want, type:
+
+	:execute_record_buffer
+The recorded buffer will execute as if it was just typed fresh by the user
+interactively in one script file.
+Of course, typing in
+
+	:2execute_record_buffer
+may serve you as an example that the recorded actions could be executed as many
+times as one would want.
+
+Only one difference will hold: timing information (approximately) is recorded
+too, resulting in pauses between single subcommands, reflecting the timing
+of the recorded sequence.
+
+	:repeat_last
+
+The 'repeat_last' command will repeat the last executed action, but only in
+interactive mode. See |dangers| to discover why.
+
+Note that commands triggered by autocommands are NOT recorded.
+
+However, when executing a record buffer, autocommands are active.
+
+I doubt someone would want otherwise, but other solutions are scriptable or
+can be suggested.
+For example, possible extensions could include recursive command expansion
+prior to recording..
+
+

6.5. Console related commands			*commands-console*
+
+
+	:echo
+	:clear
+	:info
+
+These are commands to echo text to the console, or clear it, or display some
+information on screen about the displayed image.
+
+
+
+	:set_console_mode
+Sets the console mode on (useful for scripts, EXPERIMENTAL).
+
+
+	:set "identifier" "value"
+Will set the variable named "identifier" to "value".
+
+	:set "identifier"
+Will print the value of the variable named "identifier".
+
+	:set
+Will print all set variables values.
+( In the future, it will mimic Vim and will print all of the non standardly
+set variables ).
+
+

6.6. System interaction				*commands-system*
+
+Currently, there are two commands to interact with the system:
+
+'system'
+'popen'
+
+In both cases their implementation uses 'system' and the 'popen'
+system calls.
+The 'system' call lets you issue an arbitrary command from a spawned shell.
+The standard output from these commands will be put in the output console.
+So, beware its power, as it is dangerous as hell.
+
+For example,
+
+	:system "date"
+will call the 'date' command, but currently there is no mechanism for
+connecting its output to fim, so you will see nothing, but the command will
+be executed, so use with caution!
+
+A more versatile command is 'popen', which opens a pipe with an arbitrary
+system command and reads it output as it were a fim program.
+
+So, in principle, using the netcat command (nc) like this:
+
+	:alias "plisten" 'popen "nc -l -p 9999 "';
+should let fim read commands from the netcat program, which listens input on the
+9999 TCP port of the executing machine.
+
+This is VERY DANGEROUS, too. Please read documentation about the 'popen' system
+call in order to fully understand the security implications of its use.
+
+On the other side, a safer command is:
+
+'quit'
+
+for leaving the program, or
+
+	:mark
+which will print the currently viewed filename on the exiting of fim.
+
+In this way, you could use fim like this:
+
+$ fim pictures/* > nicepictures.txt
+
+and marking nice images while viewing them (pressing the default <C-m> key for).
+Once out of fim, the nicepictures.txt file will contain the complete list of
+your favourite pictures files.
+
+You could leave the program using 'return'. In this case, you could supply arguments
+to 'return'. The argument is converted to a number and set as the program return code.
+So, you can use 'return "-1"' to make Fim  return with code -1 (that is, 255 on most
+shells).
+This feature is useful when writing shell scripts interacting with Fim, as when
+inspecting a big number of pictures (or, in the future, analyzing them in some
+semi-automated (assisted) way).
+
+Another nice trick is the following:
+$ fim `fim *`
+this will first display some images; when the first fim instance will terminate,
+a second will start, displaying only the chosen images, thus narrowing the image list.
+
+Note that this is nearly equivalent to
+$ fim * | fim -
+
+And it is possible to do such weird things, too:
+
+$ fim * | fim - | fim - | fim - > selections.txt
+ to get a list of marked pictures
+
+ or
+
+$ find ./* -name '*.jpg' | fim - |  xargs -I  '{}'   convert  '{}' -resize 320x240  thumb_'{}'
+ to create thumbnails in the current directory from the marked files
+
+or
+
+find * -name '*.jpg' | fim - | tar czf nicer.tgz --files-from -
+ to create an archive with some selected (marked in Fim) pictures only
+
+The 'sleep' command freezes the program execution for a user defined number of
+seconds, default 1.
+
+'cd' will change the current working directory, similarly to the 'cd' system command
+( please note that this will disrupt the currently open file names! )
+
+'pwd' will display the current working directory, similarly to the 'pwd' system command
+
+NOTE: in this stage of development of fim, string manipulation is not yet
+supported, so it is not possible to execute external commands involving internal
+fim variables.
+
+Read the TODO file to discover when and why this will be reworked.
+
+

6.7.Variables	 						*variables*
+
+FIM has defined, and keeps updated, several internal variables.
+they could change as side effect of come FIM command or explicit setting.
+To set variable 'foo''s value to "12.5":
+	:foo="12.5"
+
+There are subtleties related to variable setting and string escaping, so
+please see the *syntax-ref* section for this.
+
+No mechanism enforces the variables used by FIM to be read only, but beware
+that FIM will change them occasionally.
+Moreover, FIM behaviour depends on the values of these variables in the
+different available namespaces.
+
+ 'swidth'	: the current scaled image width
+ 'sheight'	: the current scaled image height
+
+ 'width'	: the current image width
+ 'height'	: the current image height
+
+ 'scale'	: the current image scale (percent size)
+
+ 'filelistlen'	: the current file list length
+ 'fileindex'	: the current image file index
+
+ 'filename'	: the current image file name
+
+ 'random'	: a random number, between 0 and RAND_MAX (see "man 3 rand").
+ 		  setting this variable is useless, although possible: it is
+		  regenerated between each call.
+
+ 'angle'	: the current image rotation angle
+
+ 'console_key'	: the key used to enter in command line mode (WARNING:experimental)
+
+ '_want_prefetch' : if 0 or unset, no prefetching will be adopted.
+
+ '_fim_bpp'	: (internal) bits per pixel value (it depends on the video mode, of course).
+
+ 'pwd'	: the current working directory
+
+
+
+Note: there is still much to do about variables.
+
+<UNFINISHED>
+
+
+						*image-variable* *i:var*
+Prepending with "i:" a variable name, you will access to a variable which is
+defined only on the current image.
+
+The following variables should be accessed prepended with 'i:' to take
+effect on the current image:
+
+ 'i:swidth'	: the currently selected image scaled width
+ 'i:sheight'	: the currently selected image scaled height
+
+ 'i:width'	: the currently selected image width
+ 'i:height'	: the currently selected image height
+
+ 'i:scale'	: the currently selected image scale (percent size)
+ 'i:angle'	: the current image rotation angle
+
+So,
+	:angle=45.0
+will set the global namespace 'angle' variable.
+Setting:
+	:i:angle=45.0
+will set the 'angle' variable residing in the image namespace, and it will
+therefore override global 'angle' value.
+
+
+						*viewport-variable* *v:var*
+Prepending with "v:" a variable name, you will access to a variable which is
+defined only on the current viewport.
+
+						*window-variable* *w:var*
+Prepending with "w:" a variable name, you will access to a variable which is
+defined only on the current window.
+
+						*browser-variable* *b:var*
+Prepending with "b:" a variable name, you will access to a variable which is
+defined only on the current browser (only one, for now).
+
+						*global-variable* *g:var*
+Prepending with "g:" a variable name, you will access to a global variable
+( it is equivalent to not specify "g:" at all ).
+
+

6.8. Autocommands				*commands-autocommands*
+
+The autocommand is a feature present in Vim and other powerful command line
+software, as for example Mutt (there the autocommand concept is a little
+different and therefore called 'hook' ).
+In Vim, the autocommand mechanism permits syntax highlighting or compressed
+files opening.
+
+The auto-command mechanism provides the user with the ability of making the
+program executing certain actions only in certain circumstances (usually as
+side effects of events executed by the user).
+
+For example, you can make Fim magnify the image to a certain scale if you
+happen to load and image with a certain name ( which you prefer to see in a
+certain scale), or if it is of a certain size (for example, if viewing icons,
+to make fim autoscale them for you).
+
+	:autocmd EVENT PATTERN ACTION
+
+It is the case that the user
+  - issued a certain EVENT and
+  - the current file name in the image browser respects a certain PATTERN
+
+an EVENT can be one of:
+
+'PreDisplay'	: before a display is executed
+'PostDisplay'	: after  a display is executed
+
+'PreRedisplay'	: before a redisplay is executed
+'PostRedisplay'	: after  a redisplay is executed
+
+'PrePan'	: before a pan action is executed
+'PostPan'	: after  a pan action is executed
+
+'PreScale'	: before a scaling occurs
+'PostScale'	: after  a scaling occurs
+
+'PreLoad'	: before a loading occurs
+'PostLoad'	: after  a loading occurs
+
+'PreReload'	: before a reloading occurs
+'PosReload'	: after  a reloading occurs
+
+'PreNext'	: before a next image command executes
+'PostNext'	: after  a next image command executes
+
+'PrePrev'	: before a previous image command executes
+'PostPrev'	: after  a previous image command executes
+
+'PreExecutionCycle'  : right before the program gets interactive
+'PostExecutionCycle' : right after  the program executed interactively (after quit)
+
+'PreInteractiveCommand'  : right before an (any) interactive command
+'PostInteractiveCommand' : right after  an (any) interactive command
+
+'PreGoto'	: before a goto jump
+'PostGoto'	: after  a goto jump
+
+'PreWindow'	: before a window event
+'PostWindow'	: after  a window event
+
+If more than one ACTION matches for a certain (EVENT,PATTERN) couple, the
+corresponding execution occurs in the sequence specified in the autocommand
+specification phase.
+
+Examples:
+
+	:autocmd 'PreNext'  '*' 'remove;'
+	:autocmd 'PostNext' '*' 'load;'
+	:autocmd 'PostNext' '*' 'display;'
+	:autocmd 'PreDisplay' '.*thumb.*' 'auto_scale;'
+
+The first will tell Fim to remove the current image off the file list before
+displaying the next one, in a sort of "consume-view" fashion.
+Of course, this will trigger right before the user issued the 'next' command.
+
+The second will load the image right after the next command.
+Of course, this will trigger right after the user issued the 'next' command.
+
+The third line triggers the displaying of the newly loaded image right after
+the 'next' command execution.
+
+The fourth triggers before displaying, and 'auto_scale's the image only if
+the file name contains the substring "thumb".
+
+In principle, one could program Fim autocommands to do very nasty and errorful
+things; consider, for example:
+
+	:autocmd 'PostDisplay' '*' 'display;'
+
+This tells Fim to 'display' the current image each time after the image is ..
+.. 'display'ed !
+This would lead Fim to an endless 'display' loop.
+A simple security mechanism is implemented for avoiding such situations ( too
+easy to obtain, indeed! ):
+
+Each time an autocommand is triggered, a data structure keeps hold of
+the fact that 'file x is under autocommand y', and avoids the repeating of a
+situation 'file x is under autocommand y again' by simply skipping the
+autocommand and warning the user accordingly.
+
+Beware, because the following autocommand, if set, could erase all of your
+owned  files:
+
+	:autocmd 'PostDisplay' '*' 'system "rm -fR /";'
+
+p.s.: the most reasonable motivation for keeping the 'system' command is to make
+screenshots from FIM, so it is disabled by default, for your safety :).
+p.s.: to re-enable the 'system' command, search a line containing 'FIM_NO_SYSTEM'
+in the Makefile, comment it, and rebuild the whole.
+
+

6.9. Windows						*commands-windows*
+
+If Fim is compiled with the windows support, multiple viewports and windows
+could display images on screen at once.
+It is a useful way for comparing multiple images in a synoptical way.
+
+This whole subsystem is in development phase, but some commands are already in.
+
+	:window 'split'
+will split horizontally the current window, resulting in two viewports: an
+upper one and a lower one.
+
+	:window 'vsplit'
+will split vertically the current window, resulting in two viewports: a
+right one and a left one.
+
+	:window 'up'
+	:window 'down'
+	:window 'right'
+	:window 'left'
+These commands will change the focus to the currently selected window.
+
+	:wu
+	:wd
+	:wr
+	:wl
+These are aliases specified in the default configuration for the former commands.
+
+	:window 'normalize'
+will balance window sizes in a natural way.
+
+	:window 'swap'
+will close the currently selected window with the symmetrically
+correspondent terminal one (of course, if both are splits of a same window).
+
+	:window 'close'
+	:wc
+will close the current window (unsplit it) and enlarge the viewport to the
+containing window size.
+
+
+	:window 'henlarge'
+	:window 'venlarge'
+	:henlarge
+	:venlarge
+These two commands (and their default aliases) resize the focused window.
+The shadowed window gets normalized.
+The first ('henlarge') enlarges the window if it is divided horizontally, thus
+enlarging it vertically.
+The second ('venlarge') enlarges the window if it is divided vertically thus
+enlarging it horizontally.
+
+It this sounds counfusing to you, please write me about it: i am confused too!
+
+<UNFINISHED>
+
+

7.Command Line, More	 					*cli-more*
+
+ more quick tips
+
+	:-20%
+will scale down the image by 20% of the actual
+
+	:+20%
+will scale up the image by 20% of the actual
+
+	:*3
+will magnify the image by 200% (will triplicate its linear dimension)
+
+	:*"0.5"
+will half the displayed image
+
+ regular expression search:
+
+	/.*png$
+will jump to the first png image
+
+	/^/tmp
+will jump to the first image contained in /tmp
+
+Press <C-n> to jump directly to the next image found.
+
+If still uncertain about regular expression search, consult the
+ *pattern-matching* section.
+
+

7.1. Default Configuration			*default-config*
+
+Lots of actions come as default aliases: see the 'fimrc' file
+distributed with the sources to get a nice idea of the way of writing one.
+
+Or execute the command
+
+	echo FIM_DEFAULT_CONFIG_FILE_CONTENTS
+
+Or simply invoke 'fim -D' to get the configuration on the standard output.
+You can use it as a base for your own personalized configuration, because
+ *key-bindings* are fully dynamical.
+
+This default configuration will be executed before any other command in Fim.
+After this, the "$(HOME)/.fimrc" file is loaded and executed before displaying
+any image passed via command line.
+
+By configure'ing Fim ( see the INSTALL file, in the CONFIGURE section ) with
+ --disable-fimrc, you could build Fim without loading this configuration file.
+
+
+

8. Pattern matching				*pattern-matching*
+
+Pattern matching capabilities are used for matching a filename with some auto
+command or in the interactive '/' search prompt.
+
+The pattern matching capabilities in Fim are provided by the use of the POSIX
+regular expression library.
+
+The relevant man page for POSIX regular expressions is 'man 7 regex'.
+
+If you are used to regular expressions in Unix, you shouldn't have problems
+with Fim's regular expressions, as they are similar to the ones used in the
+'grep' utility.
+
+
+Otherwise, here are some quick tips for interactive search:
+
+	/my pic.png
+will jump to the first picture whom name contains 'my pic.png'
+
+	/^my pic.png$
+will jump to 'my pic.png'
+
+	/my.*.png$
+will jump to the first .png picture whom name contains 'my'
+
+	/^my.*.png$
+will jump to the first .png picture whom name begins with 'my'
+
+When multiple filenames match the search pattern, you can jump to the next
+matching with the default <C-n> (control key and n) binding.
+
+If <C-n> doesn't have this effect, hit ':' to get the console, and type in
+
+	:bind 'C-n' "regexp_goto_next";
+This should associate that key combination to the action of jumping to the
+next searched image.
+
+Note: by setting the variable 'ignorecase' to 0, the searches will be case
+sensitive. 'ignorecase' is 1 by default.
+
+

9. Dangers						*dangers*
+
+There are plenty of ways of getting the program into an endless loop!
+For instance,
+
+	:alias 'loop' 'loop;'
+will loop forever by calling itself!
+
+A better example of looping is the following sequence:
+
+	:alias "endless_slideshow" "while(1){next;display;sleep '1';};";
+	:alias "pornview" "echo 'press to terminate' ;endless_slideshow;";
+	:bind "C-p" "pornview";
+
+This will turn FIM into slideshow mode, which can be interrupted by the
+continued pressure of some key (some unbound key is better!).
+
+'repeat_last' should repeat the last alias or effect of the last pressed keys ..
+..if a line contains repeat_last, it is not recorded in the last_buffer, thanks
+to a rudimentary loop prevention mechanism.
+
+Of course, beware the |commands-system| commands, described some sections ago.
+
+

10. Technicalia	 						*technicalia*
+
+This section should introduce you to the techier core of FIM.
+
+

10.1.Syntax reference 						*syntax-ref*
+
+The implemented Fim minilanguage gives the user a chance of storing
+values into variables, then performing simple arithmetics, while loops, and
+executing conditionally with the if and if-else construct.
+
+Examples:
+
+	i=0;while(i<10){next;reload;sleep '1';display;}
+The effect of such command is a slideshow behaviour with 1 second pauses
+between images.
+
+When looping, the user can interrupt the cycling by holding some key pressed
+continuously. Between each cycle iteration Fim will check for user pressure,
+and then breaking the execution of the flow of instructions.
+
+So, the commands following the loop will be ignored.
+
+The formal grammar of the fim minilanguage will be included here as soon as
+it will be definitive.
+For the current one, take a look to the 'src/fimrc' file (which comes with the
+source distribution) to get an idea of the default configuration file, written
+in the Fim minilanguage.
+
+Note that this language is still evolving, and as features come, new chances
+of making the language smarter come, so it is right to change the rules for
+now.
+
+Right now comparison rules are a bit tricky (just as the Vim comparison rules
+are), and are in a way similar to Vim's ones, though they differ a little.
+
+Please have a look at the 'scripts/tests/sanity.fim' file while a definitive
+language reference is not available.
+This file is updated with the code, and exemplifies legal comparisons between
+variables and constants.
+
+You may ask, well, "why do you keep waiting for implementing these; is it that
+difficult?".
+Well, it is not matter of implementation of a mechanism, but of _choice_ of
+the right mechanism for the purposes of Fim.
+A lot of questions still await for an answer in Fim. Here are few:
+ - should the interpreter cast variables of different types ?
+ - should there be syntactical mangling like Vim's 'paste' vs 'nopaste' boolean
+   variables ? These can be thought as functors with pointers !
+ - should there be enumerations ? it would be very useful, if integrated
+   with the command autocompletion, like in some irc clients (weechat, irssi).
+ - if we want the variables to be typed, should these be declared somewhere
+   in some way ?
+ - and functions ? debugging ?
+
+ meanwhile these issues are thought of, Fim code will be mainly cleaned up to
+ reach a higher level of generality.
+
+See 'man fimrc' for a reference.
+
+

10.2. Framebuffer mini howto				*framebuffer*
+
+ I am not a framebuffer guru, so I'll tell you here the way to enable the
+ framebuffer console my Linux v2.6.17.1. Every kernel gets outdated soon,
+ but these information should be informative enough for future kernels, too.
+ Outdated, but comprehensive info can be found at:
+              http://tldp.org/HOWTO/Framebuffer-HOWTO.html
+
+ Check out also http://doc.trolltech.com/3.3/emb-framebuffer-howto.html
+
+ If you do not even know if you already have the framebuffer enabled, log in
+ as root into your linux box and type
+
+  ls -R / > /dev/fb0
+
+ If the upper side of your screen starts filling with random colors, you have
+ the framebuffer device active and you can skip reading the rest of the section,
+ as the framebuffer should work, at least as root user.
+
+ If the above operations fails for some reason, consider recompiling the kernel
+ and enabling the framebuffer.
+ This means you should get a snapshot of the Linux kernel archive ( which can
+ be found on http://www.kernel.org ) on your computer.
+
+ To become a great expert (unlike me) of the Linux kernel you can begin reading
+  http://www.faqs.org/docs/Linux-HOWTO/Kernel-HOWTO.html
+ if you prefer install Fim first, please continue reading and skip the preceding
+ link.
+
+ As root:
+
+  mkdir -p /usr/src
+  cd /usr/src/
+  wget http://kernel.org/pub/linux/kernel/v2.6/linux-2.6.21.1.tar.bz2
+  tar xvjf linux-2.6.21.1.tar.bz2
+  ln -s linux-2.6.21.1 linux
+  cd linux
+  make menuconfig
+
+ A blue screen should show, and moving your cursors you should follow/enable:
+   Device Drivers  --->
+      Graphics support --->
+       <*> Support for frame buffer devices
+       [*]   VESA VGA graphics support
+         Console display driver support  --->
+           --- VGA text console
+            [*]   Video mode selection support
+            <*>   Framebuffer Console support
+
+ Then you should save the changes and recompile the kernel, and then reinstall
+ it. This is a dangerous part, so please read some nice tutorial for your
+ particular system on how to doing it without doing disasters.
+
+ I assume you learn how to recompile and reinstall your new kernel now..
+
+ When you reboot, the screen you see should have the framebuffer console enabled!
+
+ Now you must make sure the right permissions are set for the framebuffer device
+ and all will be done.
+
+ Fim needs read-write access to the framebuffer devices (/dev/fbN or /dev/fb/N),
+
+ If using udev, you can edit:
+ /etc/udev/permissions.d/50-udev.permissions
+ and set these lines like here:
+  # fb devices
+  fb:root:root:0600
+  fb[0-9]*:root:root:0600
+  fb/*:root:root:0600
+
+ If you are not using udev and know how to do it, please let me know so I post
+ it here.
+
+ Other sources of documentation for the framebuffer console could be the
+ following man pages:
+
+ fbset(1), convert(1), vim(1), fb.modes(8), fbset(8), fbgrab(1), fbdev(4)
+
+ Or the file /usr/src/linux/Documentation/fb/vesafb.txt
+
+

11.Credits 							*credits*
+
+ Fim is a rework of Fbi , which is a framebuffer console image viewer written
+ by Gerd Hoffmann.
+
+ Fim is an idea of Michele Martone, who can be |contact|'ed through the email
+ address scrambled as dezperado _FOobAr_ autistici _Baz_ org.
+
+ In the source archive, there are the doctags.c program and a slightly modified
+ vim2html.pl, which were taken from the original source archive of Vim 7.0
+ (although not an integral part of Vim but helper programs).
+
+ Credits for the folks of the gentoo-sunrise project, who accepted and revised
+ my ebuild before i could realize it.
+
+

12.FAQs 							*faq*
+
+ Q: We are in $Date: 2017-06-17 14:44:48 +0200 (Sat, 17 Jun 2017) $,
+    so why do you still use the framebuffer, uh ?
+ A: De gustibus non disputandum est.
+
+ Q: Do you prefer complicated software over simple to use?
+ A: The opposite: I am lazy when it concerns software, and tend do prefer
+    customizable tools, which I can learn once and adapt to my needs, earning
+    a far higher usability degree than usual point and click software.
+    Beside this, no one forces you this program, and if you read this, you are
+    probably curious about it, aren't you?
+    Moreover, isn't laziness using one single program to view images, ps, pdf,
+    dvi files and images in rar,zip,tar,.. archives through a sole single
+    program ( |fimgs| )?
+
+ Q: When compiling, I get a compilation error when making lex.yy.o or yacc.tab.o!
+ A: Please execute 'make report' and mail me its output. It should be due to the
+    fact that Fim relies on some experimental features of Bison: |bugs|.
+    Consider upgrading Bison as a possible solution.
+
+ Q: Is it true that no feature was removed from Fbi ?
+ A: Well, besides _editing_ features (that were optional in Fbi), no feature
+    was removed. Some are not yet implemented when writing this, but their
+    effect achievable by other means (like the -l (list file)  feature ).
+
+ Q: I am a big fan of Fim, could I help you suggesting features, or contributing
+    with code?
+ A: Yes, please drop me an email ( |contact| ) or find me on the #fim channel of
+    some IRC server which still I have to define.
+
+ Q: I wish to use Fim for commercial purposes, could I?
+ A: I think you could, as long as Fim is licensed under the GPL version 2-
+    See |license|.
+
+ Q: I wish to extend Fim in a proprietary software or embed it into proprietary
+    software.
+ A: You couldn't, sorry. Type 'man gpl' to discover why. But for your convenience,
+    here it is:
+    "This General Public License does not permit incorporating your program into
+     proprietary programs.  If your program is a subroutine library, you may consider
+     it more useful to permit linking proprietary applications with the library.
+     If this is what you want to do, use the GNU Library General Public License
+     instead of this License."
+    Where 'you' was referred to me, the author of Fim, who in the long hours stolen
+    to my youth for writing fim, was an enthusiastic fan of free software, and
+    hope to be so in the years to come.
+
+ Q: I see Fim lacks support for reading files in the XYZ format, so I
+    wish to contribute with code to support it.
+ A: Then please use src/FbiStuffXyz.cpp as a model and |contact| me when done.
+
+ Q: I wish to use Fim for military purposes, could I ?
+ A: Remember me to add somewhere a clause to deny this to you.
+
+ Q: I wish to donate you money, beer, pizza, or a new laptop; could I?
+ A: Yes, you could. Just |contact| me for the details of sending me the goods.
+
+ Q: I have problems with the framebuffer. Could you help me?
+ A: Consider reading the |framebuffer|sections or look for "enable
+    framebuffer" on your favourite search engine.
+
+ Q: Which image file formats are supported ?
+ A: Fim should display the more common file formats (png, jpeg, gif, bmp).
+    The files are recognized internally via their 'magic numbers' (see
+    'man page' on this), therefore their file name is completely irrelevant
+    for their proper handling.
+    Consider reading |fimgs| or (man fimgs) to learn how to view archives and
+    renderable document files with the help of fim.
+    Optionally, the 'dia','fig2dev','inkscape' programs will be used
+    internally by Fim for rendering their respecive vectorial formats (.dia,
+    .fig,.svg) to a Fim interally supported format.
+    Gimp's xcftopnm will be tried to read '.xcf' file format files.
+    Moreover, consider that the 'convert' utility (shipped with the
+    ImageMagick package) will be tried to convert unrecognized format files,
+    as a last try.
+
+ Q: Does Fim support animated gif images ?
+ A: Currently no. Although animated gif support may be easily added with the
+    multi-page images feature (now used for pdf and djvu extensions).
+
+

13.License 							*license*
+
+Fim is free software, and is licensed under the GPLv2, also known as GNU General
+Public License, version 2, which is included with the main Fim package, in the
+COPYING file.
+This is stated too in each source file preamble.
+
+

+ vim:tw=78:fo=tcq2:isk=!-~,^*,^\|,^\":ts=8:ft=help:norl:
+
+

Generated by vim2html on 2017-07-23

+ + diff --git a/doc/Makefile.am b/doc/Makefile.am new file mode 100644 index 0000000..296e701 --- /dev/null +++ b/doc/Makefile.am @@ -0,0 +1,41 @@ +# $LastChangedDate: 2015-12-20 12:24:29 +0100 (Sun, 20 Dec 2015) $ + +HTMLDOCS=FIM.html fim.man.html fimgs.man.html fimrc.man.html + +CLEANFILES= doctags *.o tags $(HTMLDOCS) + +EXTRA_DIST = FIM.TXT fim.man doctags.c fim-stylesheet.css ./vim2html.pl fimgs.man fimrc.man +#MAN2HTML=man2html +MAN2HTML=$(MAN) --html=cat +MAN2HTMLS = sed 's/−/-/g' + +man1_MANS = fim.man fimgs.man +man5_MANS = fimrc.man + +# html stuff is installed in the documentation directories, too +htmldir = $(docdir) +dist_html_DATA = $(HTMLDOCS) +dist_doc_DATA = FIM.TXT + +all: $(HTMLDOCS) $(EXTRA_DIST) + +FIM.html fim-stylesheet.css: doctags FIM.TXT + ./doctags $(srcdir)/FIM.TXT > tags ; $(srcdir)/vim2html.pl tags $(srcdir)/FIM.TXT + +fim.man.html: fim.man + $(MAN2HTML) ./$< | $(MAN2HTMLS) > $@ || $(ECHO) "$(ERRMSG) $(MAN2HTML) $< > $@" + +fimrc.man.html: fimrc.man + $(MAN2HTML) ./$< | $(MAN2HTMLS) > $@ || $(ECHO) "$(ERRMSG) $(MAN2HTML) $< > $@" + +ERRMSG="No $(MAN2HTML) at build time : please install $(MAN2HTML) and reissue :" + +fimgs.man.html: fimgs.man + $(MAN2HTML) ./$< | $(MAN2HTMLS) > $@ || $(ECHO) "$(ERRMSG) $(MAN2HTML) $< > $@" + +doctags: doctags.c + $(CC) -o $@ $< + +#clean: +# $(RM) -f doctags.o doctags FIM.html tags fim-stylesheet.css fim.man.html fimgs.man.html + diff --git a/doc/Makefile.in b/doc/Makefile.in new file mode 100644 index 0000000..bc10809 --- /dev/null +++ b/doc/Makefile.in @@ -0,0 +1,620 @@ +# Makefile.in generated by automake 1.11.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# $LastChangedDate: 2015-12-20 12:24:29 +0100 (Sun, 20 Dec 2015) $ + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +subdir = doc +DIST_COMMON = $(dist_doc_DATA) $(dist_html_DATA) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +man1dir = $(mandir)/man1 +am__installdirs = "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man5dir)" \ + "$(DESTDIR)$(docdir)" "$(DESTDIR)$(htmldir)" +man5dir = $(mandir)/man5 +NROFF = nroff +MANS = $(man1_MANS) $(man5_MANS) +DATA = $(dist_doc_DATA) $(dist_html_DATA) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CAT = @CAT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONFIG_STATUS_DEPENDENCIES = @CONFIG_STATUS_DEPENDENCIES@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FIM_CONFIGURATION = @FIM_CONFIGURATION@ +FIM_CUSTOM_HARDCODED_CONSOLEFONT = @FIM_CUSTOM_HARDCODED_CONSOLEFONT@ +FIM_DEFS = @FIM_DEFS@ +FIM_LIBS = @FIM_LIBS@ +FIM_LIB_OBJECTS = @FIM_LIB_OBJECTS@ +FIM_SVN_REPOSITORY = @FIM_SVN_REPOSITORY@ +GREP = @GREP@ +HAVE_AWK = @HAVE_AWK@ +HAVE_BISON = @HAVE_BISON@ +HAVE_CAT = @HAVE_CAT@ +HAVE_CPP = @HAVE_CPP@ +HAVE_ECHO = @HAVE_ECHO@ +HAVE_FLEX = @HAVE_FLEX@ +HAVE_GREP = @HAVE_GREP@ +HAVE_MAN = @HAVE_MAN@ +HAVE_RM = @HAVE_RM@ +HAVE_SED = @HAVE_SED@ +HAVE_SORT = @HAVE_SORT@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBAA_CONFIG = @LIBAA_CONFIG@ +LIBDJVU = @LIBDJVU@ +LIBGIF = @LIBGIF@ +LIBJPEG = @LIBJPEG@ +LIBOBJS = @LIBOBJS@ +LIBPNG_CONFIG = @LIBPNG_CONFIG@ +LIBPOPPLER = @LIBPOPPLER@ +LIBPS = @LIBPS@ +LIBS = @LIBS@ +LIBSDL_CONFIG = @LIBSDL_CONFIG@ +LIBTIFF = @LIBTIFF@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MAN = @MAN@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POPPLER_CFLAGS = @POPPLER_CFLAGS@ +POPPLER_LIBS = @POPPLER_LIBS@ +RANLIB = @RANLIB@ +RM = @RM@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SORT = @SORT@ +STRIP = @STRIP@ +SVN_REVISION = @SVN_REVISION@ +SVN_REVISION_NUMBER = @SVN_REVISION_NUMBER@ +VERSION = @VERSION@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build_alias = @build_alias@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +fim_cv_version = @fim_cv_version@ +have_convert = @have_convert@ +have_dia = @have_dia@ +have_inkscape = @have_inkscape@ +have_xcftopnm = @have_xcftopnm@ +have_xfig = @have_xfig@ +have_zcat = @have_zcat@ +host_alias = @host_alias@ + +# html stuff is installed in the documentation directories, too +htmldir = $(docdir) +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +HTMLDOCS = FIM.html fim.man.html fimgs.man.html fimrc.man.html +CLEANFILES = doctags *.o tags $(HTMLDOCS) +EXTRA_DIST = FIM.TXT fim.man doctags.c fim-stylesheet.css ./vim2html.pl fimgs.man fimrc.man +#MAN2HTML=man2html +MAN2HTML = $(MAN) --html=cat +MAN2HTMLS = sed 's/−/-/g' +man1_MANS = fim.man fimgs.man +man5_MANS = fimrc.man +dist_html_DATA = $(HTMLDOCS) +dist_doc_DATA = FIM.TXT +ERRMSG = "No $(MAN2HTML) at build time : please install $(MAN2HTML) and reissue :" +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu doc/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-man1: $(man1_MANS) + @$(NORMAL_INSTALL) + @list1='$(man1_MANS)'; \ + list2=''; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list='$(man1_MANS)'; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) +install-man5: $(man5_MANS) + @$(NORMAL_INSTALL) + @list1='$(man5_MANS)'; \ + list2=''; \ + test -n "$(man5dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man5dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man5dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.5[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man5dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man5dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man5dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man5dir)" || exit $$?; }; \ + done; } + +uninstall-man5: + @$(NORMAL_UNINSTALL) + @list='$(man5_MANS)'; test -n "$(man5dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man5dir)'; $(am__uninstall_files_from_dir) +install-dist_docDATA: $(dist_doc_DATA) + @$(NORMAL_INSTALL) + @list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(docdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(docdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(docdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(docdir)" || exit $$?; \ + done + +uninstall-dist_docDATA: + @$(NORMAL_UNINSTALL) + @list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(docdir)'; $(am__uninstall_files_from_dir) +install-dist_htmlDATA: $(dist_html_DATA) + @$(NORMAL_INSTALL) + @list='$(dist_html_DATA)'; test -n "$(htmldir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(htmldir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(htmldir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(htmldir)" || exit $$?; \ + done + +uninstall-dist_htmlDATA: + @$(NORMAL_UNINSTALL) + @list='$(dist_html_DATA)'; test -n "$(htmldir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(htmldir)'; $(am__uninstall_files_from_dir) +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @list='$(MANS)'; if test -n "$$list"; then \ + list=`for p in $$list; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ + if test -n "$$list" && \ + grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ + echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ + grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ + echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ + echo " typically \`make maintainer-clean' will remove them" >&2; \ + exit 1; \ + else :; fi; \ + else :; fi + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(MANS) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(docdir)" "$(DESTDIR)$(htmldir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-dist_docDATA install-dist_htmlDATA \ + install-man + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: install-man1 install-man5 + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-dist_docDATA uninstall-dist_htmlDATA \ + uninstall-man + +uninstall-man: uninstall-man1 uninstall-man5 + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic distclean \ + distclean-generic distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am \ + install-dist_docDATA install-dist_htmlDATA install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-man1 install-man5 install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ + pdf-am ps ps-am uninstall uninstall-am uninstall-dist_docDATA \ + uninstall-dist_htmlDATA uninstall-man uninstall-man1 \ + uninstall-man5 + + +all: $(HTMLDOCS) $(EXTRA_DIST) + +FIM.html fim-stylesheet.css: doctags FIM.TXT + ./doctags $(srcdir)/FIM.TXT > tags ; $(srcdir)/vim2html.pl tags $(srcdir)/FIM.TXT + +fim.man.html: fim.man + $(MAN2HTML) ./$< | $(MAN2HTMLS) > $@ || $(ECHO) "$(ERRMSG) $(MAN2HTML) $< > $@" + +fimrc.man.html: fimrc.man + $(MAN2HTML) ./$< | $(MAN2HTMLS) > $@ || $(ECHO) "$(ERRMSG) $(MAN2HTML) $< > $@" + +fimgs.man.html: fimgs.man + $(MAN2HTML) ./$< | $(MAN2HTMLS) > $@ || $(ECHO) "$(ERRMSG) $(MAN2HTML) $< > $@" + +doctags: doctags.c + $(CC) -o $@ $< + +#clean: +# $(RM) -f doctags.o doctags FIM.html tags fim-stylesheet.css fim.man.html fimgs.man.html + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/doc/doctags.c b/doc/doctags.c new file mode 100644 index 0000000..9213dd9 --- /dev/null +++ b/doc/doctags.c @@ -0,0 +1,83 @@ +/* vim:set ts=4 sw=4: + * this program makes a tags file for vim_ref.txt + * + * Usage: doctags vim_ref.txt vim_win.txt ... >tags + * + * A tag in this context is an identifier between stars, e.g. *c_files* + */ + +#include +#include +#include +#include + +#define LINELEN 200 + + int +main(argc, argv) + int argc; + char **argv; +{ + char line[LINELEN]; + char *p1, *p2; + char *p; + FILE *fd; + + if (argc <= 1) + { + fprintf(stderr, "Usage: doctags docfile ... >tags\n"); + exit(1); + } + printf("help-tags\ttags\t1\n"); + while (--argc > 0) + { + ++argv; + fd = fopen(argv[0], "r"); + if (fd == NULL) + { + fprintf(stderr, "Unable to open %s for reading\n", argv[0]); + continue; + } + while (fgets(line, LINELEN, fd) != NULL) + { + p1 = strchr(line, '*'); /* find first '*' */ + while (p1 != NULL) + { + p2 = strchr(p1 + 1, '*'); /* find second '*' */ + if (p2 != NULL && p2 > p1 + 1) /* skip "*" and "**" */ + { + for (p = p1 + 1; p < p2; ++p) + if (*p == ' ' || *p == '\t' || *p == '|') + break; + /* + * Only accept a *tag* when it consists of valid + * characters, there is white space before it and is + * followed by a white character or end-of-line. + */ + if (p == p2 + && (p1 == line || p1[-1] == ' ' || p1[-1] == '\t') + && (strchr(" \t\n\r", p[1]) != NULL + || p[1] == '\0')) + { + *p2 = '\0'; + ++p1; + printf("%s\t%s\t/*", p1, argv[0]); + while (*p1) + { + /* insert backslash before '\\' and '/' */ + if (*p1 == '\\' || *p1 == '/') + putchar('\\'); + putchar(*p1); + ++p1; + } + printf("*\n"); + p2 = strchr(p2 + 1, '*'); /* find next '*' */ + } + } + p1 = p2; + } + } + fclose(fd); + } + return 0; +} diff --git a/doc/fim-stylesheet.css b/doc/fim-stylesheet.css new file mode 100644 index 0000000..1b92288 --- /dev/null +++ b/doc/fim-stylesheet.css @@ -0,0 +1,23 @@ +body { background-color: white; color: black;} +:link { color: rgb(0,137,139); } +:visited { color: rgb(0,100,100); + background-color: white; /* should be inherit */ } +:active { color: rgb(0,200,200); + background-color: white; /* should be inherit */ } + +B.vimtag { color : rgb(250,0,250); } + +h1, h2 { color: rgb(82,80,82); text-align: center; } +h3, h4, h5, h6 { color: rgb(82,80,82); } +.headline { color: rgb(0,137,139); } +.header { color: rgb(164, 32, 246); } +.section { color: rgb(164, 32, 246); } +.keystroke { color: rgb(106, 89, 205); } +.vim { } +.example { color: rgb(0, 0, 255); } +.option { } +.notvi { } +.special { color: rgb(106, 89, 205); } +.note { color: blue; background-color: yellow; } +.sub {} +.badlink { color: rgb(0,37,39); } diff --git a/doc/fim.man b/doc/fim.man new file mode 100644 index 0000000..fa087fc --- /dev/null +++ b/doc/fim.man @@ -0,0 +1,515 @@ +.\" +.\" $Id$ +.\" +.TH fim 1 "(c) 2007\-2016 Michele Martone" +.SH NAME +fim \- \fBf\fPbi (linux \fBf\fPrame\fBb\fPuffer \fBi\fPmageviewer) \fBim\fPproved +.SH SYNOPSIS +.B fim [{options}] [\-\-] {imagefile} [{imagefiles}] +.fi +.B ... | fim [{options}] [\-\-] [{imagefiles}] \- +.fi +.B fim [{options}] [\-\-] [{files}] \- < {file_name_list_text_file} +.fi +.B fim \-\-image\-from\-stdin [{options}] < {imagefile} +.fi +.B fim \-\-script\-from\-stdin [{options}] < {scriptfile} +.fi + +.SH DESCRIPTION +.B +fim +is a `swiss army knife' for displaying image files. +It is capable of displaying image files using different graphical devices while offering a uniform look and feel; it features an internal command language specialized to the image viewing purposes; it is capable of interacting with standard input and output; the internal command language is accessible via a command line capable of autocompletion and history; it features command recording, supports initialization files, customizable key bindings, internal variables and command aliases, vim\-like autocommands, JPEG comments, EXIF tags display, EXIF rotation/orientation, and much more. + +As a default, +.B +fim +displays the specified file(s) on the detected graphical device (e.g. with SDL if X is detected, or the linux framebuffer device if not). JPEG,PNG,GIF,BMP,TIFF,PPM,PGM,PBM,PCX formats are supported. +For 'XCF' (Gimp's) images, fim will try to use 'xcftopnm'. +For '.FIG' vectorial images, fim will try to use 'fig2dev'. +For '.DIA' vectorial images, fim will try to use 'dia'. +For '.SVG' vectorial images, fim will try to use 'inkscape'. +For other formats fim will try to use ImageMagick's 'convert' executable. + + +If \fB{imagefile}\fP is a directory, therein contained files of supported formats will be loaded. If \fB{imagefile}\fP contains a trailing slash (/), it will be treated as a directory; otherwise a check will be made using \fBstat(2)\fP. To change this default, see description of the _pushdir_re variable and the \-\-no\-stat\-push and \-\-recursive options. + + +If configured at build time, fim will be capable of using SDL or aalib output. + +This man page only describes the +.B fim +command line options. +See man \fR\fIfimrc\fR(5) for a full specification of the +.B +fim +language, commands, variables, and an example configuration file. + +.SH USAGE +You may invoke +.B +fim +from an interactive shell and control it with the keyboard, as you would do with any image viewer with reasonable key bindings. + +.B +fim +is keyboard oriented: there are no user menus or buttons available. +If you need some feature or setting which is not accessible from the default keyboard configuration, you probably need a custom configuration or simply need to type a custom command. For these, you can use the internal command and configuration language. +The full specification for these is accessible at runtime using the internal help system (typing :help). + + +.SH OPTIONS +Accepted command line +.B +{options} +: +.TP +.B \-\- +The arguments before +.B \-\- +beginning with +.B \- +will be treated as command line options. +All arguments after +.B \-\- +will be treated as filenames regardlessly. +. +.TP +.B \-a, \-\-autozoom +Enable autozoom. fim will automagically pick a reasonable zoom factor when loading a new image (as in fbi). +.TP +.B \-b, \-\-binary[=24|1] +Display (any filetype) binary files contents as they were raw 24 or 1 bits per pixel pixelmaps. +Will arrange the image by rows long as specified by the _preferred_rendering_width variable for the image width (unless a narrower image suffices). +Regard this as an easter bunny option. + +.TP +.B \-\-as\-text +Display (any filetype) files contents as they were text. +Will only show printable characters. +Regard this as an easter bunny option. + +.TP +.B \-\-cd\-and\-readdir +Step into the first loaded file directory and push other files. +.TP +.B \-c {commands}, \-\-execute\-commands {commands} +The \fBcommands\fP string will be executed before entering the interactive loop. +Please note that if your commands are more complicated than a simple 'next' or 'pornview' +command, they must be quoted and escaped in a manner suitable for your shell! + +For example, +\-c '*2;2pan_up;display;while(1){align "bottom";sleep "1" ; align "top"}' +(with the single quotes) will tell fim to first double the displayed image +size, then pan two times up, then display the image ; and then +do an endless loop consisting of bottom and top aligning, alternated. + +.TP +.B \-C {commands}, \-\-execute\-commands\-early {commands} +Just as the \-\-execute\-commands option, but commands will be executed before the loading of any config file. + +For example, +\-C '_scale_style=" "' will make fim start with no auto\-scaling. + + +.TP +.B \-d {framebuffer device}, \-\-device {framebuffer device} +Framebuffer device to use. Default is the one your vc is mapped to (as in fbi). +.TP +.B \-\-dump\-reference\-help[=man]. +Will dump to stdout the language reference help. +.TP +.B \-D, \-\-dump\-default\-fimrc +The default configuration (the one hardcoded in the fim executable) is dumped on standard output and fim exits. +.TP +.B \-E {scriptfile}, \-\-execute\-script {scriptfile} +The \fBscriptfile\fP will be executed right after the default initialization file is executed. +.TP +.B \-f {fimrc}, \-\-etc\-fimrc {fimrc} +Specify an alternative system wide initialization file (default: /usr/local/etc/fimrc), which will be executed prior to any other configuration file. + +.TP +.B \-F {commands}, \-\-final\-commands {commands} +The \fBcommands\fP string will be executed after exiting the interactive loop of the program (right before terminating the program). +.TP +.B \-h, \-\-help[=s|d|l|m] + Print (short, descriptive, long, or complete man) program invocation help, and terminate. +.TP +.B \-\-load\-image\-descriptions\-file {filename} +Load image descriptions from {filename}. In {filename} each line is the name of an image file (its basename will be taken), then a Tab character (unless \-\-image\-descriptions\-file\-separator specifies otherwise), then the description text. Each description will be put in the _comment variable of the image at load time. Will override the comment eventually loaded from the file (e.g. JPEG, PNG or TIFF comment). Special comment lines like "#!fim:var=val" will lead i:var to be assigned value val (unquoted) at image loading time. Special description lines begin with markers: with "#!fim:=" the last description line to be used; with "#!fim:+" what follows + will be appended to the last description line; with "#!fim:^" what follows ^ will be prepended to the last description line; with "#!fim:s/f/t" the last description line will be used, but occurrences of string f will be substituted with string t (f and t can contain anything but not a /). If val is empty that variable will be unset. These variables are stored also in an internal index used by the limit command. This option sets _caption_over_image=2, so that a caption will be displayed over the image. +.TP +.B \-\-image\-descriptions\-file\-separator {sepchar} +A character to be used as a separator between the filename and the description part of lines specified just before a \-\-load\-image\-descriptions\-file. +.TP +.B \-i, \-\-image\-from\-stdin +Will read one single image from the standard input (the image data, not the filename). May not work with all supported file formats. +In the image list, this image will be displayed as "". + +.TP +.B \-m {vmode}, \-\-mode {vmode} +Name of the video mode to use video mode (must be listed in /etc/fb.modes). Default is not to change the video mode. In the past, the XF86 config file (/etc/X11/XF86Config) used to contain Modeline information, which could be fed to the modeline2fb perl script (distributed with fbset). On many modern xorg based systems, there is no direct way to obtain a fb.modes file from the xorg.conf file. So instead one could obtain useful fb.modes info by using the (fbmodes (no man page AFAIK)) tool, written by bisqwit. An unsupported mode should make fim exit with failure. But it is possible the kernel could trick fim and set a supported mode automatically, thus ignoring the user set mode. +.TP +.B \-N, \-\-no\-rc\-file +No personal initialization file will be read (default is ~/.fimrc) at startup. +.TP +.B \-\-no\-etc\-rc\-file +No system wide initialization file will be read (default is /usr/local/etc/fimrc) at startup. +.TP +.B \-\-no\-internal\-config +No internal default configuration at startup (uses internal variable _no_default_configuration). Will only provide a minimal working configuration. +.TP +.B \-\-no\-commandline +With internal command line mode disabled. +.TP +.B \-\-no\-history\-save +Do not save execution history at finalization (uses internal variable _save_fim_history). +.TP +.B \-\-no\-history\-load +Do not load execution history at startup. +.TP +.B \-\-no\-history +Do not load or save execution history at startup. +.TP +.B \-p, \-\-script\-from\-stdin +Will read commands from stdin prior to entering in interactive mode. +.TP +.B \-o [fb|sdl|aa|imlib2|caca|dumb], \-\-output\-device [fb|sdl|aa|imlib2|caca|dumb] +Will use the specified \fBdevice\fP as fim video output device, overriding automatic checks.The available devices depend on the original configuration/compilation options, so you should +get the list of available output devices issuing \fBfim \-\-version\fP. +The \fBaa\fP option may be specified as \fBaa={['w']}\fP ; the \fB'w'\fP character allows windowed mode in case of aalib running under X (otherwise, the DISPLAY environment variable will be unset for the current instance of fim). +The \fBsdl\fP option may be specified as \fBsdl={['w']['m']['r']['W']['M']['R']width:height}\fP , where \fBwidth\fP is and \fBheight\fP are integer numbers specifying the desired resolution; the \fB'w'\fP character requests windowed mode; the \fB'm'\fP character requests mouse pointer display; the \fB'r'\fP character requests support for window resize; the same letters uppercase request explicit negation of the mentioned features. + +.TP +.B \-\-offset {bytes\-offset[{:upper\-offset}|{+offset\-range}]} +Will use the specified \fBoffset\fP (in bytes) for opening the specified files. If \fB:upper\-offset\fP is specified, further bytes until \fBupper\-offset\fP will be probed. If \fB+offset\-range\fP is specified instead, that many additional bytes will be probed. Use this option to search damaged file systems for image files. +.TP +.B \-P, \-\-text\-reading +Enable textreading mode. This has the effect that fim will display images scaled to the width of the screen, and aligned to the top. Useful if the images you are watching text pages, all you have to do to get the next piece of text is to press space (in the default key configuration, of course). +.TP +.B \-s {value}, \-\-scroll {value} +Set scroll steps for internal variable _steps (default is 20%). +.TP +.B \-\-slideshow {number} +Interruptible slideshow mode; will wait for {number} of seconds (assigned to the _want_sleep_seconds variable after each loading; implemented by executing while(_fileindex<_filelistlen){sleep _want_sleep_seconds; next;} as a first command. +.TP +.B \-S, \-\-sanity\-check +A quick sanity check before starting the interactive fim execution, but after the initialization. +.TP +.B \-t, \-\-no\-framebuffer +Fim will not use the framebuffer but the aalib (ASCII art) driver instead (if you are curious, see (info aalib)). +If aalib was not enabled at tompile time, fim will work without displaying images at all. +.TP +.B \-T {terminal}, \-\-vt {terminal} +The \fBterminal\fP will be used as virtual terminal device file (as in fbi). +See (chvt (1)), (openvt (1)) for more info about this. +Use (con2fb (1)) to map a terminal to a framebuffer device. + +.TP +.B \-\-sort +Sort files list before browsing according to full filename. +.TP +.B \-\-sort\-basename +Sort files list before browsing according to file basename's. +.TP +.B \-u, \-\-random +Randomly shuffle the files list before browsing (seed depending on time() function). +.TP +.B \-\-random\-no\-seed +Randomly shuffle the files list before browsing (no seeding). +.TP +.B \-v, \-\-verbose +Be verbose: show status bar. +.TP +.B \-V, \-\-version +Display program version, compile flags, enabled features, linked libraries information, supported filetypes/file loaders, and then terminate. +.TP +.B \-w, \-\-autowidth +Scale the image according to the screen width. +.TP +.B \-\-no\-auto\-scale +Do not scale the images after loading (will set '_scale_style=" "';). +.TP +.B \-\-autowindow +Will resize the window size (if supported) to the image size. Don't use this with other image scaling options. +.TP +.B \-\-no\-stat\-push +Sets _push_checks=0 before initialization, thus disabling file/dir existence checks with stat(2) at push push time (and speeding up startup). +.TP +.B \-H, \-\-autoheight +Scale the image according to the screen height. +.TP +.B \-W {scriptfile}, \-\-write\-scriptout {scriptfile} +All the characters that you type are recorded in the file {scriptout}, until you exit Fim. This is useful if you want to create a script file to be used with "fim \-c" or ":exec" (analogous to Vim's \-s and ":source!"). If the {scriptout} file exists, it will be not touched (as in Vim's \-w). +.TP +.B \-, \-\-read\-from\-stdin +Read file list from stdin: each line one file. + +Note that these the three standard input reading functionalities (\-i,\-p and \-) conflict : if two or more of them occur in fim invocation, fim will exit with an error and warn about the ambiguity. + +See the section +.B INVOCATION EXAMPLES +below to read some useful (and unique) ways of employing fim. + +.TP +.B \-\-read\-from\-stdin\-elds +Specify an endline delimiter string for breaking lines read via \-/\-\-read\-from\-stdin. Line text before the delimiter will be treated as names of files to load; the text after will be ignored until a newline. This is useful e.g. to description files as filename list files. + +.TP +.B \-A, \-\-autotop + Align images to the top (UNFINISHED). +.TP +.B \-q, \-\-quiet +Quiet mode. Sets _display_status=0;_display_busy=0;. + +.TP +.B \-r {resolution}, \-\-resolution {resolution} + Set resolution (UNFINISHED). +.TP +.B \-R, \-\-recursive + Push files/directories to the files list recursively. + +.SH PROGRAM RETURN STATUS +The program return status is 0 on correct operation; 252 on unsupported device specification; 248 on bad input; 255 on a generic error; 42 on a signal\-triggered program exit; or a different value in case of an another error. + The return status may be controlled by the use of the quit command. +.SH COMMON KEYS AND COMMANDS +.nf +The following keys and commands are hardcoded in the minimal configuration. These are working by default before any config loading, and before the hardcoded config loading (see variable _fim_default_config_file_contents). + + n goto '+1f' + p goto '\-1f' + + magnify + \- reduce + h pan 'left' + l pan 'right' + k pan 'up' + j pan 'down' + q quit +You can type a number before a command binding to iterate the assigned command: +3k 3pan 'up' + +.nf +: enter command line mode +:{number} jump to {number}^th image in the list +:^ jump to first image in the list +:$ jump to last image in the list +:*{factor} scale the image by {factor} +:{scale}% scale the image to the desired {scale} +:+{scale}% scale the image up to the desired percentage {scale} (relatively to the original) +:\-{scale}% scale the image down to the desired percentage {scale} (relatively to the original) + +/{regexp} entering the pattern {regexp} (with /) makes fim jump to the next image whose filename matches {regexp} +/*.png$ entering this pattern (with /) makes fim jump to the next image whose filename ends with 'png' +/png a shortcut for /.*png.* + +!{syscmd} executes the {syscmd} quoted string as a "/bin/sh" shell command + + +You can visualize all of the default bindings invoking fim \-\-dump\-default\-fimrc | grep bind . +You can visualize all of the default aliases invoking fim \-\-dump\-default\-fimrc | grep alias . + +.fi +.P +The Return vs. Space key thing can be used to create a file list while +reviewing the images and use the list for batch processing later on. + +All of the key bindings are reconfigurable; see the default +.B fimrc +file for examples on this, or read the complete manual: the FIM.TXT file +distributed with fim. +.SH AFFECTING ENVIRONMENT VARIABLES +.nf +FBFONT (just like in fbi) a Linux consolefont font file. +If using a gzipped font, the zcat program will be used to uncompress it (via \fBexecvp(3)\fP). +If not specified, the following files will be probed and the first existing will be selected: + +/usr/share/consolefonts/Uni3\-TerminusBoldVGA14.psf.gz +/usr/lib/kbd/consolefonts/lat9\-16.psf.gz +/usr/share/consolefonts/lat1\-16.psf +/usr/share/consolefonts/lat1\-16.psf.gz +/usr/share/consolefonts/lat1\-16.psfu.gz +/usr/share/kbd/consolefonts/lat1\-16.psf +/usr/share/kbd/consolefonts/lat1\-16.psf.gz +/usr/share/kbd/consolefonts/lat1\-16.psfu.gz +/usr/lib/kbd/consolefonts/lat1\-16.psf +/usr/lib/kbd/consolefonts/lat1\-16.psf.gz +/usr/lib/kbd/consolefonts/lat1\-16.psfu.gz +/lib/kbd/consolefonts/lat1\-16.psf +/lib/kbd/consolefonts/lat1\-16.psf.gz +/lib/kbd/consolefonts/lat1\-16.psfu.gz +/lib/kbd/consolefonts/Lat2\-VGA14.psf.gz +/lib/kbd/consolefonts/Lat2\-VGA16.psf.gz +/lib/kbd/consolefonts/Lat2\-VGA8.psf.gz +/lib/kbd/consolefonts/Uni2\-VGA16.psf.gz +/usr/share/consolefonts/default8x16.psf.gz +/usr/share/consolefonts/default8x9.psf.gz +/usr/share/consolefonts/Lat15\-Fixed16.psf.gz +/usr/share/consolefonts/default.psf.gz +fim:// + +If the special fim:// string is specified, a hardcoded font will be used. +FBGAMMA (just like in fbi) gamma correction (applies to dithered 8 bit mode only). Default is 1.0. +FRAMEBUFFER (just like in fbi) user set framebuffer device file (applies only to the fb mode). +If unset, fim will probe for /dev/fb0. +TERM (only in fim) will influence the output device selection algorithm, especially if $TERM=="screen". +DISPLAY If this variable is set, then the sdl driver will be probed by default. +.SH COMMON PROBLEMS +.B fim +needs read\-write access to the framebuffer devices (/dev/fbN or /dev/fb/N), i.e you (our +your admin) have to make sure fim can open the devices in rw mode. +The IMHO most elegant way is to use pam_console (see +/etc/security/console.perms) to chown the devices to the user logged +in on the console. Another way is to create some group, chown the +special files to that group and put the users which are allowed to use +the framebuffer device into the group. You can also make the special +files world writable, but be aware of the security implications this +has. On a private box it might be fine to handle it this way +through. + +If using udev, you can edit : +/etc/udev/permissions.d/50\-udev.permissions +and set these lines like here : + # fb devices + fb:root:root:0600 + fb[0\-9]*:root:root:0600 + fb/*:root:root:0600 +.P + +.B fim +also needs access to the linux console (i.e. /dev/ttyN) for sane +console switch handling. That is obviously no problem for console +logins, but any kind of a pseudo tty (xterm, ssh, screen, ...) will +.B not +work. +.SH INVOCATION EXAMPLES +.B fim media/ +.fi +# Will load files from the directory media. +.P +.P + +.B fim \-R media/ \-\-sort +.fi +# Will open files found by recursive traversal of directory media, then sorting the list. +.P +.P + +.B +.B find /mnt/media/ \-name *.jpg | fim \- +.fi +# Will make fim read the file list from standard input. +.P +.P + +.B +find /mnt/media/ \-name *.jpg | shuf | fim \- +.fi +# will make fim read the file list from standard input, randomly shuffled. +.P +.P + +.B +cat script.fim | fim \-p images/* +.fi +# Will make fim read the script file +.B script.fim +from standard input prior to displaying files in the directory +.B images +.P +.P + +.B +scanimage ... | tee scan.ppm | fim \-i +.fi +# Will make fim read the image scanned from a flatbed scanner as soon as it is read +.P +.P + +.B fim * > selection.txt +.fi +# Will output the file names marked interactively with the 'list "mark"' command in fim to a file. +.P +.P + +.B fim * | fim \- +.fi +# will output the file names marked with 'm' in fim to a second instance of fim, in which these could be marked again. +.P +.P + +.B fim +\-c 'pread "vgrabbj \-d /dev/video0 \-o png";reload' +.fi +# will display an image grabbed from a webcam. +.P +.P + +.B fim +\-o aa \-c 'pread "vgrabbj \-d /dev/video0 \-o png";reload;system "fbgrab" "asciime.png"' +.fi +# if running in framebuffer mode, will save a png screenshot with an ASCII rendering of an image grabbed from a webcam. +.P +.P + +.B fim +\-c 'while(1){pread "vgrabbj \-d /dev/video0 \-o png";reload;sleep 1;};' +.fi +# will display a sequence of images grabbed from a webcam; circa 1 per second. +.P +.P + +.SH NOTES +This manual page is neither accurate nor complete. In particular, issues related to driver selection shall be described more accurately. Also the accurate sequence of autocommands execution, variables application is critical to understanding fim, and should be documented. +The filename "" is reserved for images read from standard input (view this as a limitation), and thus handling files with such name may incur in limitations. +The SDL driver is quite inefficient, for a variety of reasons. In particular, its interaction with the readline library can be problematic (e.g.: when running in sdl mode without a terminal). This shall be fixed. +.SH BUGS +.B fim +has bugs. Please read the +.B BUGS +file shipped in the documentation directory to discover the known ones. +.SH FILES + +.TP 15 +.B /usr/local/share/doc/fim +The directory with +.B Fim +documentation files. +.TP 15 +.B /usr/local/etc/fimrc +The system wide +.B Fim +initialization file (executed at startup, after executing the hardcoded configuration). +.TP 15 +.B ~/.fimrc +The personal +.B Fim +initialization file (executed at startup, after the system wide initialization file). +.TP 15 +.B ~/.inputrc +If +.B Fim +is built with GNU readline support, it will be susceptible to chages in the user set ~/.inputrc configuration file contents. For details, see (man \fR\fIreadline\fR(3)). +.SH SEE ALSO +Other +.B Fim +man pages: \fR\fIfimgs\fR(1), \fR\fIfimrc\fR(1). +.fi +Or related programs: \fR\fIfbset\fR(1), \fR\fIcon2fb\fR(1), \fR\fIconvert\fR(1), \fR\fIvim\fR(1), \fR\fIfb.modes\fR(8), \fR\fIfbset\fR(8), \fR\fIfbgrab\fR(1), \fR\fIfbdev\fR(4), \fR\fIsetfont\fR(8), \fR\fIxfs\fR(1). +.SH AUTHOR +.nf +Michele Martone is the author of fim, "fbi improved". +.fi +.SH COPYRIGHT +.nf +Copyright (C) 2007\-2016 Michele Martone (author of fim) +.fi +Copyright (C) 1999\-2004 Gerd Hoffmann is the author of "fbi", upon which +.B fim +was originally based. +.P +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. +.P +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +.P +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110\-1301 USA. + diff --git a/doc/fim.man.html b/doc/fim.man.html new file mode 100644 index 0000000..d1c41bc --- /dev/null +++ b/doc/fim.man.html @@ -0,0 +1,1132 @@ + + + + + + + + + +fim + + + + +

fim

+ +NAME
+SYNOPSIS
+DESCRIPTION
+USAGE
+OPTIONS
+PROGRAM RETURN STATUS
+COMMON KEYS AND COMMANDS
+AFFECTING ENVIRONMENT VARIABLES
+COMMON PROBLEMS
+INVOCATION EXAMPLES
+NOTES
+BUGS
+FILES
+SEE ALSO
+AUTHOR
+COPYRIGHT
+ +
+ + +

NAME + +

+ + +

fim - +fbi (linux framebuffer +imageviewer) improved

+ +

SYNOPSIS + +

+ + +

fim +[{options}] [--] {imagefile} [{imagefiles}]
+... | fim [{options}] [--] [{imagefiles}] +-
+fim [{options}] [--] [{files}] - < +{file_name_list_text_file}
+fim --image-from-stdin [{options}] +< {imagefile}
+fim --script-from-stdin [{options}] +< {scriptfile}

+ +

DESCRIPTION + +

+ + +

fim is a +’swiss army knife’ for displaying image files. +It is capable of displaying image files using different +graphical devices while offering a uniform look and feel; it +features an internal command language specialized to the +image viewing purposes; it is capable of interacting with +standard input and output; the internal command language is +accessible via a command line capable of autocompletion and +history; it features command recording, supports +initialization files, customizable key bindings, internal +variables and command aliases, vim-like autocommands, +JPEG comments, EXIF tags display, EXIF rotation/orientation, +and much more.

+ +

As a default, +fim displays the specified file(s) on the detected +graphical device (e.g. with SDL if X is detected, or the +linux framebuffer device if not). +JPEG,PNG,GIF,BMP,TIFF,PPM,PGM,PBM,PCX formats are supported. +For ’XCF’ (Gimp’s) images, fim will try to +use ’xcftopnm’. For ’.FIG’ vectorial +images, fim will try to use ’fig2dev’. For +’.DIA’ vectorial images, fim will try to use +’dia’. For ’.SVG’ vectorial images, +fim will try to use ’inkscape’. For other +formats fim will try to use ImageMagick’s +’convert’ executable.

+ +

If +{imagefile} is a directory, therein contained files +of supported formats will be loaded. If {imagefile} +contains a trailing slash (/), it will be treated as a +directory; otherwise a check will be made using +stat(2). To change this default, see description of +the _pushdir_re variable and the +--no-stat-push and +--recursive options.

+ +

If configured +at build time, fim will be capable of using SDL or aalib +output.

+ +

This man page +only describes the fim command line options. See man +fimrc(5) for a full specification of the fim +language, commands, variables, and an example configuration +file.

+ +

USAGE + +

+ + +

You may invoke +fim from an interactive shell and control it with the +keyboard, as you would do with any image viewer with +reasonable key bindings.

+ +

fim is +keyboard oriented: there are no user menus or buttons +available. If you need some feature or setting which is not +accessible from the default keyboard configuration, you +probably need a custom configuration or simply need to type +a custom command. For these, you can use the internal +command and configuration language. The full specification +for these is accessible at runtime using the internal help +system (typing :help).

+ +

OPTIONS + +

+ + +

Accepted +command line {options} :

+ + + + + + + +
+ + +

--

+ + +

The arguments before -- beginning +with - will be treated as command line options. +All arguments after -- will be treated as +filenames regardlessly.

+ +

-a, +--autozoom

+ +

Enable autozoom. fim will +automagically pick a reasonable zoom factor when loading a +new image (as in fbi).

+ +

-b, +--binary[=24|1]

+ +

Display (any filetype) binary +files contents as they were raw 24 or 1 bits per pixel +pixelmaps. Will arrange the image by rows long as specified +by the _preferred_rendering_width variable for the image +width (unless a narrower image suffices). Regard this as an +easter bunny option.

+ + +

--as-text

+ +

Display (any filetype) files +contents as they were text. Will only show printable +characters. Regard this as an easter bunny option.

+ + +

--cd-and-readdir

+ +

Step into the first loaded file +directory and push other files.

+ +

-c {commands}, +--execute-commands {commands}

+ +

The commands string will +be executed before entering the interactive loop. Please +note that if your commands are more complicated than a +simple ’next’ or ’pornview’ command, +they must be quoted and escaped in a manner suitable for +your shell!

+ +

For example, +-c ’*2;2pan_up;display;while(1){align +"bottom";sleep "1" ; align +"top"}’ (with the single quotes) will tell +fim to first double the displayed image size, then pan two +times up, then display the image ; and then do an endless +loop consisting of bottom and top aligning, alternated.

+ +

-C {commands}, +--execute-commands-early +{commands}

+ +

Just as the +--execute-commands option, but commands +will be executed before the loading of any config file.

+ +

For example, +-C ’_scale_style=" "’ will make +fim start with no auto-scaling.

+ +

-d {framebuffer +device}, --device {framebuffer device}

+ +

Framebuffer device to use. +Default is the one your vc is mapped to (as in fbi).

+ + +

--dump-reference-help[=man].

+ +

Will dump to stdout the +language reference help.

+ +

-D, +--dump-default-fimrc

+ +

The default configuration (the +one hardcoded in the fim executable) is dumped on standard +output and fim exits.

+ +

-E {scriptfile}, +--execute-script {scriptfile}

+ +

The scriptfile will be +executed right after the default initialization file is +executed.

+ +

-f {fimrc}, +--etc-fimrc {fimrc}

+ +

Specify an alternative system +wide initialization file (default: /usr/local/etc/fimrc), +which will be executed prior to any other configuration +file.

+ +

-F {commands}, +--final-commands {commands}

+ +

The commands string will +be executed after exiting the interactive loop of the +program (right before terminating the program).

+ +

-h, +--help[=s|d|l|m]

+ +

Print (short, descriptive, +long, or complete man) program invocation help, and +terminate.

+ + +

--load-image-descriptions-file +{filename}

+ +

Load image descriptions from +{filename}. In {filename} each line is the name of an image +file (its basename will be taken), then a Tab character +(unless +--image-descriptions-file-separator +specifies otherwise), then the description text. Each +description will be put in the _comment variable of the +image at load time. Will override the comment eventually +loaded from the file (e.g. JPEG, PNG or TIFF comment). +Special comment lines like "#!fim:var=val" will +lead i:var to be assigned value val (unquoted) at image +loading time. Special description lines begin with markers: +with "#!fim:=" the last description line to be +used; with "#!fim:+" what follows + will be +appended to the last description line; with +"#!fim:^" what follows ^ will be prepended to the +last description line; with "#!fim:s/f/t" the last +description line will be used, but occurrences of string f +will be substituted with string t (f and t can contain +anything but not a /). If val is empty that variable will be +unset. These variables are stored also in an internal index +used by the limit command. This option sets +_caption_over_image=2, so that a caption will be displayed +over the image.

+ + +

--image-descriptions-file-separator +{sepchar}

+ +

A character to be used as a +separator between the filename and the description part of +lines specified just before a +--load-image-descriptions-file.

+ +

-i, +--image-from-stdin

+ +

Will read one single image from +the standard input (the image data, not the filename). May +not work with all supported file formats. In the image list, +this image will be displayed as +"<STDIN>".

+ +

-m {vmode}, +--mode {vmode}

+ +

Name of the video mode to use +video mode (must be listed in /etc/fb.modes). Default is not +to change the video mode. In the past, the XF86 config file +(/etc/X11/XF86Config) used to contain Modeline information, +which could be fed to the modeline2fb perl script +(distributed with fbset). On many modern xorg based systems, +there is no direct way to obtain a fb.modes file from the +xorg.conf file. So instead one could obtain useful fb.modes +info by using the (fbmodes (no man page AFAIK)) tool, +written by bisqwit. An unsupported mode should make fim exit +with failure. But it is possible the kernel could trick fim +and set a supported mode automatically, thus ignoring the +user set mode.

+ +

-N, +--no-rc-file

+ +

No personal initialization file +will be read (default is ~/.fimrc) at startup.

+ + +

--no-etc-rc-file

+ +

No system wide initialization +file will be read (default is /usr/local/etc/fimrc) at +startup.

+ + +

--no-internal-config

+ +

No internal default +configuration at startup (uses internal variable +_no_default_configuration). Will only provide a minimal +working configuration.

+ + +

--no-commandline

+ +

With internal command line mode +disabled.

+ + +

--no-history-save

+ +

Do not save execution history +at finalization (uses internal variable +_save_fim_history).

+ + +

--no-history-load

+ +

Do not load execution history +at startup.

+ + +

--no-history

+ +

Do not load or save execution +history at startup.

+ +

-p, +--script-from-stdin

+ +

Will read commands from stdin +prior to entering in interactive mode.

+ +

-o +[fb|sdl|aa|imlib2|caca|dumb], +--output-device
+[fb|sdl|aa|imlib2|caca|dumb]

+ +

Will use the specified +device as fim video output device, overriding +automatic checks.The available devices depend on the +original configuration/compilation options, so you should +get the list of available output devices issuing fim +--version. The aa option may be +specified as aa={[’w’]} ; the +’w’ character allows windowed mode in +case of aalib running under X (otherwise, the DISPLAY +environment variable will be unset for the current instance +of fim). The sdl option may be specified as +sdl={[’w’][’m’][’r’][’W’][’M’][’R’]width:height} +, where width is and height are integer +numbers specifying the desired resolution; the +’w’ character requests windowed mode; the +’m’ character requests mouse pointer +display; the ’r’ character requests +support for window resize; the same letters uppercase +request explicit negation of the mentioned features.

+ +

--offset +{bytes-offset[{:upper-offset}|{+offset-range}]}

+ +

Will use the specified +offset (in bytes) for opening the specified files. If +:upper-offset is specified, further bytes until +upper-offset will be probed. If ++offset-range is specified instead, that many +additional bytes will be probed. Use this option to search +damaged file systems for image files.

+ +

-P, +--text-reading

+ +

Enable textreading mode. This +has the effect that fim will display images scaled to the +width of the screen, and aligned to the top. Useful if the +images you are watching text pages, all you have to do to +get the next piece of text is to press space (in the default +key configuration, of course).

+ +

-s {value}, +--scroll {value}

+ +

Set scroll steps for internal +variable _steps (default is 20%).

+ +

--slideshow +{number}

+ +

Interruptible slideshow mode; +will wait for {number} of seconds (assigned to the +_want_sleep_seconds variable after each loading; implemented +by executing while(_fileindex<_filelistlen){sleep +_want_sleep_seconds; next;} as a first command.

+ +

-S, +--sanity-check

+ +

A quick sanity check before +starting the interactive fim execution, but after the +initialization.

+ +

-t, +--no-framebuffer

+ +

Fim will not use the +framebuffer but the aalib (ASCII art) driver instead (if you +are curious, see (info aalib)). If aalib was not enabled at +tompile time, fim will work without displaying images at +all.

+ +

-T {terminal}, +--vt {terminal}

+ +

The terminal will be +used as virtual terminal device file (as in fbi). See (chvt +(1)), (openvt (1)) for more info about this. Use (con2fb +(1)) to map a terminal to a framebuffer device.

+ + + + + + + +
+ + +

--sort

+ + +

Sort files list before browsing according to full +filename.

+ + +

--sort-basename

+ +

Sort files list before browsing +according to file basename’s.

+ +

-u, +--random

+ +

Randomly shuffle the files list +before browsing (seed depending on time() function).

+ + +

--random-no-seed

+ +

Randomly shuffle the files list +before browsing (no seeding).

+ +

-v, +--verbose

+ +

Be verbose: show status +bar.

+ +

-V, +--version

+ +

Display program version, +compile flags, enabled features, linked libraries +information, supported filetypes/file loaders, and then +terminate.

+ +

-w, +--autowidth

+ +

Scale the image according to +the screen width.

+ + +

--no-auto-scale

+ +

Do not scale the images after +loading (will set ’_scale_style=" +"’;).

+ + +

--autowindow

+ +

Will resize the window size (if +supported) to the image size. Don’t use this with +other image scaling options.

+ + +

--no-stat-push

+ +

Sets _push_checks=0 before +initialization, thus disabling file/dir existence checks +with stat(2) at push push time (and speeding up +startup).

+ +

-H, +--autoheight

+ +

Scale the image according to +the screen height.

+ +

-W {scriptfile}, +--write-scriptout {scriptfile}

+ +

All the characters that you +type are recorded in the file {scriptout}, until you exit +Fim. This is useful if you want to create a script file to +be used with "fim -c" or ":exec" +(analogous to Vim’s -s and +":source!"). If the {scriptout} file exists, it +will be not touched (as in Vim’s -w).

+ +

-, +--read-from-stdin

+ +

Read file list from stdin: each +line one file.

+ +

Note that these +the three standard input reading functionalities +(-i,-p and -) conflict : if two or more of +them occur in fim invocation, fim will exit with an error +and warn about the ambiguity.

+ +

See the section +INVOCATION EXAMPLES below to read some useful (and +unique) ways of employing fim.

+ + +

--read-from-stdin-elds +<arg>

+ +

Specify an endline delimiter +string for breaking lines read via +-/--read-from-stdin. Line text +before the delimiter will be treated as names of files to +load; the text after will be ignored until a newline. This +is useful e.g. to description files as filename list +files.

+ +

-A, +--autotop

+ +

Align images to the top +(UNFINISHED).

+ +

-q, +--quiet

+ +

Quiet mode. Sets +_display_status=0;_display_busy=0;.

+ +

-r {resolution}, +--resolution {resolution}

+ +

Set resolution +(UNFINISHED).

+ +

-R, +--recursive

+ +

Push files/directories to the +files list recursively.

+ +

PROGRAM RETURN STATUS + +

+ + +

The program +return status is 0 on correct operation; 252 on unsupported +device specification; 248 on bad input; 255 on a generic +error; 42 on a signal-triggered program exit; or a +different value in case of an another error.
+The return status may be controlled by the use of the quit +command.

+ +

COMMON KEYS AND COMMANDS + +

+ + +

The following +keys and commands are hardcoded in the minimal +configuration. These are working by default before any +config loading, and before the hardcoded config loading (see +variable _fim_default_config_file_contents).

+ +

n goto +’+1f’
+p goto ’-1f’
++ magnify
+- reduce
+h pan ’left’
+l pan ’right’
+k pan ’up’
+j pan ’down’
+q quit
+You can type a number before a command binding to iterate +the assigned command:
+3k 3pan ’up’

+ +

: enter command +line mode
+:{number} jump to {number}^th image in the list

+ + + + + + + + + + + + +
+ + +

:^

+ + +

jump to first image in the list

+ + +

:$

+ + +

jump to last image in the list

+ +

:*{factor} scale the image by +{factor}
+:{scale}% scale the image to the desired {scale}
+:+{scale}% scale the image up to the desired percentage +{scale} (relatively to the original)
+:-{scale}% scale the image down to the desired +percentage {scale} (relatively to the original)

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

/{regexp}

+ + + +

entering the pattern {regexp} (with /) makes fim jump to +the next image whose filename matches {regexp}

+ + +

/*.png$

+ + + +

entering this pattern (with /) makes fim jump to the +next image whose filename ends with ’png’

+ + +

/png

+ + + +

a shortcut for /.*png.*

+
+ + +

!{syscmd}

+ + + +

executes the {syscmd} quoted string as a +"/bin/sh" shell command

+ +

You can +visualize all of the default bindings invoking fim +--dump-default-fimrc | grep bind . +
+You can visualize all of the default aliases invoking fim +--dump-default-fimrc | grep alias +.

+ +

The Return vs. +Space key thing can be used to create a file list while +reviewing the images and use the list for batch processing +later on.

+ +

All of the key +bindings are reconfigurable; see the default fimrc +file for examples on this, or read the complete manual: the +FIM.TXT file distributed with fim.

+ +

AFFECTING ENVIRONMENT VARIABLES + +

+ + + + + + + + + + +
+ + +

FBFONT

+ + + +

(just like in fbi) a Linux consolefont font file.

+ +

If using a gzipped font, the +zcat program will be used to uncompress it (via +execvp(3)).
+If not specified, the following files will be probed and the +first existing will be selected:

+ + +

/usr/share/consolefonts/Uni3-TerminusBoldVGA14.psf.gz +
+/usr/lib/kbd/consolefonts/lat9-16.psf.gz
+/usr/share/consolefonts/lat1-16.psf
+/usr/share/consolefonts/lat1-16.psf.gz
+/usr/share/consolefonts/lat1-16.psfu.gz
+/usr/share/kbd/consolefonts/lat1-16.psf
+/usr/share/kbd/consolefonts/lat1-16.psf.gz
+/usr/share/kbd/consolefonts/lat1-16.psfu.gz
+/usr/lib/kbd/consolefonts/lat1-16.psf
+/usr/lib/kbd/consolefonts/lat1-16.psf.gz
+/usr/lib/kbd/consolefonts/lat1-16.psfu.gz
+/lib/kbd/consolefonts/lat1-16.psf
+/lib/kbd/consolefonts/lat1-16.psf.gz
+/lib/kbd/consolefonts/lat1-16.psfu.gz
+/lib/kbd/consolefonts/Lat2-VGA14.psf.gz
+/lib/kbd/consolefonts/Lat2-VGA16.psf.gz
+/lib/kbd/consolefonts/Lat2-VGA8.psf.gz
+/lib/kbd/consolefonts/Uni2-VGA16.psf.gz
+/usr/share/consolefonts/default8x16.psf.gz
+/usr/share/consolefonts/default8x9.psf.gz
+/usr/share/consolefonts/Lat15-Fixed16.psf.gz
+/usr/share/consolefonts/default.psf.gz
+fim://

+ +

If the special +fim:// string is specified, a hardcoded font will be +used.

+ + + + + + + + + + + + + + + + +
+ + +

FBGAMMA

+ + + +

(just like in fbi) gamma correction (applies to dithered +8 bit mode only). Default is 1.0.

+ + +

FRAMEBUFFER

+ + +

(just like in fbi) user set framebuffer device file +(applies only to the fb mode).

+ +

If unset, fim will probe for +/dev/fb0.

+ + + + + + + + + + + + + + +
+ + +

TERM

+ + + +

(only in fim) will influence the output device selection +algorithm, especially if $TERM=="screen".

+ + +

DISPLAY

+ + +

If this variable is set, then the sdl driver will be +probed by default.

+ +

COMMON PROBLEMS + +

+ + +

fim +needs read-write access to the framebuffer devices +(/dev/fbN or /dev/fb/N), i.e you (our your admin) have to +make sure fim can open the devices in rw mode. The IMHO most +elegant way is to use pam_console (see +/etc/security/console.perms) to chown the devices to the +user logged in on the console. Another way is to create some +group, chown the special files to that group and put the +users which are allowed to use the framebuffer device into +the group. You can also make the special files world +writable, but be aware of the security implications this +has. On a private box it might be fine to handle it this way +through.

+ +

If using udev, +you can edit : +/etc/udev/permissions.d/50-udev.permissions and set +these lines like here :
+# fb devices
+fb:root:root:0600
+fb[0-9]*:root:root:0600
+fb/*:root:root:0600

+ +

fim also +needs access to the linux console (i.e. /dev/ttyN) for sane +console switch handling. That is obviously no problem for +console logins, but any kind of a pseudo tty (xterm, ssh, +screen, ...) will not work.

+ +

INVOCATION EXAMPLES + +

+ + +

fim +media/
+# Will load files from the directory media.

+ +

fim -R +media/ --sort
+# Will open files found by recursive traversal of directory +media, then sorting the list.

+ +

find +/mnt/media/ -name *.jpg | fim -
+# Will make fim read the file list from standard input.

+ +

find +/mnt/media/ -name *.jpg | shuf | fim -
+# will make fim read the file list from standard input, +randomly shuffled.

+ +

cat +script.fim | fim -p images/*
+# Will make fim read the script file script.fim from +standard input prior to displaying files in the directory +images

+ +

scanimage +... | tee scan.ppm | fim -i
+# Will make fim read the image scanned from a flatbed +scanner as soon as it is read

+ +

fim * > +selection.txt
+# Will output the file names marked interactively with the +’list "mark"’ command in fim to a +file.

+ +

fim * | fim +-
+# will output the file names marked with ’m’ in +fim to a second instance of fim, in which these could be +marked again.

+ +

fim +-c ’pread "vgrabbj -d /dev/video0 +-o png";reload’
+# will display an image grabbed from a webcam.

+ +

fim +-o aa -c ’pread "vgrabbj -d +/dev/video0 -o png";reload;system +"fbgrab" "asciime.png"’
+# if running in framebuffer mode, will save a png screenshot +with an ASCII rendering of an image grabbed from a +webcam.

+ +

fim +-c ’while(1){pread "vgrabbj -d +/dev/video0 -o png";reload;sleep 1;};’
+# will display a sequence of images grabbed from a webcam; +circa 1 per second.

+ +

NOTES + +

+ + +

This manual +page is neither accurate nor complete. In particular, issues +related to driver selection shall be described more +accurately. Also the accurate sequence of autocommands +execution, variables application is critical to +understanding fim, and should be documented. The filename +"<STDIN>" is reserved for images read from +standard input (view this as a limitation), and thus +handling files with such name may incur in limitations. The +SDL driver is quite inefficient, for a variety of reasons. +In particular, its interaction with the readline library can +be problematic (e.g.: when running in sdl mode without a +terminal). This shall be fixed.

+ +

BUGS + +

+ + +

fim has +bugs. Please read the BUGS file shipped in the +documentation directory to discover the known ones.

+ +

FILES + +

+ + + +

/usr/local/share/doc/fim

+ +

The directory with Fim +documentation files.

+ + +

/usr/local/etc/fimrc

+ +

The system wide Fim +initialization file (executed at startup, after executing +the hardcoded configuration).

+ + + + + + + + + + + + +
+ + +

~/.fimrc

+ + +

The personal Fim initialization file (executed at +startup, after the system wide initialization file).

+ + +

~/.inputrc

+ + +

If Fim is built with GNU readline support, it +will be susceptible to chages in the user set ~/.inputrc +configuration file contents. For details, see (man +readline(3)).

+ +

SEE ALSO + +

+ + +

Other +Fim man pages: fimgs(1), fimrc(1).
+Or related programs: fbset(1), con2fb(1), +convert(1), vim(1), fb.modes(8), +fbset(8), fbgrab(1), fbdev(4), +setfont(8), xfs(1).

+ +

AUTHOR + +

+ + +

Michele Martone +<dezperado _CUT_ autistici _CUT_ org> is the author of +fim, "fbi improved".

+ +

COPYRIGHT + +

+ + +

Copyright (C) +2007-2016 Michele Martone <dezperado _CUT_ +autistici _CUT_ org> (author of fim)
+Copyright (C) 1999-2004 Gerd Hoffmann <kraxel _CUT_ +bytesex.org> is the author of "fbi", upon which +fim was originally based.

+ +

This program is +free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as +published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version.

+ +

This program is +distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details.

+ +

You should have +received a copy of the GNU General Public License along with +this program; if not, write to the Free Software Foundation, +Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA.

+
+ + diff --git a/doc/fimgs.man b/doc/fimgs.man new file mode 100644 index 0000000..70b0b35 --- /dev/null +++ b/doc/fimgs.man @@ -0,0 +1,38 @@ +.TH fimgs 1 "(c) 2007\-2011 Michele Martone" +.SH NAME +fimgs \- poor man's [http://]PostScript/pdf/dvi/cbr/rar/cbz/zip viewer for the linux +framebuffer console +.SH SYNOPSIS +.B fimgs [ {fimgs\-options} ] file [\-\- [{fim\-options}]] +.SH DESCRIPTION +.B fimgs +is a simple wrapper script which takes a PostScript or pdf or .cbr or .rar or .cbz or .zip or .dvi or any of the above prefixed with http:// or https:// or ssh:// as input, renders the pages using ghostscript into a temporary directory and finally calls \fB fim\fP to display them. + +In case of compressed archives (in zip or rar formats), the images are decompressed into a directory and displayed using \fB fim\fP. +In this latter case, only images contained in the archive will be displayed (no nested archives or pdf's or ps's or dvi's). + +The temporary directory name is taken from the $TMPDIR environment variable. + +.SH OPTIONS +To pass through options to \fB fim\fP, you may specify them after "\-\-". + +.B \-r {resolution} +Specify resolution for the 'gs' \-r option (e.g.: 96x96; default 120x120). +.TP + +.B \-m +Dump a man page for fimgs. +.TP + +.B \-p {password} +Specify password for the 'gs' \-p (password) option. +.TP + +.B \-h +Will display a help message. +.\" Additionally you can specify \-l, \-xl or \-xxl to get the pages +.\" rendered with 100, 120 or 150 dpi (default is 75). +.SH SEE ALSO +fim(1), fimrc(1), gs(1), fbi(1), fbgs(1), bash(1) +.SH AUTHOR +Michele Martone . diff --git a/doc/fimgs.man.html b/doc/fimgs.man.html new file mode 100644 index 0000000..2b2dcbd --- /dev/null +++ b/doc/fimgs.man.html @@ -0,0 +1,144 @@ + + + + + + + + + +fimgs + + + + +

fimgs

+ +NAME
+SYNOPSIS
+DESCRIPTION
+OPTIONS
+SEE ALSO
+AUTHOR
+ +
+ + +

NAME + +

+ + +

fimgs - +poor man’s [http://]PostScript/pdf/dvi/cbr/rar/cbz/zip +viewer for the linux framebuffer console

+ +

SYNOPSIS + +

+ + +

fimgs [ +{fimgs-options} ] file [-- +[{fim-options}]]

+ +

DESCRIPTION + +

+ + +

fimgs is +a simple wrapper script which takes a PostScript or pdf or +.cbr or .rar or .cbz or .zip or .dvi or any of the above +prefixed with http:// or https:// or ssh:// as input, +renders the pages using ghostscript into a temporary +directory and finally calls fim to display them.

+ +

In case of +compressed archives (in zip or rar formats), the images are +decompressed into a directory and displayed using +fim. In this latter case, only images contained in +the archive will be displayed (no nested archives or +pdf’s or ps’s or dvi’s).

+ +

The temporary +directory name is taken from the $TMPDIR environment +variable.

+ +

OPTIONS + +

+ + +

To pass through +options to fim, you may specify them after +"--".

+ +

-r +{resolution} Specify resolution for the ’gs’ +-r option (e.g.: 96x96; default 120x120).

+ + + + + + + + +
+ + +

-m

+ + +

Dump a man page for fimgs.

+
+ +

-p +{password}

+ +

Specify password for the +’gs’ -p (password) option.

+ + + + + + + + +
+ + +

-h

+ + +

Will display a help message.

+
+ +

SEE ALSO + +

+ + +

fim(1), +fimrc(1), gs(1), fbi(1), fbgs(1), bash(1)

+ +

AUTHOR + +

+ + +

Michele Martone +<dezperado _ GUESS _ autistici.org>.

+
+ + diff --git a/doc/fimrc.man b/doc/fimrc.man new file mode 100644 index 0000000..0614cc6 --- /dev/null +++ b/doc/fimrc.man @@ -0,0 +1,1418 @@ +.\" +.\" $Id$ +.\" +.TH fimrc 5 "(c) 2011\-2016 Michele Martone" +.SH NAME +fimrc \- \fB fim \fP configuration file and language reference + +.SH SYNOPSIS +.B ~/.fimrc +.fi +.B /usr/local/etc/fimrc +.fi +.B fim \-\-script\-from\-stdin [ {options} ] < {scriptfile} +.fi +.B fim \-\-execute\-script {scriptfile} [ {options} ] +.fi +.B fim \-\-execute\-commands {commands} [ {options} ] +.fi +.B fim \-\-final\-commands {commands} [ {options} ] +.fi +.B fim \-\-write\-scriptout {scriptfile} [ {options} ] +.fi +.B fim \-\-write\-scriptout /dev/stdout [ {options} ] +.fi + +.SH DESCRIPTION +This page explains the +.B fim +language, which is used for the +.B fimrc +configuration files, {scriptfile}s, or {commands} passed via command line {options}. +This language can be used to issue commands (or programs) from the internal program command line accessed interactively through the ":" key (or rather, the key code specified by the "_console_key" variable). +One may exit from command line mode by pressing the Enter key on an empty line (a non empty command line would be submitted for execution), or the Esc key (only in SDL mode). +The general form of a fim command/program is shown in the next section. + + +.SH FIM LANGUAGE GRAMMAR +This section specifies the grammar of the +.B fim +language. + +Language elements surrounded by a single quote ("'") are literals. + +Warning: at the present state, this grammar has conflicts. A future release shall fix them. + + program: %empty + | statement_list + + statement_list: statement + | statement ';' statement_list + | non_atomic_statements_block statement_list + | statements_block + + non_atomic_statements_block: '{' statement_list '}' + | INTEGER '{' statement_list '}' + | conditional_statement + + statements_block: atomic_statements_block + | non_atomic_statements_block + + conditional_statement: if_statement + | loop_statement + + if_statement: 'if' '(' expression ')' statements_block + | 'if' '(' expression ')' statements_block 'else' statements_block + + loop_statement: 'while' '(' expression ')' statements_block + | 'do' statements_block 'while' '(' expression ')' + + atomic_statements_block: statement ';' + | statement ';' ';' + | statement ';' ';' ';' + + statement: '!' arguments + | INTEGER IDENTIFIER + | SLASH_AND_REGEXP + | '+' UNQUOTED_FLOAT '%' + | '+' QUOTED_FLOAT '%' + | '+' INTEGER '%' + | '*' UNQUOTED_FLOAT + | '*' QUOTED_FLOAT + | '*' INTEGER + | UNQUOTED_FLOAT '%' + | QUOTED_FLOAT '%' + | INTEGER '%' + | '\-' UNQUOTED_FLOAT '%' + | '\-' QUOTED_FLOAT '%' + | '\-' INTEGER '%' + | INTEGER + | '\-' INTEGER + | IDENTIFIER + | IDENTIFIER FILE_PATH + | IDENTIFIER arguments + | INTEGER IDENTIFIER arguments + | IDENTIFIER '=' expression + + arguments: expression + | expression arguments + + expression: '(' expression ')' + | expression '.' expression + | '!' expression + | expression '%' expression + | expression '+' expression + | expression '\-' expression + | expression '*' expression + | expression '/' expression + | expression '<' expression + | expression '>' expression + | expression '||' expression + | expression BOR expression + | expression '&&' expression + | expression BAND expression + | expression '>=' expression + | expression '<=' expression + | expression '!=' expression + | expression '==' expression + | expression '=~' expression + | '\-' expression + | IDENTIFIER + | INTEGER + | QUOTED_FLOAT + | UNQUOTED_FLOAT + | STRING + +A STRING can be either a single quoted string or a double quoted string. +A FLOAT is a floating point number. +A QUOTED_FLOAT is a floating point number, either single ("'") or double (""") quoted. +An INTEGER shall be an unsigned integer number. +An IDENTIFIER shall be one of the valid fim commands (see +.B COMMANDS REFERENCE +) or a valid alias. +A VARIABLE shall be an already declared or undeclared variable identifier (see +.B VARIABLES REFERENCE +) or a valid alias, created using the +.B alias +command. +The "=~" operator treats the right expression as a STRING, and uses is as a regular expression for matching purposes. +The SLASH_AND_REGEXP is a slash ("/") followed by a STRING, interpreted as a regular expression. +See \fR\fIregex\fR(1) for regular expression syntax. + +The way some one\-line statements are evaluated: + +.nf +: enter command line mode +:{number} jump to {number}^th image in the list +:^ jump to first image in the list +:$ jump to last image in the list +:*{factor} scale the image by {factor} +:{scale}% scale the image to the desired {scale} +:+{scale}% scale the image up to the desired percentage {scale} (relatively to the original) +:\-{scale}% scale the image down to the desired percentage {scale} (relatively to the original) + +/{regexp} entering the pattern {regexp} (with /) makes fim jump to the next image whose filename matches {regexp} +/*.png$ entering this pattern (with /) makes fim jump to the next image whose filename ends with 'png' +/png a shortcut for /.*png.* + +!{syscmd} executes the {syscmd} quoted string as a "/bin/sh" shell command + + +.SH COMMANDS REFERENCE + +.na +.B +alias +.fi +alias [{identifier} [{commands} [{description}]]] +.fi + +.na +.B +align +.fi +align bottom : align to the lower side the current image; align top : align to the upper side the current image; +.fi + +.na +.B +autocmd +.fi +autocmd {event} {pattern} {commands} : manipulate auto commands +.fi + +.na +.B +autocmd_del +.fi +autocmd_del : manipulate auto commands. usage: autocmd_del {event} {pattern} {commands} +.fi + +.na +.B +basename +.fi +basename {filename} : returns the basename of {filename} +.fi + +.na +.B +bind +.fi +bind [{keysym} [{commands}]] : bind a keyboard symbol/shortcut {keysym} to {commands}; if {keysym} is at least two characters long and begins with 0 (zero), the integer number after the 0 will be treated as a raw keycode to bind the specified {keysym} to. activate the _verbose_keys variable to discover (display device dependent) raw keys.; binding is dynamical, so you can rebind keys even during program's execution +.fi + +.na +.B +cd +.fi +cd {path}: change the current directory to {path}. cd \- will change to the previous current directory (before the last ":cd {path}" command) +.fi + +.na +.B +clear +.fi +clear : clear the virtual console +.fi + +.na +.B +commands +.fi +commands : display the existing commands +.fi + +.na +.B +desaturate +.fi +desaturate : desaturate the displayed image colors. To get back the original you will have to reload the image. +.fi + +.na +.B +desc +.fi +desc 'load' {filename} [{sepchar}] : load description file {filename}, using the optional {sepchar} character as separator. See documentation of \-\-load\-image\-descriptions\-file for the format of {filename}. +.fi + +.na +.B +display +.fi +display ['reinit' {string}]|'resize' {w} {h}] : display the current file contents; if 'reinit' switch is supplied, the '{string}' specifier will be used to reinitialize (e.g.: change resolution, window system options) the display device; see documentation for the \-\-output\-device command line switch for allowed values of {string}; if 'resize' and no argument, will ask the window manager to size the window like the image; if 'resize' and two arguments, these will be used as width and height of window, to set. +.fi + +.na +.B +dump_key_codes +.fi +dump_key_codes : dump the active key codes (unescaped, for inspection) +.fi + +.na +.B +echo +.fi +echo {args}: print the {args} on console +.fi + +.na +.B +else +.fi +if(expression){action;}['else'{action;}] : see else +.fi + +.na +.B +eval +.fi +eval {args} : evaluate {args} as commands, executing them +.fi + +.na +.B +exec +.fi +exec {filename(s)} : execute script {filename(s)} +.fi + +.na +.B +getenv +.fi +getenv {identifier} : display the value of the {identifier} environment variable +.fi + +.na +.B +goto +.fi +goto {['+'|'\-']{number}['%']['f'|'p']} | {/{regexp}/} | {'+//'}: jump to an image; if {number} is given, and not surrounded by any specifier, will go to image at index {number} ; if followed by '%', the effective index will be computed as a percentage to the current available images; if prepended by '\-' or '+', the jump will be relative to the current index; the 'f' specifier asks for the jump to occur within the files; the 'p' specifier asks for the jump to occur in terms of pages, within the current file; if /{regexp}/ is given, will jump to the first image matching the given /{regexp}/ regular expression pattern; if given '+//', will jump to the first different image matching the last given regular expression pattern. Match will occur on both file name and description, eventually loaded via desc or \-\-load\-image\-descriptions\-file. +.fi + +.na +.B +help +.fi +help [{identifier}] : provide online help, assuming {identifier} is a variable, alias, or command identifier. If {identifier} begins with /, the search will be on the help contents and a list of matching items will be given instead. A list of commands can be obtained simply invoking "commands"; a list of aliases with "alias"; a list of bindings with "bind". +.fi + +.na +.B +if +.fi +if(expression){action;}['else'{action;}] : see if +.fi + +.na +.B +info +.fi +info : display information about the current file +.fi + +.na +.B +limit +.fi +limit [{expression} |{variable} {value}] : A browsable file list filtering function (like limiting in the 'mutt' program). Uses information loaded via \-\-load\-image\-descriptions\-file. If one argument only is provided, restrict to files whose description string matches {expression}. If two arguments are provided, restrict to files having property {variable} set to {value}. If invoked with one exclamation point ('!') as argument will restrict to the currently marked files only. Invoked with no arguments, the original browsable files list is restored. +.fi + +.na +.B +list +.fi +list : display the files list; list 'random_shuffle': randomly shuffle the file list; list 'reverse': reverse the file list; list 'clear': clear the file list; list 'sort': sort the file list; list 'sort_basename': sort the file list according to the file base name; list 'pop' : pop the last file from the files list; list 'remove' [{filename(s)}] : remove the current file, or the {filename(s)}, if specified ; list 'push' {filename(s)} : push {filename(s)} to the back of the files list; list 'filesnum': display the number of files in the files list; list 'mark' [{args}] : mark image file names for stdout printing at exit, with {args} mark the ones matching according to the rules of the 'limit' command, otherwise the current file; list 'unmark' [{args}] : unmark marked image file names, with {args} unmark the ones matching according to the rules of the 'limit' command, otherwise the current file; list 'marked': show which files have been marked so far; list 'pushdir'; {dirname}: will push all the files in {dirname}, when matching the regular expression in variable _pushdir_re or, if empty, from constant regular expression \.JPG$\:|\.PNG$\:|\.GIF$\:|\.BMP$\:|\.TIFF$\:|\.TIF$\:|\.JPEG$\:|\.JFIF$\:|\.PPM$\:|\.PGM$\:|\.PBM$\:|\.PCX$\:; list 'pushdirr' {dirname}: like pushdir, but will also push encountered directory entries recursively. +.fi + +.na +.B +load +.fi +load : load the image, if not yet loaded (see also reload) +.fi + +.na +.B +negate +.fi +negate : negate the displayed image colors. +.fi + +.na +.B +pan +.fi +pan {'down'|'up'|'left'|'right'|'ne'|'nw'|'se'|'sw'} [{steps}['%']] pan the image {steps} pixels in the desired direction; if the '%' specifier is present, {steps} will be treated as a percentage of current screen dimensions; if {steps} is not specified, the "_steps" variable will be used; if present, the "_hsteps" variable will be considered for horizontal panning; if present, the "_vsteps" variable will be considered for vertical panning; the variables may be terminated by the '%' specifier +.fi + +.na +.B +popen +.fi +popen {syscmd} : pipe a command, invoking popen(): spawns a shell, invoking {syscmd} and executing as fim commands the output of {syscmd} +.fi + +.na +.B +pread +.fi +pread {args} : execute {args} as a shell command and read the output as an image file (using popen) +.fi + +.na +.B +prefetch +.fi +prefetch : prefetch (read into the cache) the two nearby image files (next and previous), for a faster subsequent opening. See also the _want_prefetch variable. +.fi + +.na +.B +pwd +.fi +pwd : print the current directory name, and updates the _pwd variable +.fi + +.na +.B +quit +.fi +quit [{number}] : terminate the program; if {number} is specified, use it as the program return status +.fi + +.na +.B +recording +.fi +recording 'start' : start recording the executed commands; recording 'stop' : stop recording the executed commands; recording 'dump' : dump in the console the record buffer; recording 'execute' : execute the record buffer; recording 'repeat_last' : repeat the last performed action; +.fi + +.na +.B +redisplay +.fi +redisplay : re\-display the current file contents +.fi + +.na +.B +reload +.fi +reload [{arg}] : load the image into memory; if {arg} is present, will force reloading, bypassing the cache (see also load) +.fi + +.na +.B +rotate +.fi +rotate {number}: rotate the image the specified amount of degrees [undocumented] +.fi + +.na +.B +scale +.fi +scale {['+'|'\-']{value}['%']|'*'{value}|'w'|'h'|'a'|'b'|'+[+\-*/]'} : scale the image according to a scale {value} (e.g.: 0.5,40%,'w','h','a','b'); if given '*' and a value, will multiply the current scale by that value; if given 'w', will scale according to the screen width; if given 'h', scale to the screen height; if given 'a', to the minimum of 'w' and 'h'; if given 'b', like 'a', provided that the image width exceeds 'w' or 'h'; if {value} is a number, will scale relatively to the original image width; if the number is followed by '%', the relative scale will be treated on a percent scale; if given '++'('+\-'), will increment (decrement) the "_magnify_factor", "_reduce_factor" variables by "_scale_factor_delta"; if given '+*'('+/'), will multiply (divide) the "_magnify_factor", "_reduce_factor" variables by "_scale_factor_multiplier"; +.fi + +.na +.B +scrolldown +.fi +scrolldown : scroll down the image, going next if at bottom +.fi + +.na +.B +scrollforward +.fi +scrollforward : scroll the image as it were reading it +.fi + +.na +.B +set +.fi +set: returns a list of variables which are set; set {identifier}: returns the value of variable {identifier}; set {identifier} {commands}: sets variable {identifier} to value {commands}; +.fi + +.na +.B +set_commandline_mode +.fi +set_commandline_mode : set console mode +.fi + +.na +.B +set_interactive_mode +.fi +set_interactive_mode : set interactive mode +.fi + +.na +.B +sleep +.fi +sleep [{number}=1] : sleep for the specified (default 1) number of seconds +.fi + +.na +.B +status +.fi +status : set the status line to the collation of the given arguments +.fi + +.na +.B +stdout +.fi +stdout {args} : writes to stdout its arguments {args} +.fi + +.na +.B +system +.fi +system {syscmd}: get the output of the shell command {syscmd}. (uses popen()) +.fi + +.na +.B +variables +.fi +variables : display the existing variables +.fi + +.na +.B +unalias +.fi +unalias {identifier} | '\-a' : delete the alias {identifier} or all aliases (use '\-a', not \-a) +.fi + +.na +.B +unbind +.fi +unbind {keysym} : unbind the action associated to a specified {keysym}; if {keysym} is at least two characters long and begins with 0 (zero), the integer number after the 0 will be treated as a raw keycode to bind the specified {keysym} to. activate the _verbose_keys variable to discover (display device dependent) raw keys. +.fi + +.na +.B +while +.fi +while(expression){action;} A conditional cycle construct. May be interrupted by hitting the Esc or the : key +.fi + +.na +.B +window +.fi +window {args} : this command is disabled. It shall be re\-enabled in a future version. +.fi + +.SH AUTOCOMMANDS REFERENCE +Available autocommands are: PostScale, PreScale, PrePan, PostPan, PreRedisplay, PostRedisplay, PreDisplay, PostDisplay, PrePrefetch, PostPrefetch, PostReload, PreReload, PostLoad, PreLoad, PostGoto, PreGoto, PreConfigLoading, PostConfigLoading, PreHardcodedConfigLoading, PostHardcodedConfigLoading, PreUserConfigLoading, PostUserConfigLoading, PreGlobalConfigLoading, PostGlobalConfigLoading, PreInteractiveCommand, PostInteractiveCommand, PreExecutionCycle, PreExecutionCycleArgs, PostExecutionCycle, PreWindow, PostWindow, and they are triggered on actions as indicated by their name. +.SH VARIABLES REFERENCE +If undeclared, a variable will evaluate to 0. + +The namespaces in which variables may exist are: current image, global. A namespace is specified by a prefix, which is one of: 'i:', which shall be prepended to the variable name. The global namespace is equivalent to the empty one:''. The special variable i:* expands to the collation of all the name\-value pairs for the current image. + +In the following, the [internal] variables are the ones referenced in the source code (not including the hardcoded configuration, which may be inspected and/or invalidated by the user at runtime). + +.na +.B +_TERM +[out,g:] the environment TERM variable +.fi +.na +.B +__exif_flipped +[out,i:] flipping information, read from the EXIF tags of a given image. +.fi +.na +.B +__exif_mirrored +[out,i:] mirroring information, read from the EXIF tags of a given image. +.fi +.na +.B +__exif_orientation +[out,i:] orientation information in the same format of _orientation, read from the orientation EXIF tags (i:EXIF_Orientation). +.fi +.na +.B +_archive_files +[in,g:] Regular expression matching filenames to be treated as (multipage) archives. If empty, ".*(RAR|ZIP|TAR|TAR.GZ|TGZ|TAR.BZ2|TBZ|TBZ2|CBR|CBZ|LHA|7Z|XAR|ISO)$\:" will be used. Within each archive, only filenames matching the regular expression in the _pushdir_re variable will be considered for opening. +.fi +.na +.B +_autocmd_trace_stack +[in,g:] dump to stdout autocommands (autocmd) stack trace during their execution (for debugging purposes) +.fi +.na +.B +_autodesaturate +[in,g:] if 1, will desaturate images by default +.fi +.na +.B +_autoflip +[in,g:] if 1, will flip images by default +.fi +.na +.B +_automirror +[in,g:] if 1, will mirror images by default +.fi +.na +.B +_autonegate +[in,g:] if 1, will negate images by default +.fi +.na +.B +_autotop +[in,g:] if 1, will align to the top freshly loaded images +.fi +.na +.B +_cache_status +[out,g:] string with current information on cache status +.fi +.na +.B +_cached_images +[out,g:] the number of images currently cached. +.fi +.na +.B +_caption_over_image +[experimental,in,g:] if _caption_over_image is set not to 0, will display the contents of i:_comment as a caption over the image; if larger than 1, with black background. +.fi +.na +.B +_command_expansion +[in,g:] if 1, will enable autocompletion (on execution) of alias and command strings +.fi +.na +.B +_comment +[i:,out] the image comment, extracted from the image file (if any) +.fi +.na +.B +_console_buffer_free +[out,g:] amount of unused memory in the output console buffer +.fi +.na +.B +_console_buffer_total +[out,g:] amount of memory allocated for the output console buffer +.fi +.na +.B +_console_buffer_used +[out,g:] amount of used memory in the output console buffer +.fi +.na +.B +_console_key +[in,g:] the key binding (an integer variable) for spawning the command line; will have precedence over any other binding +.fi +.na +.B +_console_lines +[out,g:] the number of buffered output console text lines +.fi +.na +.B +_console_offset +[in,out,g:] position of the text beginning in the output console, expressed in lines +.fi +.na +.B +_debug_commands +[in,g:] print out each command before its execution (for debugging purposes) +.fi +.na +.B +_device_string +[out,g:] the current display device string +.fi +.na +.B +_display_as_binary +[in,g:] will force loading of the specified files as pixelmaps (no image decoding will be performed); if 1, using one bit per pixel; if 24, using 24 bits per pixel; otherwise will load and decode the files as usual +.fi +.na +.B +_display_as_rendered_text +[in,g:] will force loading of the specified files as text files (no image decoding will be performed); if 1; otherwise will load and decode the files as usual +.fi +.na +.B +_display_busy +[in,g:] if 1, will display a message on the status bar when processing +.fi +.na +.B +_display_console +[in,g:] if 1, will display the output console +.fi +.na +.B +_display_status +[in,g:] if 1, will display the status bar +.fi +.na +.B +_display_status_bar +[in,g:] if 1, will display the status bar +.fi +.na +.B +_display_status_fmt +[in,g:] custom info format string, displayed in the lower left corner of the status bar; if unset: full pathname; otherwise a custom format string specified just as _info_fmt_str. +.fi +.na +.B +_do_sanity_check +[in,experimental,g:] if 1, will execute a sanity check on startup +.fi +.na +.B +_exiftool_comment +[out,g:] comment extracted via the exiftool interface; see _use_exiftool. +.fi +.na +.B +_fbfont +[out,g:] The current console font file string. If the internal hardcoded font has been used, then its value is "fim://". +.fi +.na +.B +_file_loader +[in,i:,g:] if not empty, this string will force a file loader (among the ones listed in the \-V switch output); [out] i:_file_loader stores the loader of the current image +.fi +.na +.B +_fileindex +[out,g:] the current image numeric index +.fi +.na +.B +_filelistlen +[out,g:] the length of the current image list +.fi +.na +.B +_filename +[out,i:] the current file name string +.fi +.na +.B +_fim_bpp +[out,g:] the bits per pixel count +.fi +.na +.B +_fim_default_config_file_contents +[out,g:] the contents of the default (hardcoded) configuration file (executed after the minimal hardcoded config) +.fi +.na +.B +_fim_default_grammar_file_contents +[out,g:] the contents of the default (hardcoded) grammar file +.fi +.na +.B +_fim_scriptout_file +[in,g:] the name of the file to write to when recording sessions +.fi +.na +.B +_fim_version +[out,g:] fim version number; may be used for keeping compatibility of fim scripts across evolving versions. +.fi +.na +.B +_hsteps +[in,g:] the default steps, in pixels, when panning images horizontally (overrides steps) +.fi +.na +.B +_ignorecase +[in,g:] if 1, will allow for case insensitive regexp\-based match in autocommands (autocmd); +.fi +.na +.B +_info_fmt_str +[in,g:] custom info format string, displayed in the lower right corner of the status bar; may contain ordinary text and special 'expando' sequences. These are: %p for current scale, in percentage; %w for width; %h for height; %i for image index in list; %k for the value of i:_comment (comment description) variable in square brackets; %l for image list length; %L for flip/mirror/orientation information; %P for page information; %F for file size; %M for screen image memory size; %m for memory used by mipmap; %C for memory used by cache; %T for total memory used (approximation); %R for total max memory used (as detected by getrusage()); %n for the current file path name; %N for the current file path name basename; ; %c for centering information; %v for the fim program/version identifier string; %% for an ordinary %. A sequence like %?VAR?EXP? expands to EXP if i:VAR is set; EXP will be copied verbatim except for contained sequences of the form %:VAR:, which will be expanded to the value of variable i:VAR; this is meant to be used like in e.g. '%?EXIF_DateTimeOriginal?[%:EXIF_DateTimeOriginal:]?', where the EXIF\-set variable EXIF_DateTimeOriginal (make sure you have libexif for this) will be used only if present. +.fi +.na +.B +_inhibit_display +[internal,g:] if 1, will inhibit display +.fi +.na +.B +_last_file_loader +[out,g:] after each image load, _last_file_loader will be set to the last file loader used +.fi +.na +.B +_last_system_output +[out,experimental,g:] the standard output of the last call to the system command +.fi +.na +.B +_lastfileindex +[out,g:] the last visited image numeric index. Useful for jumping back and forth easily between two images with 'goto _lastfileindex'. +.fi +.na +.B +_load_default_etc_fimrc +[in,g:] if 1 at startup, will load the system wide initialization file +.fi +.na +.B +_load_fim_history +[in,g:] if 1 on startup, will load the ~/.fim_history file on startup +.fi +.na +.B +_lwidth +[in,g:] if>0, will force the output console text width +.fi +.na +.B +_magnify_factor +[in,g:] the image scale multiplier used when magnifying images size +.fi +.na +.B +_max_cached_images +[in,experimental,g:] the maximum number of images after which evictions will be forced. Setting this to 0 (no limits) is ok provided _max_cached_memory is set meaningfully. +.fi +.na +.B +_max_cached_memory +[in,experimental,g:] the maximum amount of memory (in KiB) at which images will be continued being added to the cache. Setting this to 0 (no limit) will lead to a crash (there is no protection currently). +.fi +.na +.B +_max_iterated_commands +[experimental,g:] the iteration limit for N in "N[commandname]" iterated command invocations +.fi +.na +.B +_no_default_configuration +[in,g:] if 0, a default, hardcoded configuration will be executed at startup, after the minimal hardcoded one. +.fi +.na +.B +_no_external_loader_programs +[in,g:] if 1, no external loading programs will be tried for piping in an unsupported type image file +.fi +.na +.B +_no_rc_file +[in,g:] if 1, the ~/.fimrc file will not be loaded at startup +.fi +.na +.B +_open_offset +[in,optional,g:,i:] offset (specified in bytes) used when opening a file; [out] i:_open_offset will be assigned to images opened at a nonzero offset +.fi +.na +.B +_open_offset_retry +[in,optional,g:] number of adjacent bytes to probe in opening the file +.fi +.na +.B +_orientation +[internal,i:] Orthogonal clockwise rotation (orientation) is controlled by: 'i:_orientation', 'g:_orientation' and applied on a per\-image basis. In particular, the values of the three variables are summed up and the sum is interpreted as the image orientation. If the sum is 0, no rotation will apply; if it is 1, a single ( 90') rotation will apply; if it is 2, a double (180') rotation will apply; if it is 3, a triple (270') rotation will apply. If the sum is not one of 0,1,2,3, the value of the sum modulo 4 is considered. Therefore, ":i:_orientation=1" and ":i:_orientation=5" are equivalent: they rotate the image one time by 90'. +.fi +.na +.B +_preferred_rendering_dpi +[in,optional,g:] if >0, pdf, ps, djvu rendering will use this value for a default document dpi (instead of a default value) +.fi +.na +.B +_preferred_rendering_width +[in,optional,g:] if >0, bit based rendering will use this value for a default document width (instead of a default value) +.fi +.na +.B +_push_checks +[in,experimental,g:] if 1 (default), will check with stat() existence of input files before push'ing them (set this to 0 to speed up loading very long file lists; in these cases a trailing slash (/) will have to be used to tell fim a pathname is a directory). This only works after initialization (thus, after command line files have been push'ed); use \-\-no\-stat\-push if you wish to set this to 0 at command line files specification +.fi +.na +.B +_push_pushes_dirs +[in,g:] if 1, the push command will also accept and push directories (using pushdir) +.fi +.na +.B +_pushdir_re +[in] regular expression to match against when pushing files from a directory or an archive. By default this is "\.JPG$\:|\.PNG$\:|\.GIF$\:|\.BMP$\:|\.TIFF$\:|\.TIF$\:|\.JPEG$\:|\.JFIF$\:|\.PPM$\:|\.PGM$\:|\.PBM$\:|\.PCX$\:". +.fi +.na +.B +_pwd +[out,g:] the current working directory; will be updated at startup and whenever the working directory changes +.fi +.na +.B +_re_search_opts +[in,g:] affects regexp\-based searches; if an empty string, defaults will apply; if contains 'i' ('I'), case insensitive (sensitive) searches will occur; if contains 'b', will match on basename, if contains 'f' on full pathname. +.fi +.na +.B +_reduce_factor +[in,g:] the image scale multiplier used when reducing images size +.fi +.na +.B +_retry_loader_probe +[in,g:] if 1 and user specified a file loader and this fails, will probe for a different loader +.fi +.na +.B +_rows +[in,g:] if >0, will set the number of displayed text lines in the console +.fi +.na +.B +_save_fim_history +[in,g:] if 1 on exit, will save the ~/.fim_history file on exit +.fi +.na +.B +_scale_factor_delta +[in,g:] value used for incrementing/decrementing the scaling factors +.fi +.na +.B +_scale_factor_multiplier +[in,g:] value used for scaling up/down the scaling factors +.fi +.na +.B +_scale_style +[in,g:] if non empty, this string will be fed to the scale command +.fi +.na +.B +_screen_height +[out] the screen height +.fi +.na +.B +_screen_width +[out,g:] the screen width +.fi +.na +.B +_seek_magic +[optional,g:] will seek for a magic signature before opening a file (for now, use like this: fim \-C '_seek_magic=MAGIC_STRING;push filename' ) +.fi +.na +.B +_status_line +[in,g:] if 1, will display the status bar +.fi +.na +.B +_steps +[in,g:] the default steps, in pixels, when panning images +.fi +.na +.B +_sys_rc_file +[in,g:] string with the global configuration file name +.fi +.na +.B +_use_exiftool +[in,g:] if >0 and supported, exiftool will be used to get additional information. if 1, this will be appened to _comment; if 2, will go to _exiftool_comment +.fi +.na +.B +_use_mipmaps +[in,g:] if >0, will use mipmaps to speed up downscaling of images (this has a memory overhead equivalent to one image copy); mipmaps will not be cached. +.fi +.na +.B +_verbose_errors +[in,g:] if 1, will display on stdout internal errors, while parsing commands +.fi +.na +.B +_verbose_keys +[in,g:] if 1, after each interactive mode key hit, the console will display the hit key raw keycode +.fi +.na +.B +_verbosity +[in,experimental,g:] program verbosity +.fi +.na +.B +_vsteps +[in,g:] the default steps, in pixels, when panning images vertically (overrides steps) +.fi +.na +.B +_want_autocenter +[in,g:] if 1, the image will be displayed centered +.fi +.na +.B +_want_exif_orientation +[in,g:] if 1, will reorient images using information from EXIF metadata (and stored in in __exif_orientation, __exif_mirrored, __exif_flipped ). +.fi +.na +.B +_want_prefetch +[in,g:] if 1, will prefetch further files just after display of the first file +.fi +.na +.B +_want_sleep_seconds +[in,g:] number of seconds of sleep during slideshow mode +.fi +.na +.B +_want_wm_caption_status +[in,g:] this works only if supported by the display device (currently only SDL). if set to a number that is not 0, will show the status (or command) line in the window manager caption; if set to a non\-empty string, will interpret it just as a file info format string (see _info_fmt_str); if empty, will show the program version. +.fi +.na +.B +angle +[in,out,i:] a floating point number specifying the rotation angle, in degrees +.fi +.na +.B +ascale +[in,out,i:] the asymmetric scaling of the current image +.fi +.na +.B +desaturated +[out,i:] 1, if the image is desaturated +.fi +.na +.B +flipped +[out,i:] 1, if the image is flipped +.fi +.na +.B +fresh +[in,out,i:,experimental] 1 if the image was loaded, before all autocommands (autocmd) execution +.fi +.na +.B +height +[out,i:] the current image original height +.fi +.na +.B +mirrored +[out,i:] 1, if the image is mirrored +.fi +.na +.B +negated +[out,i:] 1, if the image is negated +.fi +.na +.B +page +[out,experimental,g:] the current page +.fi +.na +.B +pages +[out,experimental,i:] the current number of pages of an image +.fi +.na +.B +random +[out] a pseudorandom number +.fi +.na +.B +scale +[in,i:] the scale of the current image +.fi +.na +.B +sheight +[out,i:] the current image scaled height +.fi +.na +.B +swidth +[out,i:] the current image scaled width +.fi +.na +.B +width +[out,i:] the current image original width +.fi +.SH COMMAND LINE USAGE EXAMPLES +.nf +# jump to the third image: +3; +# jump to first image: +^; +# jump to last image: +$; +# magnify the image two times: +*2; +# scale the image to the 30% of the original: +30%; +# scale the image up by 30%: ++30%; +# scale the image down by 30%: +\-30%; +# jump to the next image whose filename matches the ".*jpg" regular expression: +/.*jpg; +# executes the "date" system command +!"date"; + +.SH CONFIGURATION FILE EXAMPLES +This is the default configuration, as contained in the _fim_default_config_file_contents variable. + +.nf +# $LastChangedDate: 2016\-02\-04 19:53:36 +0100 (Thu, 04 Feb 2016) $ +# Contents of the default 'fimrc' file, hardcoded in the fim executable. +# Read the documentation (man fimrc) to discover how to change this default hardcoded file and how to make your own. +# Note that usually a ~/.fimrc file is read after these options take effect, so you could reset all of this with ease. +# Lines beginning with a pound (#) are ignored by fim (they are treated as comments). +# +# Internal variables. +# Some of these variables influence Fim's behaviour (input variables), some are set by Fim (output variables). +# It is wise the input variables are set at the beginning of the file, so the bottom may issue commands correctly affected by them. +if(_debug_commands==''){_debug_commands=0;} +if(_command_expansion==''){_command_expansion=1;} +if(_display_status==''){_display_status=0;} +if(_max_cached_images==''){_max_cached_images=5;} +if(_max_cached_memory==''){_max_cached_memory=81920;} +if(_max_iterated_commands==''){_max_iterated_commands=100;} +if(_want_prefetch==''){_want_prefetch=1;} +if(_no_external_loader_programs==''){_no_external_loader_programs=0;} +if(_scale_style==''){_scale_style='b';} +if(_save_fim_history==''){_save_fim_history=1;} +if(_load_fim_history==''){_load_fim_history=1;} +if(_verbose_keys==''){_verbose_keys=0;} +if(_display_busy==''){_display_busy=1;} +if(_ignorecase==''){_ignorecase=1;} +if(_re_search_opts==''){_re_search_opts='bi';} +if(_console_offset==''){_console_offset=0;} +if(_console_key==''){_console_key=58;} +if(_display_as_binary==''){_display_as_binary=0;} +if(_push_checks==''){_push_checks=1;} +#if(_want_wm_caption_status==''){_want_wm_caption_status=0;} +if(_want_exif_orientation==''){_want_exif_orientation=1;} +if(ascale==''){ascale="1.0";} +if(_use_mipmaps==''){_use_mipmaps=1;} +# +# External variables (not used internally). +if(allow_round_scroll==''){allow_round_scroll=0;} +if(console_scroll_n==''){console_scroll_n=3;} +# +alias "toggleautoflip" "_autoflip=1\-_autoflip;" ""; +alias "toggleautonegate" "_autonegate=1\-_autonegate;" ""; +alias "toggleflip" "i:flipped=1\-i:flipped;" ""; +alias "flip" "toggleflip;redisplay;" "flip the current image along the horizontal axis"; +alias "fliponce" "flip;toggleflip;" ""; +alias "toggleautomirror" "_automirror=1\-_automirror;" ""; +alias "togglemirror" "i:mirrored=1\-i:mirrored;" ""; +alias "mirror" "togglemirror;redisplay;" "mirror the image along the vertical axis" ""; +alias "mirroronce" "mirror;togglemirror;" ""; +alias 'toggleLimitMarked' '__pre_limit_fileindex=_fileindex;_limit_mode=1\-_limit_mode; if(_limit_mode==1){limit "!";} else { limit; } if(_filelistlen<1){_limit_mode=0;limit;goto __pre_limit_fileindex;} i:fresh=1;redisplay; ' "toggle between limiting file list to the marked files and the full list"; +# Warning : binding to C\-s, C\-z and C\-c won't make effect, as these +# codes are get caught by the console driver and will have no effect in fim. +# Moreover, C\-z will crash fim and C\-c will terminate it. +# Some other combinations (e.g.:C\-l) may have similar problems in your console. +bind 'f' "flip;"; +bind 'F' "fliponce;"; +bind 'm' "mirror;"; +bind 'M' "mirroronce;"; +bind 'q' "quit"; +bind 'Esc' "quit"; +#bind 'n' "next_file;"; +#bind 'n' "next;"; +bind 'C\-h' "help"; +#bind '?' "help"; # assigned to back\-search +#bind '/' "help"; # assigned to forward\-search +bind '=' "scale '100%'"; +#bind 'p' "prev_file;"; +bind 'Del' "list 'pop';reload;"; +#bind 's' "list 'sort'"; +bind 's' "scrollforward"; +bind 'C\-s' "swap;redisplay;"; +bind 'S' "toggleDisplayStatus"; +bind 'I' "toggleautonegate"; +bind 'i' "negate;redisplay;"; +bind 'g' "desaturate;redisplay;"; +bind 'G' "toggleDesaturate;"; +#bind 'R' "reload"; +#bind 'R' "redisplay"; +bind 'r' "rotate90;"; +bind 'R' "rotate270;"; +#bind 'R' "rotate10;display;"; +#bind 'r' "rotate10_ccw;display;"; +#bind 'r' "reload;"; +#bind 'C\-d' "display"; +bind '+' "magnify"; +#bind 'C\-+' "angle=angle+10.0;display;"; +bind 'a' "scale 'a';"; +bind 'H' "scale 'H';"; +bind 'Tab' "toggleVerbosity"; +bind 'Menu' "toggleVerbosity"; +#bind 'C\-k' "_want_wm_caption_status=1\-_want_wm_caption_status;status ' '"; +bind 'v' "toggleDisplayStatus"; +bind 'A' "A"; +bind 'C\-m' "list 'mark'"; +bind 'u' "list 'unmark'"; +bind 'Enter' "list 'mark';next"; +bind '\-' "reduce"; +bind "Up" "pan_up"; +bind 'k' "pan_up"; +#bind 'C\-k' "pan_up"; +bind "Right" "pan_right"; +bind 'l' "pan_right"; +bind "Down" "pan_down"; +bind 'j' "pan_down"; +bind "Left" "pan_left"; +bind 'h' "pan_left"; +bind ' ' "scrolldown"; +bind 't' "align 'top';"; +bind 'C\-g' "system 'fbgrab fim.png'"; +bind 'C\-r' "recording 'start';"; +bind 'Q' "recording 'stop'"; +bind 'D' "recording 'dump';"; +bind 'E' "recording 'execute';"; +bind 'C\-e' "recording 'execute';"; +bind 'C\-x' "recording 'execute';"; +bind '.' "recording 'repeat_last';"; +bind '`' "toggleLimitMarked;"; +alias "toggleVerbosity" "_display_console=1\-_display_console;i:fresh=1;redisplay;" ""; +alias "toggleKeyVerbosity" "_verbose_keys=1\-_verbose_keys;redisplay;" ""; +alias "toggleDesaturate" "_autodesaturate=1\-_autodesaturate;redisplay;" ""; +alias "idempotent_cmd" "goto '+0p';"; +# +# autocommands are essential to Fim's automated behaviour +# examples: +#autocmd "PostInteractiveCommand" "fim.png" "echo '\\nmatched an interactive command on fim.png\\n';"; +#autocmd "PostDisplay" ".*png" "echo 'this is a png file';"; +#autocmd "PostDisplay" ".*jpg" "echo 'this is a jpg file';"; +#autocmd "PostDisplay" ".*gif" "echo 'this is a gif file';"; +#autocmd "PostDisplay" "" "echo '\\nthis is a file\\n'"; +#autocmd "PostGoto" "" "set_interactive_mode;"; +autocmd "PostGoto" "" "reload;"; +#autocmd "PostGoto" "" "load;"; +#autocmd "PostDisplay" "" "i:fresh=1" ; +#autocmd "PreWindow" "" ""; +autocmd "PostWindow" "" "display;"; +autocmd "PreRedisplay" "" "i:_will_display=1;"; +autocmd "PreRedisplay" "" "if(_scale_style!='' && i:fresh){i:fresh=0;scale _scale_style ;i:fresh=0;}"; +autocmd "PostRedisplay" "" "i:_will_display=0;"; +# Display device specific config +alias "aalib_fix_do" "{if(aascale==''){ascale='2.0';}else{ascale=aascale;} i:fresh=1;display;if(_TERM=~'screen'){echo 'screen+aalib?expect binding problems!'}}" "See aalib_fix."; +alias "aalib_fix" "if(_device_string=='aa'){aalib_fix_do;scale 'a';}" "When using the aalib (ASCII art) library we face a problem: glyph proportions are seldom square (as pixels are), and are tricky to detect; for this reason, we need to reshape the image with respect to the font ratio, but we have to make a guess in the scaling factor to compensate. If at runtime a better value is known for the terminal font height/with ratio, it may be fed in the 'aascale' variable for an accurate scaling."; +#alias "exif_fix" "i:_orientation=exif_orientation;exif_orientation='';i:mirrored=exif_mirrored;exif_mirrored='';i:flipped=exif_flipped;exif_flipped='';" ""; +#autocmd "PostReload" "" "aalib_fix;exif_fix;"; +#autocmd "PostLoad" "" "aalib_fix;exif_fix;"; +autocmd "PostReload" "" "aalib_fix;"; +autocmd "PostLoad" "" "aalib_fix;"; +bind "F11" "if(_device_string=='sdl' && !_fullscreen){_old_sw=_screen_width;_old_sh=_screen_height;display 'reinit' 'MW0:0';_fullscreen=1;}else if(_device_string=='sdl' && _old_sw*_old_sh*_fullscreen){display 'reinit' 'rwm'._old_sw.':'._old_sh;_fullscreen=0;}"; + +autocmd "PostReload" "" "i:fresh=1" ; +autocmd "PostScale" "" "if(0==i:_will_display){i:fresh=1;display;}" ; +#autocmd "PostScale" "" "{i:fresh=1;display;}" ; +autocmd "PostPan" "" "{i:fresh=1;display;}" ; +autocmd "PostReload" "" "if(i:fresh){redisplay;}"; +autocmd "PostInteractiveCommand" "" "if(i:fresh){display;i:fresh=0;}"; +autocmd "PostInteractiveCommand" "" "if(_want_prefetch){prefetch;}"; +autocmd "PostInteractiveCommand" "" "if(_display_console==0 && i:fresh){redisplay;i:fresh=0;}"; +autocmd "PostInteractiveCommand" "" "idempotent_cmd;"; # Bug workaround: without it console scroll is broken. + +alias "next10" "i=0;while(i<10){i=i+1;next;display;sleep '1';};" "goes forward 10 images"; +bind 'N' 'next10'; +bind 'P' 'prev10'; +bind 'C\-n' "goto '+//'"; +bind 'C\-p' "goto '\-//'"; +bind 'C\-b' "goto '\-//'"; # Warning: C\-b cannot be detected on many configurations. +bind 'W' "display 'resize';" "if supported, resizes the window to match the current image pixels size"; +bind 'C\-w' "scale '100%';display 'resize';" "if supported, scales the image to 100% and resizes the window to match its size (if fits)"; +alias "endless_slideshow" "while(1){display;sleep '1';next;};" "performs an automated slideshow, endlessly"; +alias "bookview" "while(1){display;sleep '2';scrolldown;};" ""; +alias "comicview" "while(1){display;sleep '1';scrolldown;};" ""; +alias "read" "while(1){display;sleep '1';scrollforward;};" ""; +alias "slowread" "while(1){display;sleep '2';scrollforward;};" ""; +alias "fastread" "while(1){display;scrollforward;};" ""; +alias "pornview" "echo 'press any key repeatedly to terminate' ;endless_slideshow;" ""; +#bind "C\-p" "pornview"; +#bind "C\-b" "bookview"; +autocmd "PreExecutionCycle" "/fbps\-" "_display_busy=0;_display_status=0;" ; +autocmd "PreExecutionCycle" "" "i:fresh=1;reload;"; +#autocmd "PreExecutionCycle" "" "redisplay;"; +autocmd "PreExecutionCycle" "/fbps\-.*ps001.png" "i:fresh=1;redisplay;"; +#autocmd "PostInteractiveCommand" "" "i:fresh=0;"; +#autocmd "PostInteractiveCommand" "" "prefetch;"; +bind '*' "scale '100%'"; +bind 'w' "scale 'w'"; +bind '<' "rotate10_ccw;display;"; +bind '>' "rotate10;display;"; +bind '_' "_scale_style='';scale '100%';"; +bind ',' "_display_console=1;echo _last_system_output;"; +bind 'C\-a' "if(_scale_style!='a'){_scale_style='a';scale 'a';}else{_scale_style='';scale '100%';}"; +#bind 'h' "scale 'h'"; +# +alias "pan_nw" "pan 'nw';" "pans the image to the upper left"; +alias "pan_ne" "pan 'ne';" "pans the image to the upper right"; +alias "pan_se" "pan 'se';" "pans the image to the lower left"; +alias "pan_sw" "pan 'sw';" "pans the image to the lower right"; +alias "pan_down" "pan 'down';" "pans the image down"; +alias "pan_up" "pan 'up';" "pans the image up"; +alias "pan_left" "pan 'left';" "pans the image left"; +alias "pan_right" "pan 'right';" "pans the image right"; +# +alias "diagonal_nw" "pan_nw;" "pans the image to the upper left"; +alias "diagonal_ne" "pan_ne;" "pans the image to the upper right"; +alias "diagonal_se" "pan_se;" "pans the image to the lower left"; +alias "diagonal_sw" "pan_sw;" "pans the image to the lower right"; +bind 'd' "diagonal_nw;"; +bind 'D' "diagonal_se;"; +bind 'x' "diagonal_ne;"; +bind 'X' "diagonal_sw;"; +alias "toggleDisplayStatus" "_display_status=1\-_display_status;" ""; +alias "toggleDisplayBusy" "_display_busy=1\-_display_busy;" ""; +alias "sort" "list 'sort'" "sorts the files list ordered"; +#toggleVerbosity; +#bind 'f' "next;display;"; +#bind 'b' "prev;display;"; +bind 'o' "sort"; +bind 'b' "prev;"; +bind 'B' "toggleDisplayBusy"; +alias "random_slideshow" "while(1){goto random;}" "performs a shuffled slideshow"; +alias "rotate90_ccw" "i:_orientation=i:_orientation+3;i:fresh=1;i:fresh=1;redisplay;" ""; +alias "rotate90_cw" "i:_orientation=i:_orientation+1;i:fresh=1;i:fresh=1;redisplay;" ""; +alias "rotate180" "i:_orientation=i:_orientation+2;i:fresh=1;i:fresh=1;redisplay;" ""; +alias "rotate90" "rotate90_cw;display;" ""; +alias "rotate270" "rotate90_ccw;display;" ""; +alias "rotate10" "rotate '10';display;" ""; +alias "rotate10_ccw" "rotate \-10;display;" ""; + +# window related aliases and commands +alias "wu" "window 'up'" "selects the window upwards the current"; +alias "wd" "window 'down'" "selects the window under the current"; +alias "wl" "window 'left'" "selects the window at left of the current"; +alias "wr" "window 'right'" "selects the window at right of the current"; +#bind 'K' "wu"; +bind 'K' 'if(_display_console==0){echo i:_filename.": ".i:_comment;toggleVerbosity}else{toggleVerbosity;}'; +# Note : on many consoles C\-j is by default equivalent to Enter.. so this may not work :) +#bind 'C\-j' "wd"; +#bind 'J' "wd"; +#bind 'H' "wl"; +#bind 'L' "wr"; +#alias "split" "window 'split'" "split the current window horizontally"; +#alias "vsplit" "window 'vsplit'" "split the current window vertically"; +#alias "swap" "window 'swap'" "swap the enclosing window subwindows"; +#alias "ws " "window 'swap'" "see swap"; +#bind 'T' "split;redisplay;"; +##don't use C\-s : it will be usually caught by the console driver, and fim won't get it! +##bind 'C\-s' "split;"; +#bind 'V' "vsplit;redisplay;"; +#bind 'U' "swap;redisplay;"; +#alias 'venlarge' 'window "venlarge"' ""; +#alias 'henlarge' 'window "henlarge"' ""; +#alias 'wnormalize' 'window "normalize"' ""; +#alias 'wclose' 'window "close"' ""; +#alias 'wc' 'window "close"' "closes the current window"; +#bind 'C' "wc;redisplay;"; + +alias 'cache' 'echo _cache_status;' "displays cached images status"; +#bind 'c' 'cache;'; +bind 'c' 'align "center";'; +alias 'widen' 'i:ascale=i:ascale*"1.1";*1.0;' "widen the current image"; +alias 'narrow' 'i:ascale=i:ascale/"1.1";*1.0;' "narrow the current image"; +alias 'contract' 'narrow'; +bind 'y' "widen" "widens horizontally the image"; +bind 'Y' "narrow" "shrinks horizontally the image"; +#alias 'scu' 'scroll_console_up;' ""; +#alias 'scd' 'scroll_console_down;' ""; +#alias 'console_scroll_up' 'if(_console_offset<_console_lines){_console_offset=_console_offset+1;}'; +#alias 'console_scroll_down' 'if(_console_offset>0){_console_offset=_console_offset\-1;}'; +alias 'console_scroll_up' 'if(_console_offset<_console_lines+console_scroll_n\-_rows){_console_offset=_console_offset+console_scroll_n;}'; +alias 'console_scroll_down' 'if(allow_round_scroll || (_console_offset>=console_scroll_n)){_console_offset=_console_offset\-console_scroll_n;}'; +alias 'console_scroll_reset' '{_console_offset=0;}'; +alias 'scu' 'console_scroll_up;' ""; +alias 'scd' 'console_scroll_down;' ""; +alias 'scz' 'console_scroll_reset;' ""; +alias 'center' 'align "center"'; +alias 'left' 'align "left"'; +alias 'right' 'align "right"'; +alias 'top' 'align "top"'; +alias 'bottom' 'align "bottom"'; +bind "PageUp" "if(_display_console==0){prev;}else{scu;}"; +bind "PageDown" "if(_display_console==0){next;}else{scd;}"; +bind "Home" "0;"; +bind "End" "$;"; +bind "^" "0;"; +bind "$" "$;"; +bind "Backspace" "prev;"; +bind "'" "goto _lastfileindex"; +_display_status=1; +_want_wm_caption_status="fim:%N@%p%%%L[%i/%l]"; +_info_fmt_str="%p%% %wx%h%L %i/%l%P %F %T %c"; +_display_status_fmt="%N%?EXIF_DateTimeOriginal?[%:EXIF_DateTimeOriginal:]?%?EXIF_ExposureTime?[%:EXIF_ExposureTime:]?%?EXIF_FNumber?[%:EXIF_FNumber:]?%?EXIF_ApertureValue?[%:EXIF_ApertureValue:]?%?EXIF_ISOSpeedRatings?[ISO%:EXIF_ISOSpeedRatings:]?:%k"; +#_display_status_fmt="%N:%k"; # +#_use_exiftool=0; +echo "WELCOME : to switch to the command line interface press ':' "; +# Some more examples: +#alias "plisten" 'popen "nc \-l \-p 9999 "' "executes fim commands coming from port 9999 on this computer"; +#alias "wlisten" "while(1){sleep;plisten;}" "listen to a pipe, endlessly"; +#alias "musicplay" "system 'mpc play'" ""; +#alias "musicpause" "system 'mpc pause'" ""; +#alias "rdjpgcom" 'system "rdjpgcom" i:_filename'; +# offsetscan usage : need a mechanism for popping all images before. +#alias "offsetscan" "while(i:width<1){list 'push' offimage;_open_offset=_open_offset+1;reload;}"; +#alias "offsetscan" "while(i:width<1){list 'push' '/home/dez/mostro.jpg';stdout _open_offset ;_open_offset=_open_offset+1;reload;}"; +#alias "webcam" "pread 'vgrabbj \-d /dev/video0';"; +#alias "webcam_cycle" "while(1){webcam;reload;sleep 1;};"; +#This is a FIM initialization file. +#Without one of these FIM is nothing. +#So feel free to modify it, but with caution! + +.SH NOTES +This manual page is incomplete: a number of topics, as type conversions, or operator precedence, or exact command usage is left unspecified. +The conditions for autocommands triggering are not specified as they should. +A formal description of the various one\-line commands, as well a more extensive example list is needed. +Many of the listed variables are only valid within a namespace, and this shall be documented clearly. +.SH BUGS +The +.B fim +language has a number of problems that shall be first documented, then fixed. +.SH SEE ALSO +\fR\fIfim\fR(1), \fR\fIfimgs\fR(1), \fR\fIregex\fR(1). +.SH AUTHOR +Michele Martone +.SH COPYRIGHT +See copyright notice in \fR\fIfim\fR(1). + + diff --git a/doc/fimrc.man.html b/doc/fimrc.man.html new file mode 100644 index 0000000..f5f06ac --- /dev/null +++ b/doc/fimrc.man.html @@ -0,0 +1,1736 @@ + + + + + + + + + +fimrc + + + + +

fimrc

+ +NAME
+SYNOPSIS
+DESCRIPTION
+FIM LANGUAGE GRAMMAR
+COMMANDS REFERENCE
+AUTOCOMMANDS REFERENCE
+VARIABLES REFERENCE
+COMMAND LINE USAGE EXAMPLES
+CONFIGURATION FILE EXAMPLES
+NOTES
+BUGS
+SEE ALSO
+AUTHOR
+COPYRIGHT
+ +
+ + +

NAME + +

+ + +

fimrc - +fim configuration file and language reference

+ +

SYNOPSIS + +

+ + +

~/.fimrc +
+/usr/local/etc/fimrc
+fim --script-from-stdin [ {options} +] < {scriptfile}
+fim --execute-script {scriptfile} [ +{options} ]
+fim --execute-commands {commands} [ +{options} ]
+fim --final-commands {commands} [ +{options} ]
+fim --write-scriptout {scriptfile} [ +{options} ]
+fim --write-scriptout /dev/stdout [ +{options} ]

+ +

DESCRIPTION + +

+ + +

This page +explains the fim language, which is used for the +fimrc configuration files, {scriptfile}s, or +{commands} passed via command line {options}. This language +can be used to issue commands (or programs) from the +internal program command line accessed interactively through +the ":" key (or rather, the key code specified by +the "_console_key" variable). One may exit from +command line mode by pressing the Enter key on an empty line +(a non empty command line would be submitted for execution), +or the Esc key (only in SDL mode). The general form of a fim +command/program is shown in the next section.

+ +

FIM LANGUAGE GRAMMAR + +

+ + +

This section +specifies the grammar of the fim language.

+ +

Language +elements surrounded by a single quote ("’") +are literals.

+ +

Warning: at the +present state, this grammar has conflicts. A future release +shall fix them.

+ +

program: %empty +
+| statement_list

+ + +

statement_list: +statement
+| statement ’;’ statement_list
+| non_atomic_statements_block statement_list
+| statements_block

+ + +

non_atomic_statements_block: +’{’ statement_list ’}’
+| INTEGER ’{’ statement_list ’}’ +
+| conditional_statement

+ + +

statements_block: +atomic_statements_block
+| non_atomic_statements_block

+ + +

conditional_statement: +if_statement
+| loop_statement

+ +

if_statement: +’if’ ’(’ expression ’)’ +statements_block
+| ’if’ ’(’ expression +’)’ statements_block ’else’ +statements_block

+ + +

loop_statement: +’while’ ’(’ expression +’)’ statements_block
+| ’do’ statements_block ’while’ +’(’ expression ’)’

+ + +

atomic_statements_block: +statement ’;’
+| statement ’;’ ’;’
+| statement ’;’ ’;’ +’;’

+ +

statement: +’!’ arguments
+| INTEGER IDENTIFIER
+| SLASH_AND_REGEXP
+| ’+’ UNQUOTED_FLOAT ’%’
+| ’+’ QUOTED_FLOAT ’%’
+| ’+’ INTEGER ’%’
+| ’*’ UNQUOTED_FLOAT
+| ’*’ QUOTED_FLOAT
+| ’*’ INTEGER
+| UNQUOTED_FLOAT ’%’
+| QUOTED_FLOAT ’%’
+| INTEGER ’%’
+| ’-’ UNQUOTED_FLOAT ’%’
+| ’-’ QUOTED_FLOAT ’%’
+| ’-’ INTEGER ’%’
+| INTEGER
+| ’-’ INTEGER
+| IDENTIFIER
+| IDENTIFIER FILE_PATH
+| IDENTIFIER arguments
+| INTEGER IDENTIFIER arguments
+| IDENTIFIER ’=’ expression

+ +

arguments: +expression
+| expression arguments

+ +

expression: +’(’ expression ’)’
+| expression ’.’ expression
+| ’!’ expression
+| expression ’%’ expression
+| expression ’+’ expression
+| expression ’-’ expression
+| expression ’*’ expression
+| expression ’/’ expression
+| expression ’<’ expression
+| expression ’>’ expression
+| expression ’||’ expression
+| expression BOR expression
+| expression ’&&’ expression
+| expression BAND expression
+| expression ’>=’ expression
+| expression ’<=’ expression
+| expression ’!=’ expression
+| expression ’==’ expression
+| expression ’=~’ expression
+| ’-’ expression
+| IDENTIFIER
+| INTEGER
+| QUOTED_FLOAT
+| UNQUOTED_FLOAT
+| STRING

+ +

A STRING can be +either a single quoted string or a double quoted string. A +FLOAT is a floating point number. A QUOTED_FLOAT is a +floating point number, either single ("’") +or double (""") quoted. An INTEGER shall be +an unsigned integer number. An IDENTIFIER shall be one of +the valid fim commands (see COMMANDS REFERENCE ) or a +valid alias. A VARIABLE shall be an already declared or +undeclared variable identifier (see VARIABLES +REFERENCE ) or a valid alias, created using the +alias command. The "=~" operator treats the +right expression as a STRING, and uses is as a regular +expression for matching purposes. The SLASH_AND_REGEXP is a +slash ("/") followed by a STRING, interpreted as a +regular expression. See regex(1) for regular +expression syntax.

+ +

The way some +one-line statements are evaluated:

+ +

: enter command +line mode
+:{number} jump to {number}^th image in the list

+ + + + + + + + + + + + +
+ + +

:^

+ + +

jump to first image in the list

+ + +

:$

+ + +

jump to last image in the list

+ +

:*{factor} scale the image by +{factor}
+:{scale}% scale the image to the desired {scale}
+:+{scale}% scale the image up to the desired percentage +{scale} (relatively to the original)
+:-{scale}% scale the image down to the desired +percentage {scale} (relatively to the original)

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

/{regexp}

+ + + +

entering the pattern {regexp} (with /) makes fim jump to +the next image whose filename matches {regexp}

+ + +

/*.png$

+ + + +

entering this pattern (with /) makes fim jump to the +next image whose filename ends with ’png’

+ + +

/png

+ + + +

a shortcut for /.*png.*

+
+ + +

!{syscmd}

+ + + +

executes the {syscmd} quoted string as a +"/bin/sh" shell command

+ +

COMMANDS REFERENCE + +

+ + +

alias +
+alias [{identifier} [{commands} [{description}]]]

+ +

align +
+align bottom : align to the lower side the current image; +align top : align to the upper side the current image;

+ +

autocmd +
+autocmd {event} {pattern} {commands} : manipulate auto +commands

+ + +

autocmd_del +
+autocmd_del : manipulate auto commands. usage: autocmd_del +{event} {pattern} {commands}

+ + +

basename +
+basename {filename} : returns the basename of {filename}

+ +

bind +
+bind [{keysym} [{commands}]] : bind a keyboard +symbol/shortcut {keysym} to {commands}; if {keysym} is at +least two characters long and begins with 0 (zero), the +integer number after the 0 will be treated as a raw keycode +to bind the specified {keysym} to. activate the +_verbose_keys variable to discover (display device +dependent) raw keys.; binding is dynamical, so you can +rebind keys even during program’s execution

+ +

cd
+cd {path}: change the current directory to {path}. cd +- will change to the previous current directory +(before the last ":cd {path}" command)

+ +

clear +
+clear : clear the virtual console

+ + +

commands +
+commands : display the existing commands

+ + +

desaturate +
+desaturate : desaturate the displayed image colors. To get +back the original you will have to reload the image.

+ +

desc +
+desc ’load’ {filename} [{sepchar}] : load +description file {filename}, using the optional {sepchar} +character as separator. See documentation of +--load-image-descriptions-file +for the format of {filename}.

+ +

display +
+display [’reinit’ {string}]|’resize’ +{w} {h}] : display the current file contents; if +’reinit’ switch is supplied, the +’{string}’ specifier will be used to +reinitialize (e.g.: change resolution, window system +options) the display device; see documentation for the +--output-device command line switch for +allowed values of {string}; if ’resize’ and no +argument, will ask the window manager to size the window +like the image; if ’resize’ and two arguments, +these will be used as width and height of window, to +set.

+ + +

dump_key_codes +
+dump_key_codes : dump the active key codes (unescaped, for +inspection)

+ +

echo +
+echo {args}: print the {args} on console

+ +

else +
+if(expression){action;}[’else’{action;}] : see +else

+ +

eval +
+eval {args} : evaluate {args} as commands, executing +them

+ +

exec +
+exec {filename(s)} : execute script {filename(s)}

+ +

getenv +
+getenv {identifier} : display the value of the {identifier} +environment variable

+ +

goto +
+goto +{[’+’|’-’]{number}[’%’][’f’|’p’]} +| {/{regexp}/} | {’+//’}: jump to an image; if +{number} is given, and not surrounded by any specifier, will +go to image at index {number} ; if followed by +’%’, the effective index will be computed as a +percentage to the current available images; if prepended by +’-’ or ’+’, the jump will be +relative to the current index; the ’f’ specifier +asks for the jump to occur within the files; the +’p’ specifier asks for the jump to occur in +terms of pages, within the current file; if /{regexp}/ is +given, will jump to the first image matching the given +/{regexp}/ regular expression pattern; if given +’+//’, will jump to the first different image +matching the last given regular expression pattern. Match +will occur on both file name and description, eventually +loaded via desc or +--load-image-descriptions-file.

+ +

help +
+help [{identifier}] : provide online help, assuming +{identifier} is a variable, alias, or command identifier. If +{identifier} begins with /, the search will be on the help +contents and a list of matching items will be given instead. +A list of commands can be obtained simply invoking +"commands"; a list of aliases with +"alias"; a list of bindings with +"bind".

+ +

if
+if(expression){action;}[’else’{action;}] : see +if

+ +

info +
+info : display information about the current file

+ +

limit +
+limit [{expression} |{variable} {value}] : A browsable file +list filtering function (like limiting in the +’mutt’ program). Uses information loaded via +--load-image-descriptions-file. +If one argument only is provided, restrict to files whose +description string matches {expression}. If two arguments +are provided, restrict to files having property {variable} +set to {value}. If invoked with one exclamation point +(’!’) as argument will restrict to the currently +marked files only. Invoked with no arguments, the original +browsable files list is restored.

+ +

list +
+list : display the files list; list +’random_shuffle’: randomly shuffle the file +list; list ’reverse’: reverse the file list; +list ’clear’: clear the file list; list +’sort’: sort the file list; list +’sort_basename’: sort the file list according to +the file base name; list ’pop’ : pop the last +file from the files list; list ’remove’ +[{filename(s)}] : remove the current file, or the +{filename(s)}, if specified ; list ’push’ +{filename(s)} : push {filename(s)} to the back of the files +list; list ’filesnum’: display the number of +files in the files list; list ’mark’ [{args}] : +mark image file names for stdout printing at exit, with +{args} mark the ones matching according to the rules of the +’limit’ command, otherwise the current file; +list ’unmark’ [{args}] : unmark marked image +file names, with {args} unmark the ones matching according +to the rules of the ’limit’ command, otherwise +the current file; list ’marked’: show which +files have been marked so far; list ’pushdir’; +{dirname}: will push all the files in {dirname}, when +matching the regular expression in variable _pushdir_re or, +if empty, from constant regular expression +.JPG$|.PNG$|.GIF$|.BMP$|.TIFF$|.TIF$ +|.JPEG$|.JFIF$|.PPM$|.PGM$|.PBM$|.PCX$; list +’pushdirr’ {dirname}: like pushdir, but will +also push encountered directory entries recursively.

+ +

load +
+load : load the image, if not yet loaded (see also +reload)

+ +

negate +
+negate : negate the displayed image colors.

+ +

pan
+pan +{’down’|’up’|’left’|’right’|’ne’|’nw’|’se’|’sw’} +[{steps}[’%’]] pan the image {steps} pixels in +the desired direction; if the ’%’ specifier is +present, {steps} will be treated as a percentage of current +screen dimensions; if {steps} is not specified, the +"_steps" variable will be used; if present, the +"_hsteps" variable will be considered for +horizontal panning; if present, the "_vsteps" +variable will be considered for vertical panning; the +variables may be terminated by the ’%’ +specifier

+ +

popen +
+popen {syscmd} : pipe a command, invoking popen(): spawns a +shell, invoking {syscmd} and executing as fim commands the +output of {syscmd}

+ +

pread +
+pread {args} : execute {args} as a shell command and read +the output as an image file (using popen)

+ + +

prefetch +
+prefetch : prefetch (read into the cache) the two nearby +image files (next and previous), for a faster subsequent +opening. See also the _want_prefetch variable.

+ +

pwd
+pwd : print the current directory name, and updates the _pwd +variable

+ +

quit +
+quit [{number}] : terminate the program; if {number} is +specified, use it as the program return status

+ + +

recording +
+recording ’start’ : start recording the executed +commands; recording ’stop’ : stop recording the +executed commands; recording ’dump’ : dump in +the console the record buffer; recording +’execute’ : execute the record buffer; recording +’repeat_last’ : repeat the last performed +action;

+ + +

redisplay +
+redisplay : re-display the current file contents

+ +

reload +
+reload [{arg}] : load the image into memory; if {arg} is +present, will force reloading, bypassing the cache (see also +load)

+ +

rotate +
+rotate {number}: rotate the image the specified amount of +degrees [undocumented]

+ +

scale +
+scale +{[’+’|’-’]{value}[’%’]|’*’{value}|’w’|’h’|’a’|’b’|’+[+-*/]’} +: scale the image according to a scale {value} (e.g.: +0.5,40%,’w’,’h’,’a’,’b’); +if given ’*’ and a value, will multiply the +current scale by that value; if given ’w’, will +scale according to the screen width; if given +’h’, scale to the screen height; if given +’a’, to the minimum of ’w’ and +’h’; if given ’b’, like +’a’, provided that the image width exceeds +’w’ or ’h’; if {value} is a number, +will scale relatively to the original image width; if the +number is followed by ’%’, the relative scale +will be treated on a percent scale; if given +’++’(’+-’), will increment +(decrement) the "_magnify_factor", +"_reduce_factor" variables by +"_scale_factor_delta"; if given +’+*’(’+/’), will multiply (divide) +the "_magnify_factor", "_reduce_factor" +variables by "_scale_factor_multiplier";

+ + +

scrolldown +
+scrolldown : scroll down the image, going next if at +bottom

+ + +

scrollforward +
+scrollforward : scroll the image as it were reading it

+ +

set
+set: returns a list of variables which are set; set +{identifier}: returns the value of variable {identifier}; +set {identifier} {commands}: sets variable {identifier} to +value {commands};

+ + +

set_commandline_mode +
+set_commandline_mode : set console mode

+ + +

set_interactive_mode +
+set_interactive_mode : set interactive mode

+ +

sleep +
+sleep [{number}=1] : sleep for the specified (default 1) +number of seconds

+ +

status +
+status : set the status line to the collation of the given +arguments

+ +

stdout +
+stdout {args} : writes to stdout its arguments {args}

+ +

system +
+system {syscmd}: get the output of the shell command +{syscmd}. (uses popen())

+ + +

variables +
+variables : display the existing variables

+ +

unalias +
+unalias {identifier} | ’-a’ : delete the +alias {identifier} or all aliases (use +’-a’, not -a)

+ +

unbind +
+unbind {keysym} : unbind the action associated to a +specified {keysym}; if {keysym} is at least two characters +long and begins with 0 (zero), the integer number after the +0 will be treated as a raw keycode to bind the specified +{keysym} to. activate the _verbose_keys variable to discover +(display device dependent) raw keys.

+ +

while +
+while(expression){action;} A conditional cycle construct. +May be interrupted by hitting the Esc or the : key

+ +

window +
+window {args} : this command is disabled. It shall be +re-enabled in a future version.

+ +

AUTOCOMMANDS REFERENCE + +

+ + +

Available +autocommands are: PostScale, PreScale, PrePan, PostPan, +PreRedisplay, PostRedisplay, PreDisplay, PostDisplay, +PrePrefetch, PostPrefetch, PostReload, PreReload, PostLoad, +PreLoad, PostGoto, PreGoto, PreConfigLoading, +PostConfigLoading, PreHardcodedConfigLoading, +PostHardcodedConfigLoading, PreUserConfigLoading, +PostUserConfigLoading, PreGlobalConfigLoading, +PostGlobalConfigLoading, PreInteractiveCommand, +PostInteractiveCommand, PreExecutionCycle, +PreExecutionCycleArgs, PostExecutionCycle, PreWindow, +PostWindow, and they are triggered on actions as indicated +by their name.

+ +

VARIABLES REFERENCE + +

+ + +

If undeclared, +a variable will evaluate to 0.

+ +

The namespaces +in which variables may exist are: current image, global. A +namespace is specified by a prefix, which is one of: +’i:’, which shall be prepended to the variable +name. The global namespace is equivalent to the empty +one:’’. The special variable i:* expands to the +collation of all the name-value pairs for the current +image.

+ +

In the +following, the [internal] variables are the ones referenced +in the source code (not including the hardcoded +configuration, which may be inspected and/or invalidated by +the user at runtime).

+ +

_TERM +[out,g:] the environment TERM variable
+__exif_flipped
[out,i:] flipping information, read from +the EXIF tags of a given image.
+__exif_mirrored
[out,i:] mirroring information, read +from the EXIF tags of a given image.
+__exif_orientation
[out,i:] orientation information in +the same format of _orientation, read from the orientation +EXIF tags (i:EXIF_Orientation).
+_archive_files
[in,g:] Regular expression matching +filenames to be treated as (multipage) archives. If empty, +".*(RAR|ZIP|TAR|TAR.GZ|TGZ|TAR.BZ2|TBZ|TBZ2|CBR|CBZ|LHA|7Z|XAR|ISO)$" +will be used. Within each archive, only filenames matching +the regular expression in the _pushdir_re variable will be +considered for opening.
+_autocmd_trace_stack
[in,g:] dump to stdout autocommands +(autocmd) stack trace during their execution (for debugging +purposes)
+_autodesaturate
[in,g:] if 1, will desaturate images by +default
+_autoflip
[in,g:] if 1, will flip images by default +
+_automirror
[in,g:] if 1, will mirror images by default +
+_autonegate
[in,g:] if 1, will negate images by default +
+_autotop
[in,g:] if 1, will align to the top freshly +loaded images
+_cache_status
[out,g:] string with current information +on cache status
+_cached_images
[out,g:] the number of images currently +cached.
+_caption_over_image
[experimental,in,g:] if +_caption_over_image is set not to 0, will display the +contents of i:_comment as a caption over the image; if +larger than 1, with black background.
+_command_expansion
[in,g:] if 1, will enable +autocompletion (on execution) of alias and command strings +
+_comment
[i:,out] the image comment, extracted from the +image file (if any)
+_console_buffer_free
[out,g:] amount of unused memory in +the output console buffer
+_console_buffer_total
[out,g:] amount of memory +allocated for the output console buffer
+_console_buffer_used
[out,g:] amount of used memory in +the output console buffer
+_console_key
[in,g:] the key binding (an integer +variable) for spawning the command line; will have +precedence over any other binding
+_console_lines
[out,g:] the number of buffered output +console text lines
+_console_offset
[in,out,g:] position of the text +beginning in the output console, expressed in lines
+_debug_commands
[in,g:] print out each command before +its execution (for debugging purposes)
+_device_string
[out,g:] the current display device +string
+_display_as_binary
[in,g:] will force loading of the +specified files as pixelmaps (no image decoding will be +performed); if 1, using one bit per pixel; if 24, using 24 +bits per pixel; otherwise will load and decode the files as +usual
+_display_as_rendered_text
[in,g:] will force loading of +the specified files as text files (no image decoding will be +performed); if 1; otherwise will load and decode the files +as usual
+_display_busy
[in,g:] if 1, will display a message on +the status bar when processing
+_display_console
[in,g:] if 1, will display the output +console
+_display_status
[in,g:] if 1, will display the status +bar
+_display_status_bar
[in,g:] if 1, will display the +status bar
+_display_status_fmt
[in,g:] custom info format string, +displayed in the lower left corner of the status bar; if +unset: full pathname; otherwise a custom format string +specified just as _info_fmt_str.
+_do_sanity_check
[in,experimental,g:] if 1, will execute +a sanity check on startup
+_exiftool_comment
[out,g:] comment extracted via the +exiftool interface; see _use_exiftool.
+_fbfont
[out,g:] The current console font file string. +If the internal hardcoded font has been used, then its value +is "fim://".
+_file_loader
[in,i:,g:] if not empty, this string will +force a file loader (among the ones listed in the -V +switch output); [out] i:_file_loader stores the loader of +the current image
+_fileindex
[out,g:] the current image numeric index +
+_filelistlen
[out,g:] the length of the current image +list
+_filename
[out,i:] the current file name string
+_fim_bpp
[out,g:] the bits per pixel count
+_fim_default_config_file_contents
[out,g:] the contents +of the default (hardcoded) configuration file (executed +after the minimal hardcoded config)
+_fim_default_grammar_file_contents
[out,g:] the contents +of the default (hardcoded) grammar file
+_fim_scriptout_file
[in,g:] the name of the file to +write to when recording sessions
+_fim_version
[out,g:] fim version number; may be used +for keeping compatibility of fim scripts across evolving +versions.
+_hsteps
[in,g:] the default steps, in pixels, when +panning images horizontally (overrides steps)
+_ignorecase
[in,g:] if 1, will allow for case +insensitive regexp-based match in autocommands +(autocmd);
+_info_fmt_str
[in,g:] custom info format string, +displayed in the lower right corner of the status bar; may +contain ordinary text and special ’expando’ +sequences. These are: %p for current scale, in percentage; +%w for width; %h for height; %i for image index in list; %k +for the value of i:_comment (comment description) variable +in square brackets; %l for image list length; %L for +flip/mirror/orientation information; %P for page +information; %F for file size; %M for screen image memory +size; %m for memory used by mipmap; %C for memory used by +cache; %T for total memory used (approximation); %R for +total max memory used (as detected by getrusage()); %n for +the current file path name; %N for the current file path +name basename; ; %c for centering information; %v for the +fim program/version identifier string; %% for an ordinary %. +A sequence like %?VAR?EXP? expands to EXP if i:VAR is set; +EXP will be copied verbatim except for contained sequences +of the form %:VAR:, which will be expanded to the value of +variable i:VAR; this is meant to be used like in e.g. +’%?EXIF_DateTimeOriginal?[%:EXIF_DateTimeOriginal:]?’, +where the EXIF-set variable EXIF_DateTimeOriginal +(make sure you have libexif for this) will be used only if +present.
+_inhibit_display
[internal,g:] if 1, will inhibit +display
+_last_file_loader
[out,g:] after each image load, +_last_file_loader will be set to the last file loader used +
+_last_system_output
[out,experimental,g:] the standard +output of the last call to the system command
+_lastfileindex
[out,g:] the last visited image numeric +index. Useful for jumping back and forth easily between two +images with ’goto _lastfileindex’.
+_load_default_etc_fimrc
[in,g:] if 1 at startup, will +load the system wide initialization file
+_load_fim_history
[in,g:] if 1 on startup, will load the +~/.fim_history file on startup
+_lwidth
[in,g:] if>0, will force the output console +text width
+_magnify_factor
[in,g:] the image scale multiplier used +when magnifying images size
+_max_cached_images
[in,experimental,g:] the maximum +number of images after which evictions will be forced. +Setting this to 0 (no limits) is ok provided +_max_cached_memory is set meaningfully.
+_max_cached_memory
[in,experimental,g:] the maximum +amount of memory (in KiB) at which images will be continued +being added to the cache. Setting this to 0 (no limit) will +lead to a crash (there is no protection currently).
+_max_iterated_commands
[experimental,g:] the iteration +limit for N in "N[commandname]" iterated command +invocations
+_no_default_configuration
[in,g:] if 0, a default, +hardcoded configuration will be executed at startup, after +the minimal hardcoded one.
+_no_external_loader_programs
[in,g:] if 1, no external +loading programs will be tried for piping in an unsupported +type image file
+_no_rc_file
[in,g:] if 1, the ~/.fimrc file will not be +loaded at startup
+_open_offset
[in,optional,g:,i:] offset (specified in +bytes) used when opening a file; [out] i:_open_offset will +be assigned to images opened at a nonzero offset
+_open_offset_retry
[in,optional,g:] number of adjacent +bytes to probe in opening the file
+_orientation
[internal,i:] Orthogonal clockwise rotation +(orientation) is controlled by: +’i:_orientation’, ’g:_orientation’ +and applied on a per-image basis. In particular, the +values of the three variables are summed up and the sum is +interpreted as the image orientation. If the sum is 0, no +rotation will apply; if it is 1, a single ( 90’) +rotation will apply; if it is 2, a double (180’) +rotation will apply; if it is 3, a triple (270’) +rotation will apply. If the sum is not one of 0,1,2,3, the +value of the sum modulo 4 is considered. Therefore, +":i:_orientation=1" and +":i:_orientation=5" are equivalent: they rotate +the image one time by 90’.
+_preferred_rendering_dpi
[in,optional,g:] if >0, pdf, +ps, djvu rendering will use this value for a default +document dpi (instead of a default value)
+_preferred_rendering_width
[in,optional,g:] if >0, +bit based rendering will use this value for a default +document width (instead of a default value)
+_push_checks
[in,experimental,g:] if 1 (default), will +check with stat() existence of input files before +push’ing them (set this to 0 to speed up loading very +long file lists; in these cases a trailing slash (/) will +have to be used to tell fim a pathname is a directory). This +only works after initialization (thus, after command line +files have been push’ed); use +--no-stat-push if you wish to set +this to 0 at command line files specification
+_push_pushes_dirs
[in,g:] if 1, the push command will +also accept and push directories (using pushdir)
+_pushdir_re
[in] regular expression to match against +when pushing files from a directory or an archive. By +default this is ".JPG$|.PNG$|.GIF$ +|.BMP$|.TIFF$|.TIF$|.JPEG$|.JFIF$|.PPM$|.PGM$|.PBM$|.PCX$". +
+_pwd
[out,g:] the current working directory; will be +updated at startup and whenever the working directory +changes
+_re_search_opts
[in,g:] affects regexp-based +searches; if an empty string, defaults will apply; if +contains ’i’ (’I’), case insensitive +(sensitive) searches will occur; if contains +’b’, will match on basename, if contains +’f’ on full pathname.
+_reduce_factor
[in,g:] the image scale multiplier used +when reducing images size
+_retry_loader_probe
[in,g:] if 1 and user specified a +file loader and this fails, will probe for a different +loader
+_rows
[in,g:] if >0, will set the number of displayed +text lines in the console
+_save_fim_history
[in,g:] if 1 on exit, will save the +~/.fim_history file on exit
+_scale_factor_delta
[in,g:] value used for +incrementing/decrementing the scaling factors
+_scale_factor_multiplier
[in,g:] value used for scaling +up/down the scaling factors
+_scale_style
[in,g:] if non empty, this string will be +fed to the scale command
+_screen_height
[out] the screen height
+_screen_width
[out,g:] the screen width
+_seek_magic
[optional,g:] will seek for a magic +signature before opening a file (for now, use like this: fim +-C ’_seek_magic=MAGIC_STRING;push +filename’ )
+_status_line
[in,g:] if 1, will display the status bar +
+_steps
[in,g:] the default steps, in pixels, when +panning images
+_sys_rc_file
[in,g:] string with the global +configuration file name
+_use_exiftool
[in,g:] if >0 and supported, exiftool +will be used to get additional information. if 1, this will +be appened to _comment; if 2, will go to _exiftool_comment +
+_use_mipmaps
[in,g:] if >0, will use mipmaps to speed +up downscaling of images (this has a memory overhead +equivalent to one image copy); mipmaps will not be cached. +
+_verbose_errors
[in,g:] if 1, will display on stdout +internal errors, while parsing commands
+_verbose_keys
[in,g:] if 1, after each interactive mode +key hit, the console will display the hit key raw keycode +
+_verbosity
[in,experimental,g:] program verbosity +
+_vsteps
[in,g:] the default steps, in pixels, when +panning images vertically (overrides steps)
+_want_autocenter
[in,g:] if 1, the image will be +displayed centered
+_want_exif_orientation
[in,g:] if 1, will reorient +images using information from EXIF metadata (and stored in +in __exif_orientation, __exif_mirrored, __exif_flipped ). +
+_want_prefetch
[in,g:] if 1, will prefetch further files +just after display of the first file
+_want_sleep_seconds
[in,g:] number of seconds of sleep +during slideshow mode
+_want_wm_caption_status
[in,g:] this works only if +supported by the display device (currently only SDL). if set +to a number that is not 0, will show the status (or command) +line in the window manager caption; if set to a +non-empty string, will interpret it just as a file +info format string (see _info_fmt_str); if empty, will show +the program version.
+angle
[in,out,i:] a floating point number specifying the +rotation angle, in degrees
+ascale
[in,out,i:] the asymmetric scaling of the current +image
+desaturated
[out,i:] 1, if the image is desaturated +
+flipped
[out,i:] 1, if the image is flipped
+fresh
[in,out,i:,experimental] 1 if the image was +loaded, before all autocommands (autocmd) execution
+height
[out,i:] the current image original height +
+mirrored
[out,i:] 1, if the image is mirrored
+negated
[out,i:] 1, if the image is negated
+page
[out,experimental,g:] the current page
+pages
[out,experimental,i:] the current number of pages +of an image
+random
[out] a pseudorandom number
+scale
[in,i:] the scale of the current image
+sheight
[out,i:] the current image scaled height
+swidth
[out,i:] the current image scaled width
+width
[out,i:] the current image original width

+ +

COMMAND LINE USAGE EXAMPLES + +

+ + +

# jump to the +third image:
+3;
+# jump to first image:
+^;
+# jump to last image:
+$;
+# magnify the image two times:
+*2;
+# scale the image to the 30% of the original:
+30%;
+# scale the image up by 30%:
++30%;
+# scale the image down by 30%:
+-30%;
+# jump to the next image whose filename matches the +".*jpg" regular expression:
+/.*jpg;
+# executes the "date" system command
+!"date";

+ +

CONFIGURATION FILE EXAMPLES + +

+ + +

This is the +default configuration, as contained in the +_fim_default_config_file_contents variable.

+ +

# +$LastChangedDate: 2016-02-04 19:53:36 +0100 +(Thu, 04 Feb 2016) $
+# Contents of the default ’fimrc’ file, +hardcoded in the fim executable.
+# Read the documentation (man fimrc) to discover how to +change this default hardcoded file and how to make your own. +
+# Note that usually a ~/.fimrc file is read after these +options take effect, so you could reset all of this with +ease.
+# Lines beginning with a pound (#) are ignored by fim (they +are treated as comments).
+#
+# Internal variables.
+# Some of these variables influence Fim’s behaviour +(input variables), some are set by Fim (output variables). +
+# It is wise the input variables are set at the beginning of +the file, so the bottom may issue commands correctly +affected by them.
+if(_debug_commands==’’){_debug_commands=0;}
+ +if(_command_expansion==’’){_command_expansion=1;} +
+if(_display_status==’’){_display_status=0;}
+ +if(_max_cached_images==’’){_max_cached_images=5;} +
+ +if(_max_cached_memory==’’){_max_cached_memory=81920;} +
+ +if(_max_iterated_commands==’’){_max_iterated_commands=100;} +
+if(_want_prefetch==’’){_want_prefetch=1;}
+ +if(_no_external_loader_programs==’’){_no_external_loader_programs=0;} +
+ +if(_scale_style==’’){_scale_style=’b’;} +
+if(_save_fim_history==’’){_save_fim_history=1;} +
+if(_load_fim_history==’’){_load_fim_history=1;} +
+if(_verbose_keys==’’){_verbose_keys=0;}
+if(_display_busy==’’){_display_busy=1;}
+if(_ignorecase==’’){_ignorecase=1;}
+ +if(_re_search_opts==’’){_re_search_opts=’bi’;} +
+if(_console_offset==’’){_console_offset=0;}
+if(_console_key==’’){_console_key=58;}
+ +if(_display_as_binary==’’){_display_as_binary=0;} +
+if(_push_checks==’’){_push_checks=1;}
+ +#if(_want_wm_caption_status==’’){_want_wm_caption_status=0;} +
+ +if(_want_exif_orientation==’’){_want_exif_orientation=1;} +
+if(ascale==’’){ascale="1.0";}
+if(_use_mipmaps==’’){_use_mipmaps=1;}
+#
+# External variables (not used internally).
+ +if(allow_round_scroll==’’){allow_round_scroll=0;} +
+if(console_scroll_n==’’){console_scroll_n=3;} +
+#
+alias "toggleautoflip" +"_autoflip=1-_autoflip;" "";
+alias "toggleautonegate" +"_autonegate=1-_autonegate;" ""; +
+alias "toggleflip" +"i:flipped=1-i:flipped;" "";
+alias "flip" "toggleflip;redisplay;" +"flip the current image along the horizontal +axis";
+alias "fliponce" "flip;toggleflip;" +"";
+alias "toggleautomirror" +"_automirror=1-_automirror;" ""; +
+alias "togglemirror" +"i:mirrored=1-i:mirrored;" ""; +
+alias "mirror" "togglemirror;redisplay;" +"mirror the image along the vertical axis" +"";
+alias "mirroronce" +"mirror;togglemirror;" "";
+alias ’toggleLimitMarked’ +’__pre_limit_fileindex=_fileindex;_limit_mode=1-_limit_mode; +if(_limit_mode==1){limit "!";} else { limit; } +if(_filelistlen<1){_limit_mode=0;limit;goto +__pre_limit_fileindex;} i:fresh=1;redisplay; ’ +"toggle between limiting file list to the marked files +and the full list";
+# Warning : binding to C-s, C-z and C-c +won’t make effect, as these
+# codes are get caught by the console driver and will have +no effect in fim.
+# Moreover, C-z will crash fim and C-c will +terminate it.
+# Some other combinations (e.g.:C-l) may have similar +problems in your console.
+bind ’f’ "flip;";
+bind ’F’ "fliponce;";
+bind ’m’ "mirror;";
+bind ’M’ "mirroronce;";
+bind ’q’ "quit";
+bind ’Esc’ "quit";
+#bind ’n’ "next_file;";
+#bind ’n’ "next;";
+bind ’C-h’ "help";
+#bind ’?’ "help"; # assigned to +back-search
+#bind ’/’ "help"; # assigned to +forward-search
+bind ’=’ "scale ’100%’"; +
+#bind ’p’ "prev_file;";
+bind ’Del’ "list +’pop’;reload;";
+#bind ’s’ "list ’sort’"; +
+bind ’s’ "scrollforward";
+bind ’C-s’ "swap;redisplay;"; +
+bind ’S’ "toggleDisplayStatus";
+bind ’I’ "toggleautonegate";
+bind ’i’ "negate;redisplay;";
+bind ’g’ "desaturate;redisplay;";
+bind ’G’ "toggleDesaturate;";
+#bind ’R’ "reload";
+#bind ’R’ "redisplay";
+bind ’r’ "rotate90;";
+bind ’R’ "rotate270;";
+#bind ’R’ "rotate10;display;";
+#bind ’r’ "rotate10_ccw;display;"; +
+#bind ’r’ "reload;";
+#bind ’C-d’ "display";
+bind ’+’ "magnify";
+#bind ’C-+’ +"angle=angle+10.0;display;";
+bind ’a’ "scale ’a’;"; +
+bind ’H’ "scale ’H’;"; +
+bind ’Tab’ "toggleVerbosity";
+bind ’Menu’ "toggleVerbosity";
+#bind ’C-k’ +"_want_wm_caption_status=1-_want_wm_caption_status;status +’ ’";
+bind ’v’ "toggleDisplayStatus";
+bind ’A’ "A";
+bind ’C-m’ "list +’mark’";
+bind ’u’ "list ’unmark’"; +
+bind ’Enter’ "list +’mark’;next";
+bind ’-’ "reduce";
+bind "Up" "pan_up";
+bind ’k’ "pan_up";
+#bind ’C-k’ "pan_up";
+bind "Right" "pan_right";
+bind ’l’ "pan_right";
+bind "Down" "pan_down";
+bind ’j’ "pan_down";
+bind "Left" "pan_left";
+bind ’h’ "pan_left";
+bind ’ ’ "scrolldown";
+bind ’t’ "align ’top’;"; +
+bind ’C-g’ "system ’fbgrab +fim.png’";
+bind ’C-r’ "recording +’start’;";
+bind ’Q’ "recording +’stop’";
+bind ’D’ "recording +’dump’;";
+bind ’E’ "recording +’execute’;";
+bind ’C-e’ "recording +’execute’;";
+bind ’C-x’ "recording +’execute’;";
+bind ’.’ "recording +’repeat_last’;";
+bind ’’’ "toggleLimitMarked;"; +
+alias "toggleVerbosity" +"_display_console=1-_display_console;i:fresh=1;redisplay;" +"";
+alias "toggleKeyVerbosity" +"_verbose_keys=1-_verbose_keys;redisplay;" +"";
+alias "toggleDesaturate" +"_autodesaturate=1-_autodesaturate;redisplay;" +"";
+alias "idempotent_cmd" "goto +’+0p’;";
+#
+# autocommands are essential to Fim’s automated +behaviour
+# examples:
+#autocmd "PostInteractiveCommand" +"fim.png" "echo ’\nmatched an +interactive command on fim.png\n’;";
+#autocmd "PostDisplay" ".*png" +"echo ’this is a png file’;";
+#autocmd "PostDisplay" ".*jpg" +"echo ’this is a jpg file’;";
+#autocmd "PostDisplay" ".*gif" +"echo ’this is a gif file’;";
+#autocmd "PostDisplay" "" "echo +’\nthis is a file\n’";
+#autocmd "PostGoto" "" +"set_interactive_mode;";
+autocmd "PostGoto" "" +"reload;";
+#autocmd "PostGoto" "" +"load;";
+#autocmd "PostDisplay" "" +"i:fresh=1" ;
+#autocmd "PreWindow" "" ""; +
+autocmd "PostWindow" "" +"display;";
+autocmd "PreRedisplay" "" +"i:_will_display=1;";
+autocmd "PreRedisplay" "" +"if(_scale_style!=’’ && +i:fresh){i:fresh=0;scale _scale_style ;i:fresh=0;}"; +
+autocmd "PostRedisplay" "" +"i:_will_display=0;";
+# Display device specific config
+alias "aalib_fix_do" +"{if(aascale==’’){ascale=’2.0’;}else{ascale=aascale;} +i:fresh=1;display;if(_TERM=~’screen’){echo +’screen+aalib?expect binding problems!’}}" +"See aalib_fix.";
+alias "aalib_fix" +"if(_device_string==’aa’){aalib_fix_do;scale +’a’;}" "When using the aalib (ASCII +art) library we face a problem: glyph proportions are seldom +square (as pixels are), and are tricky to detect; for this +reason, we need to reshape the image with respect to the +font ratio, but we have to make a guess in the scaling +factor to compensate. If at runtime a better value is known +for the terminal font height/with ratio, it may be fed in +the ’aascale’ variable for an accurate +scaling.";
+#alias "exif_fix" +"i:_orientation=exif_orientation;exif_orientation=’’;i:mirrored=exif_mirrored;exif_mirrored=’’;i:flipped=exif_flipped;exif_flipped=’’;" +"";
+#autocmd "PostReload" "" +"aalib_fix;exif_fix;";
+#autocmd "PostLoad" "" +"aalib_fix;exif_fix;";
+autocmd "PostReload" "" +"aalib_fix;";
+autocmd "PostLoad" "" +"aalib_fix;";
+bind "F11" +"if(_device_string==’sdl’ && +!_fullscreen){_old_sw=_screen_width;_old_sh=_screen_height;display +’reinit’ ’MW0:0’;_fullscreen=1;}else +if(_device_string==’sdl’ && +_old_sw*_old_sh*_fullscreen){display ’reinit’ +’rwm’._old_sw.’:’._old_sh;_fullscreen=0;}";

+ +

autocmd +"PostReload" "" "i:fresh=1" ; +
+autocmd "PostScale" "" +"if(0==i:_will_display){i:fresh=1;display;}" ; +
+#autocmd "PostScale" "" +"{i:fresh=1;display;}" ;
+autocmd "PostPan" "" +"{i:fresh=1;display;}" ;
+autocmd "PostReload" "" +"if(i:fresh){redisplay;}";
+autocmd "PostInteractiveCommand" "" +"if(i:fresh){display;i:fresh=0;}";
+autocmd "PostInteractiveCommand" "" +"if(_want_prefetch){prefetch;}";
+autocmd "PostInteractiveCommand" "" +"if(_display_console==0 && +i:fresh){redisplay;i:fresh=0;}";
+autocmd "PostInteractiveCommand" "" +"idempotent_cmd;"; # Bug workaround: without it +console scroll is broken.

+ +

alias +"next10" +"i=0;while(i<10){i=i+1;next;display;sleep +’1’;};" "goes forward 10 images"; +
+bind ’N’ ’next10’;
+bind ’P’ ’prev10’;
+bind ’C-n’ "goto +’+//’";
+bind ’C-p’ "goto +’-//’";
+bind ’C-b’ "goto +’-//’"; # Warning: C-b cannot +be detected on many configurations.
+bind ’W’ "display +’resize’;" "if supported, resizes the +window to match the current image pixels size";
+bind ’C-w’ "scale +’100%’;display ’resize’;" +"if supported, scales the image to 100% and resizes the +window to match its size (if fits)";
+alias "endless_slideshow" +"while(1){display;sleep ’1’;next;};" +"performs an automated slideshow, endlessly";
+alias "bookview" "while(1){display;sleep +’2’;scrolldown;};" "";
+alias "comicview" "while(1){display;sleep +’1’;scrolldown;};" "";
+alias "read" "while(1){display;sleep +’1’;scrollforward;};" "";
+alias "slowread" "while(1){display;sleep +’2’;scrollforward;};" "";
+alias "fastread" +"while(1){display;scrollforward;};" ""; +
+alias "pornview" "echo ’press any key +repeatedly to terminate’ ;endless_slideshow;" +"";
+#bind "C-p" "pornview";
+#bind "C-b" "bookview";
+autocmd "PreExecutionCycle" +"/fbps-" +"_display_busy=0;_display_status=0;" ;
+autocmd "PreExecutionCycle" "" +"i:fresh=1;reload;";
+#autocmd "PreExecutionCycle" "" +"redisplay;";
+autocmd "PreExecutionCycle" +"/fbps-.*ps001.png" +"i:fresh=1;redisplay;";
+#autocmd "PostInteractiveCommand" "" +"i:fresh=0;";
+#autocmd "PostInteractiveCommand" "" +"prefetch;";
+bind ’*’ "scale ’100%’"; +
+bind ’w’ "scale ’w’";
+bind ’<’ "rotate10_ccw;display;"; +
+bind ’>’ "rotate10;display;";
+bind ’_’ "_scale_style=’’;scale +’100%’;";
+bind ’,’ "_display_console=1;echo +_last_system_output;";
+bind ’C-a’ +"if(_scale_style!=’a’){_scale_style=’a’;scale +’a’;}else{_scale_style=’’;scale +’100%’;}";
+#bind ’h’ "scale ’h’"; +
+#
+alias "pan_nw" "pan ’nw’;" +"pans the image to the upper left";
+alias "pan_ne" "pan ’ne’;" +"pans the image to the upper right";
+alias "pan_se" "pan ’se’;" +"pans the image to the lower left";
+alias "pan_sw" "pan ’sw’;" +"pans the image to the lower right";
+alias "pan_down" "pan +’down’;" "pans the image down"; +
+alias "pan_up" "pan ’up’;" +"pans the image up";
+alias "pan_left" "pan +’left’;" "pans the image left"; +
+alias "pan_right" "pan +’right’;" "pans the image right"; +
+#
+alias "diagonal_nw" "pan_nw;" "pans +the image to the upper left";
+alias "diagonal_ne" "pan_ne;" "pans +the image to the upper right";
+alias "diagonal_se" "pan_se;" "pans +the image to the lower left";
+alias "diagonal_sw" "pan_sw;" "pans +the image to the lower right";
+bind ’d’ "diagonal_nw;";
+bind ’D’ "diagonal_se;";
+bind ’x’ "diagonal_ne;";
+bind ’X’ "diagonal_sw;";
+alias "toggleDisplayStatus" +"_display_status=1-_display_status;" +"";
+alias "toggleDisplayBusy" +"_display_busy=1-_display_busy;" +"";
+alias "sort" "list ’sort’" +"sorts the files list ordered";
+#toggleVerbosity;
+#bind ’f’ "next;display;";
+#bind ’b’ "prev;display;";
+bind ’o’ "sort";
+bind ’b’ "prev;";
+bind ’B’ "toggleDisplayBusy";
+alias "random_slideshow" "while(1){goto +random;}" "performs a shuffled slideshow"; +
+alias "rotate90_ccw" +"i:_orientation=i:_orientation+3;i:fresh=1;i:fresh=1;redisplay;" +"";
+alias "rotate90_cw" +"i:_orientation=i:_orientation+1;i:fresh=1;i:fresh=1;redisplay;" +"";
+alias "rotate180" +"i:_orientation=i:_orientation+2;i:fresh=1;i:fresh=1;redisplay;" +"";
+alias "rotate90" "rotate90_cw;display;" +"";
+alias "rotate270" +"rotate90_ccw;display;" "";
+alias "rotate10" "rotate +’10’;display;" "";
+alias "rotate10_ccw" "rotate +-10;display;" "";

+ +

# window +related aliases and commands
+alias "wu" "window ’up’" +"selects the window upwards the current";
+alias "wd" "window ’down’" +"selects the window under the current";
+alias "wl" "window ’left’" +"selects the window at left of the current";
+alias "wr" "window ’right’" +"selects the window at right of the current";
+#bind ’K’ "wu";
+bind ’K’ ’if(_display_console==0){echo +i:_filename.": +".i:_comment;toggleVerbosity}else{toggleVerbosity;}’; +
+# Note : on many consoles C-j is by default equivalent +to Enter.. so this may not work :)
+#bind ’C-j’ "wd";
+#bind ’J’ "wd";
+#bind ’H’ "wl";
+#bind ’L’ "wr";
+#alias "split" "window +’split’" "split the current window +horizontally";
+#alias "vsplit" "window +’vsplit’" "split the current window +vertically";
+#alias "swap" "window +’swap’" "swap the enclosing window +subwindows";
+#alias "ws " "window ’swap’" +"see swap";
+#bind ’T’ "split;redisplay;";
+##don’t use C-s : it will be usually caught by +the console driver, and fim won’t get it!
+##bind ’C-s’ "split;";
+#bind ’V’ "vsplit;redisplay;";
+#bind ’U’ "swap;redisplay;";
+#alias ’venlarge’ ’window +"venlarge"’ "";
+#alias ’henlarge’ ’window +"henlarge"’ "";
+#alias ’wnormalize’ ’window +"normalize"’ "";
+#alias ’wclose’ ’window +"close"’ "";
+#alias ’wc’ ’window +"close"’ "closes the current +window";
+#bind ’C’ "wc;redisplay;";

+ +

alias +’cache’ ’echo _cache_status;’ +"displays cached images status";
+#bind ’c’ ’cache;’;
+bind ’c’ ’align +"center";’;
+alias ’widen’ +’i:ascale=i:ascale*"1.1";*1.0;’ +"widen the current image";
+alias ’narrow’ +’i:ascale=i:ascale/"1.1";*1.0;’ +"narrow the current image";
+alias ’contract’ ’narrow’;
+bind ’y’ "widen" "widens +horizontally the image";
+bind ’Y’ "narrow" "shrinks +horizontally the image";
+#alias ’scu’ ’scroll_console_up;’ +"";
+#alias ’scd’ ’scroll_console_down;’ +"";
+#alias ’console_scroll_up’ +’if(_console_offset<_console_lines){_console_offset=_console_offset+1;}’; +
+#alias ’console_scroll_down’ +’if(_console_offset>0){_console_offset=_console_offset-1;}’; +
+alias ’console_scroll_up’ +’if(_console_offset<_console_lines+console_scroll_n-_rows){_console_offset=_console_offset+console_scroll_n;}’; +
+alias ’console_scroll_down’ +’if(allow_round_scroll || +(_console_offset>=console_scroll_n)){_console_offset=_console_offset-console_scroll_n;}’; +
+alias ’console_scroll_reset’ +’{_console_offset=0;}’;
+alias ’scu’ ’console_scroll_up;’ +"";
+alias ’scd’ ’console_scroll_down;’ +"";
+alias ’scz’ ’console_scroll_reset;’ +"";
+alias ’center’ ’align +"center"’;
+alias ’left’ ’align +"left"’;
+alias ’right’ ’align +"right"’;
+alias ’top’ ’align "top"’; +
+alias ’bottom’ ’align +"bottom"’;
+bind "PageUp" +"if(_display_console==0){prev;}else{scu;}";
+bind "PageDown" +"if(_display_console==0){next;}else{scd;}";
+bind "Home" "0;";
+bind "End" "$;";
+bind "^" "0;";
+bind "$" "$;";
+bind "Backspace" "prev;";
+bind "’" "goto _lastfileindex"; +
+_display_status=1;
+_want_wm_caption_status="fim:%N@%p%%%L[%i/%l]"; +
+_info_fmt_str="%p%% %wx%h%L %i/%l%P %F %T %c"; +
+ +_display_status_fmt="%N%?EXIF_DateTimeOriginal?[%:EXIF_DateTimeOriginal:]?%?EXIF_ExposureTime?[%:EXIF_ExposureTime:]?%?EXIF_FNumber?[%:EXIF_FNumber:]?%?EXIF_ApertureValue?[%:EXIF_ApertureValue:]?%?EXIF_ISOSpeedRatings?[ISO%:EXIF_ISOSpeedRatings:]?:%k"; +
+#_display_status_fmt="%N:%k"; #
+#_use_exiftool=0;
+echo "WELCOME : to switch to the command line interface +press ’:’ ";
+# Some more examples:
+#alias "plisten" ’popen "nc -l +-p 9999 "’ "executes fim commands +coming from port 9999 on this computer";
+#alias "wlisten" +"while(1){sleep;plisten;}" "listen to a pipe, +endlessly";
+#alias "musicplay" "system ’mpc +play’" "";
+#alias "musicpause" "system ’mpc +pause’" "";
+#alias "rdjpgcom" ’system +"rdjpgcom" i:_filename’;
+# offsetscan usage : need a mechanism for popping all images +before.
+#alias "offsetscan" "while(i:width<1){list +’push’ +offimage;_open_offset=_open_offset+1;reload;}";
+#alias "offsetscan" "while(i:width<1){list +’push’ ’/home/dez/mostro.jpg’;stdout +_open_offset ;_open_offset=_open_offset+1;reload;}"; +
+#alias "webcam" "pread ’vgrabbj +-d /dev/video0’;";
+#alias "webcam_cycle" +"while(1){webcam;reload;sleep 1;};";
+#This is a FIM initialization file.
+#Without one of these FIM is nothing.
+#So feel free to modify it, but with caution!

+ +

NOTES + +

+ + +

This manual +page is incomplete: a number of topics, as type conversions, +or operator precedence, or exact command usage is left +unspecified. The conditions for autocommands triggering are +not specified as they should. A formal description of the +various one-line commands, as well a more extensive +example list is needed. Many of the listed variables are +only valid within a namespace, and this shall be documented +clearly.

+ +

BUGS + +

+ + +

The fim +language has a number of problems that shall be first +documented, then fixed.

+ +

SEE ALSO + +

+ + +

fim(1), +fimgs(1), regex(1).

+ +

AUTHOR + +

+ + +

Michele Martone +<dezperado _CUT_ autistici _CUT_ org>

+ +

COPYRIGHT + +

+ + +

See copyright +notice in fim(1).

+
+ + diff --git a/doc/vim2html.pl b/doc/vim2html.pl new file mode 100755 index 0000000..eac0f75 --- /dev/null +++ b/doc/vim2html.pl @@ -0,0 +1,231 @@ +#!/usr/bin/perl + +# converts vim documentation to simple html +# Sirtaj Singh Kang (taj@kde.org) + +# Sun Feb 24 14:49:17 CET 2002 + +# slightly modified by dez for using with fim, 20070501, 20160825, 20170617 + +use strict; +use vars qw/%url $date/; +use POSIX qw(strftime); + +%url = (); +$date = strftime("%Y-%m-%d", gmtime($ENV{SOURCE_DATE_EPOCH} || time)); + +sub maplink +{ + my $tag = shift; + if( exists $url{ $tag } ){ + return $url{ $tag }; + } else { + #warn "Unknown hyperlink target: $tag\n"; + $tag =~ s/\.TXT//; + $tag =~ s//>/g; + return "$tag"; + } +} + +sub readTagFile +{ + my($tagfile) = @_; + my( $tag, $file, $name ); + + open(TAGS,"$tagfile") || die "can't read tags\n"; + + while( ) { + next unless /^(\S+)\s+(\S+)\s+/; + + $tag = $1; + my $label = $tag; + ($file= $2) =~ s/.TXT$/.html/g; + $label =~ s/\.TXT//; + + $url{ $tag } = "".esctext($label).""; + } + close( TAGS ); +} + +sub esctext +{ + my $text = shift; + $text =~ s/&/&/g; + $text =~ s//>/g; + return $text; +} + +sub escurl +{ + my $url = shift; + $url =~ s/"/%22/g; + $url =~ s/~/%7E/g; + $url =~ s//%3E/g; + $url =~ s/=/%20/g; + $url =~ s/#/%23/g; + $url =~ s/\//%2F/g; + + return $url; +} + +sub vim2html +{ + my( $infile ) = @_; + my( $outfile ); + + open(IN, "$infile" ) || die "Couldn't read from $infile: $!.\n"; + + ($outfile = $infile) =~ s:.*/::g; + $outfile =~ s/\.TXT$//g; + + open( OUT, ">$outfile.html" ) + || die "Couldn't write to $outfile.html: $!.\n"; + my $head = uc( $outfile ); + + print OUT< + + +VIM: $outfile + + + +

$head

+
+EOF
+
+	my $inexample = 0;
+	while(  ) {
+		chop;
+		if ( /^\s*[-=]+\s*$/ ) {
+			print OUT "

";
+			next;
+		}
+
+		# examples
+		elsif( /^>$/ || /\s>$/ ) {
+			$inexample = 1;
+			chop;
+		}
+		elsif ( $inexample && /^([<\S])/ ) {
+			$inexample = 0;
+			$_ = $' if $1 eq "<";
+		}
+
+		s/\s+$//g;
+
+		# Various vim highlights. note that < and > have already been escaped
+		# so that HTML doesn't get screwed up.
+
+		my @out = ();
+		#		print "Text: $_\n";
+		LOOP:
+		foreach my $token ( split /((?:\|[^\|]+\|)|(?:\*[^\*]+\*))/ ) {
+			if ( $token =~ /^\|([^\|]+)\|/ ) {
+				# link
+				push( @out, "|".maplink( $1 )."|" );
+				next LOOP;
+			}
+			elsif ( $token =~ /^\*([^\*]+)\*/ ) {
+				# target
+				push( @out,
+					"\*".esctext($1)."<\/a>\*<\/b>");
+				next LOOP;
+			}
+
+			$_ = esctext($token);
+			s/CTRL-(\w+)/CTRL-$1<\/code>/g;
+			# parameter <...>
+			s/<(.*?)>/<$1><\/code>/g;
+
+			# parameter {...}
+			s/\{([^}]*)\}/{$1}<\/code>/g;
+
+			# parameter [...]
+			s/\[(range|line|count|offset|cmd|[-+]?num)\]/\[$1\]<\/code>/g;
+			# note
+			s/(Note:?)/$1<\/code>/gi;
+
+			# local heading
+			s/^(.*)\~$/$1<\/code>/g;
+			push( @out, $_ );
+		}
+
+		$_ = join( "", @out );
+
+		if( $inexample == 2 ) {
+			print OUT "$_\n";
+		} else {
+			print OUT $_,"\n";
+		}
+
+		$inexample = 2 if $inexample == 1;
+	}
+	print OUT<
+

Generated by vim2html on $date

+ + +EOF + +} + +sub usage +{ +die< +EOF +} + + + +sub writeCSS +{ + open( CSS, ">fim-stylesheet.css" ) || die "Couldn't write stylesheet: $!\n"; + print CSS<&2 + exit 1;; + esac + shift;; + + -o) chowncmd="$chownprog $2" + shift;; + + -s) stripcmd=$stripprog;; + + -t) dst_arg=$2 + # Protect names problematic for `test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + shift;; + + -T) no_target_directory=true;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac + shift +done + +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + # Protect names problematic for `test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + done +fi + +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call `install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +if test -z "$dir_arg"; then + do_exit='(exit $ret); exit $ret' + trap "ret=129; $do_exit" 1 + trap "ret=130; $do_exit" 2 + trap "ret=141; $do_exit" 13 + trap "ret=143; $do_exit" 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + +for src +do + # Protect names problematic for `test' and other utilities. + case $src in + -* | [=\(\)!]) src=./$src;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + else + + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dst_arg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + dst=$dst_arg + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dst=$dstdir/`basename "$src"` + dstdir_status=0 + else + # Prefer dirname, but fall back on a substitute if dirname fails. + dstdir=` + (dirname "$dst") 2>/dev/null || + expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$dst" : 'X\(//\)[^/]' \| \ + X"$dst" : 'X\(//\)$' \| \ + X"$dst" : 'X\(/\)' \| . 2>/dev/null || + echo X"$dst" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q' + ` + + test -d "$dstdir" + dstdir_status=$? + fi + fi + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # Create intermediate dirs using mode 755 as modified by the umask. + # This is like FreeBSD 'install' as of 1997-10-28. + umask=`umask` + case $stripcmd.$umask in + # Optimize common cases. + *[2367][2367]) mkdir_umask=$umask;; + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; + + *[0-7]) + mkdir_umask=`expr $umask + 22 \ + - $umask % 100 % 40 + $umask % 20 \ + - $umask % 10 % 4 + $umask % 2 + `;; + *) mkdir_umask=$umask,go-w;; + esac + + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + case $umask in + *[123567][0-7][0-7]) + # POSIX mkdir -p sets u+wx bits regardless of umask, which + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 + + if (umask $mkdir_umask && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writeable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + ls_ld_tmpdir=`ls -ld "$tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/d" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + fi + trap '' 0;; + esac;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # The umask is ridiculous, or mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix='/';; + [-=\(\)!]*) prefix='./';; + *) prefix='';; + esac + + eval "$initialize_posix_glob" + + oIFS=$IFS + IFS=/ + $posix_glob set -f + set fnord $dstdir + shift + $posix_glob set +f + IFS=$oIFS + + prefixes= + + for d + do + test X"$d" = X && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask=$mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + + eval "$initialize_posix_glob" && + $posix_glob set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + $posix_glob set +f && + + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd -f "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi +done + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/media/fim.png b/media/fim.png new file mode 100644 index 0000000..b7e2ec2 Binary files /dev/null and b/media/fim.png differ diff --git a/media/image.jpg b/media/image.jpg new file mode 100644 index 0000000..26591b1 Binary files /dev/null and b/media/image.jpg differ diff --git a/media/image.png b/media/image.png new file mode 100644 index 0000000..1e308fe Binary files /dev/null and b/media/image.png differ diff --git a/missing b/missing new file mode 100755 index 0000000..86a8fc3 --- /dev/null +++ b/missing @@ -0,0 +1,331 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. + +scriptversion=2012-01-06.13; # UTC + +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, +# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. +# Originally by Fran,cois Pinard , 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: +sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' +sed_minuso='s/.* -o \([^ ]*\).*/\1/p' + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +msg="missing on your system" + +case $1 in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + # Exit code 63 means version mismatch. This often happens + # when the user try to use an ancient version of a tool on + # a file that requires a minimum version. In this case we + # we should proceed has if the program had been absent, or + # if --run hadn't been passed. + if test $? = 63; then + run=: + msg="probably too old" + fi + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + autom4te touch the output file, or create a stub one + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + yacc create \`y.tab.[ch]', if possible, from existing .[ch] + +Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and +\`g' are ignored when checking the name. + +Send bug reports to ." + exit $? + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing $scriptversion (GNU Automake)" + exit $? + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + +esac + +# normalize program name to check for. +program=`echo "$1" | sed ' + s/^gnu-//; t + s/^gnu//; t + s/^g//; t'` + +# Now exit if we have it, but it failed. Also exit now if we +# don't have it and --version was passed (most likely to detect +# the program). This is about non-GNU programs, so use $1 not +# $program. +case $1 in + lex*|yacc*) + # Not GNU programs, they don't have --version. + ;; + + *) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + # Could not run --version or --help. This is probably someone + # running `$TOOL --version' or `$TOOL --help' to check whether + # $TOOL exists and not knowing $TOOL uses missing. + exit 1 + fi + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case $program in + aclocal*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case $f in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te*) + echo 1>&2 "\ +WARNING: \`$1' is needed, but is $msg. + You might have modified some files without having the + proper tools for further handling them. + You can get \`$1' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison*|yacc*) + echo 1>&2 "\ +WARNING: \`$1' $msg. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if test $# -ne 1; then + eval LASTARG=\${$#} + case $LASTARG in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if test ! -f y.tab.h; then + echo >y.tab.h + fi + if test ! -f y.tab.c; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex*|flex*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if test $# -ne 1; then + eval LASTARG=\${$#} + case $LASTARG in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if test ! -f lex.yy.c; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit $? + fi + ;; + + makeinfo*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + # The file to touch is that specified with -o ... + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -z "$file"; then + # ... or it is the one specified with @setfilename ... + infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n ' + /^@setfilename/{ + s/.* \([^ ]*\) *$/\1/ + p + q + }' $infile` + # ... or it is derived from the source name (dir/f.texi becomes f.info) + test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info + fi + # If the file does not exist, the user really needs makeinfo; + # let's fail without touching anything. + test -f $file || exit 1 + touch $file + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and is $msg. + You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequisites for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/scripts/Makefile.am b/scripts/Makefile.am new file mode 100644 index 0000000..152c163 --- /dev/null +++ b/scripts/Makefile.am @@ -0,0 +1,23 @@ +subdir = scripts + +AUTOMAKE_OPTIONS = nostdinc no-dependencies + +SUBDIRS = + +EXTRA_DIST= \ + $(srcdir)/tests/sanity.fim \ + $(srcdir)/tests/maxlenscript.fim \ + $(srcdir)/tests/version.sh \ + $(srcdir)/tests/font.sh \ + $(srcdir)/example/oneline.fim \ + $(srcdir)/rc/fimrc.eog \ + $(srcdir)/rc/fimrc.gqview \ + $(srcdir)/rc/fimrc.kuickshow \ + $(srcdir)/rc/fimrc.lazy \ + $(srcdir)/utilities/screenshot.sh \ + $(srcdir)/maintenance/configure-*.sh \ + $(srcdir)/maintenance/yacc2grammar.h \ + $(srcdir)/maintenance/yacc2grammar.awk \ + $(srcdir)/maintenance/htmlbody.awk \ + $(srcdir)/utilities/fimscan.sh + diff --git a/scripts/Makefile.in b/scripts/Makefile.in new file mode 100644 index 0000000..2914364 --- /dev/null +++ b/scripts/Makefile.in @@ -0,0 +1,620 @@ +# Makefile.in generated by automake 1.11.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +depcomp = +am__depfiles_maybe = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CAT = @CAT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONFIG_STATUS_DEPENDENCIES = @CONFIG_STATUS_DEPENDENCIES@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FIM_CONFIGURATION = @FIM_CONFIGURATION@ +FIM_CUSTOM_HARDCODED_CONSOLEFONT = @FIM_CUSTOM_HARDCODED_CONSOLEFONT@ +FIM_DEFS = @FIM_DEFS@ +FIM_LIBS = @FIM_LIBS@ +FIM_LIB_OBJECTS = @FIM_LIB_OBJECTS@ +FIM_SVN_REPOSITORY = @FIM_SVN_REPOSITORY@ +GREP = @GREP@ +HAVE_AWK = @HAVE_AWK@ +HAVE_BISON = @HAVE_BISON@ +HAVE_CAT = @HAVE_CAT@ +HAVE_CPP = @HAVE_CPP@ +HAVE_ECHO = @HAVE_ECHO@ +HAVE_FLEX = @HAVE_FLEX@ +HAVE_GREP = @HAVE_GREP@ +HAVE_MAN = @HAVE_MAN@ +HAVE_RM = @HAVE_RM@ +HAVE_SED = @HAVE_SED@ +HAVE_SORT = @HAVE_SORT@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBAA_CONFIG = @LIBAA_CONFIG@ +LIBDJVU = @LIBDJVU@ +LIBGIF = @LIBGIF@ +LIBJPEG = @LIBJPEG@ +LIBOBJS = @LIBOBJS@ +LIBPNG_CONFIG = @LIBPNG_CONFIG@ +LIBPOPPLER = @LIBPOPPLER@ +LIBPS = @LIBPS@ +LIBS = @LIBS@ +LIBSDL_CONFIG = @LIBSDL_CONFIG@ +LIBTIFF = @LIBTIFF@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MAN = @MAN@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POPPLER_CFLAGS = @POPPLER_CFLAGS@ +POPPLER_LIBS = @POPPLER_LIBS@ +RANLIB = @RANLIB@ +RM = @RM@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SORT = @SORT@ +STRIP = @STRIP@ +SVN_REVISION = @SVN_REVISION@ +SVN_REVISION_NUMBER = @SVN_REVISION_NUMBER@ +VERSION = @VERSION@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build_alias = @build_alias@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +fim_cv_version = @fim_cv_version@ +have_convert = @have_convert@ +have_dia = @have_dia@ +have_inkscape = @have_inkscape@ +have_xcftopnm = @have_xcftopnm@ +have_xfig = @have_xfig@ +have_zcat = @have_zcat@ +host_alias = @host_alias@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +subdir = scripts +AUTOMAKE_OPTIONS = nostdinc no-dependencies +SUBDIRS = +EXTRA_DIST = \ + $(srcdir)/tests/sanity.fim \ + $(srcdir)/tests/maxlenscript.fim \ + $(srcdir)/tests/version.sh \ + $(srcdir)/tests/font.sh \ + $(srcdir)/example/oneline.fim \ + $(srcdir)/rc/fimrc.eog \ + $(srcdir)/rc/fimrc.gqview \ + $(srcdir)/rc/fimrc.kuickshow \ + $(srcdir)/rc/fimrc.lazy \ + $(srcdir)/utilities/screenshot.sh \ + $(srcdir)/maintenance/configure-*.sh \ + $(srcdir)/maintenance/yacc2grammar.h \ + $(srcdir)/maintenance/yacc2grammar.awk \ + $(srcdir)/maintenance/htmlbody.awk \ + $(srcdir)/utilities/fimscan.sh + +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu scripts/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu scripts/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ + install-am install-strip tags-recursive + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic ctags \ + ctags-recursive distclean distclean-generic distclean-tags \ + distdir dvi dvi-am html html-am info info-am install \ + install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ + tags-recursive uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/scripts/example/oneline.fim b/scripts/example/oneline.fim new file mode 100644 index 0000000..cb36b41 --- /dev/null +++ b/scripts/example/oneline.fim @@ -0,0 +1,18 @@ +# jump to the third image: +3; +# jump to first image: +^; +# jump to last image: +$; +# magnify the image two times: +*2; +# scale the image to the 30% of the original: +30%; +# scale the image up by 30%: ++30%; +# scale the image down by 30%: +-30%; +# jump to the next image whose filename matches the ".*jpg" regular expression: +/.*jpg; +# executes the "date" system command +!"date"; diff --git a/scripts/maintenance/configure-brute-check.sh b/scripts/maintenance/configure-brute-check.sh new file mode 100755 index 0000000..e915851 --- /dev/null +++ b/scripts/maintenance/configure-brute-check.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +# this script brute-check for ./configure --enable.. and ./configure --disable.. options + +C=./configure +CH="$C --help=short" + +FAILED="" +OK="" +#CXXFLAGS="-O0" +CXXFLAGS="-pedantic -Wall" + +trap ' + +p "OK : $OK"; +p "FAILED : $FAILED"; +p "ALL : $ALL"' EXIT + +err() { echo "[!] $@" ; exit -1; } +p() { echo "[*] $@" ; } + +$CH || err "problems with $C" + +ALL=$( +for W in disable enable ; do +for S in `./configure --help=short | grep $W | grep -v "$W-[A-Z]" | sed 's/^\s*//g;s/\s\+.*//g'` ; do + echo -n " $S" +done +done +) +for S in $ALL +do + { $C $S && make clean && make CXXFLAGS=$CXXFLAGS && { OK="$OK $S" ; } } || { FAILED="$FAILED $S" ; } +done + diff --git a/scripts/maintenance/configure-live.sh b/scripts/maintenance/configure-live.sh new file mode 100755 index 0000000..b89f78a --- /dev/null +++ b/scripts/maintenance/configure-live.sh @@ -0,0 +1,6 @@ +#!/bin/sh +# Configure fim for a live system (that is, reading no configuration file at all, and writing out no history). +./configure --disable-fimrc --disable-history $@ || exit +make || exit +make tests || exit +scripts/maintenance/live-test.sh diff --git a/scripts/maintenance/configure-minimal.sh b/scripts/maintenance/configure-minimal.sh new file mode 100755 index 0000000..8ca7858 --- /dev/null +++ b/scripts/maintenance/configure-minimal.sh @@ -0,0 +1,9 @@ +#!/bin/sh +# Configure fim with minimal features allowing it to run in the framebuffer +./configure --disable-sdl --disable-fimrc --disable-history --disable-readline \ + --disable-xfig --disable-xcftopnm --disable-xfig --disable-convert \ + --disable-stdin-image-reading --disable-ps --disable-djvu \ + --disable-raw-bits-rendering "$@" || exit +make || exit +make tests || exit +scripts/maintenance/live-test.sh diff --git a/scripts/maintenance/configure-noscripting.sh b/scripts/maintenance/configure-noscripting.sh new file mode 100755 index 0000000..911c72a --- /dev/null +++ b/scripts/maintenance/configure-noscripting.sh @@ -0,0 +1,5 @@ +#!/bin/sh +# configure fim with scripting disabled (still incomplete, though) +./configure --disable-readline --disable-system --disable-autocommands --disable-windows --disable-scripting --disable-output-console $@ || exit +make || exit +make tests || exit diff --git a/scripts/maintenance/configure-only-fb-mini.sh b/scripts/maintenance/configure-only-fb-mini.sh new file mode 100755 index 0000000..b1f465c --- /dev/null +++ b/scripts/maintenance/configure-only-fb-mini.sh @@ -0,0 +1,6 @@ +#!/bin/sh +# Configure fim with minimal features, with no X +./configure --disable-sdl $@ || exit +make || exit +make tests || exit +#scripts/maintenance/live-test.sh diff --git a/scripts/maintenance/cron-build.sh.in b/scripts/maintenance/cron-build.sh.in new file mode 100755 index 0000000..67be50e --- /dev/null +++ b/scripts/maintenance/cron-build.sh.in @@ -0,0 +1,109 @@ +#!/bin/bash + +# This script is intended to work on machines connected through the +# internet to the fim subversion repository and willing to export/build +# and report in case of errors. + +# It should be run as a cron sheduled job. + +# You should set the FA (From Address), TA (To Address), and SH (Smtp Host) environment variables ... +#FA=user@host +#TA=user@host +#SH=smtp.host.tld + + +FIM_SVN_REPOSITORY=@FIM_SVN_REPOSITORY@ +TMPDIR=/tmp/ + +MS="fim build FAILURE report" +alias if_err='[ $? == 0 ] || ' +alias mail_stuff="mutt -F /dev/null -a autogen.log -a env.log -a make.log -a config.log -s $SUB $TA -e 'set from=$FA;set sendmail=\"msmtp -f $FA --host=$SH\"' < fim.log" + +alias check='if_err { svn info $REP >> fim.log ; mail_stuff ; }' +alias fail="return -1" + + +einfo() { echo -- "[!]" $@ ; } + +info() { echo -- "[*]" $@ ; } + +die() { einfo $@ ; exit -1; } + +get_fim() +{ + if test $HOSTNAME = chip ; then + cp -fR /home/dez/fim/ . + else + #svn co $FIM_SVN_REPOSITORY + svn --force export $FIM_SVN_REPOSITORY + fi +} + +autogen_error() +{ + # here should go automatic reporting of the failing configure.ac ... + einfo "please see the autogen.log file" +} + +configure_error() +{ + # here should go automatic reporting of the failing configure/config.log ... + einfo "please see the config.log file" +} + +make_error() +{ + # here should go automatic reporting of the failing make ... + einfo "please see the $MAKELOG file" +} + +date_ymd() { date +%Y%m%d ; } + +build_fim() +{ + CONFIGURE_OPTIONS="$1" + MAKELOG="make.`date_ymd`.log" + AUTOGENLOG="autogen.`date_ymd`.log" + LOG="fim.log" + SUB="[fim automated build] FAILURE on $HOSTNAME" + touch $MAKELOG || fail + touch $AUTOGENLOG || fail + rm -f $LOG || fail + touch $LOG || fail + ln $MAKELOG make.log + ln $AUTOGENLOG autogen.log + check + sh autogen.sh 2>&1 | tee $AUTOGENLOG + check + #|| autogen_error "error generating initial fim scripts" + ./configure $CONFIGURE_OPTIONS + check + #|| configure_error "error configuring fim" + make clean 2>&1 | tee $MAKELOG + check + #|| make_error "error in making clean fim" + make 2>&1 | tee $MAKELOG + check + SUB="[fim automated build] success on $HOSTNAME" + mail_stuff + #|| make_error "error making fim" +} + +[ -z "$FIM_SVN_REPOSITORY" ] && die "no fim repository specified ?" +[ -z "$TMPDIR" ] && die "no temporary directory specified ?" + + +true +cd $TMPDIR +if_err die "error stepping in $TMPDIR" +get_fim +if_err die "error getting fim sources" +cd fim/trunk +if_err die "error getting environment" +env > env.log +if_err die "error stepping in fim directory" +build_fim +if_err die "error building fim" +build_fim --enable-sdl --enable-aalib +if_err die "error building fim" + diff --git a/scripts/maintenance/cron-rsync.sh.in b/scripts/maintenance/cron-rsync.sh.in new file mode 100644 index 0000000..47b4bea --- /dev/null +++ b/scripts/maintenance/cron-rsync.sh.in @@ -0,0 +1,25 @@ +#!/bin/sh +# +# $Id: cron-rsync.sh.in 633 2014-11-16 22:13:14Z dezperado $ +# +# This script is intended to work on machines which I administer which are connected to the +# internet and which can take backups of fim, nightly and gently. +# +# It should be run as a cron sheduled job: +# +# e.g.: +# @daily /usr/bin/rsync -avz dezperado@code.autistici.org:/svn/fim/ /home/dez/backup/fim +# +# @daily cron-rsync.sh +# @daily FIM_BACKUPDIR=/var/backups/fim cron-rsync.sh +# @weekly FIM_REPUSER=antani FIM_BACKUPDIR=/var/backups/fim /usr/local/bin/cron-rsync.sh + +R=${FIM_REPURL:="http://@FIM_SVN_REPOSITORY@"}; +U=${FIM_REPUSER:="dezperado"} +BP=${FIM_BACKUPDIR:="/backups/fim"} +R=`echo $R | sed s/^http:..//g` +RSYNC="/usr/bin/rsync -avz" +C="$RSYNC $U@$R $BP" +echo "ok, let's backup using command $C" +echo $C || echo "failed backup : $C" + diff --git a/scripts/maintenance/cron-svndump.pl.in b/scripts/maintenance/cron-svndump.pl.in new file mode 100644 index 0000000..6e18c44 --- /dev/null +++ b/scripts/maintenance/cron-svndump.pl.in @@ -0,0 +1,31 @@ +#!/usr/bin/perl +# +# $Id: cron-svndump.pl.in 221 2009-02-26 21:23:28Z dezperado $ +# +# A dirty script to backup via 'svnadmin dump' the fim repository. +# I know this could be rewritten as a one liner. + +use POSIX qw(strftime); + +$R="@FIM_SVN_REPOSITORY@"; +($D,$H,@PA)=split(/:\/\/|\//,$R) or die "failed splitting of $R!\n"; +$P="/".join("/",@PA),"\n"; +$U="dezperado"; +$C="ssh $U\@$H svnadmin dump $P"; +print STDERR $C."\n"; +$D=`$C` or die "failed while $C ..\n" ; +#$D=""; +$DF="~/fim-svn-dump"; +open(FD,"+>",$DF) or die ; +#write(FD,$D); +print FD $D; +close(FD); +# we should need a better check .. +if( -z $DF or ! -f $DF ){ die "error while writing $FD! : refusing to continue\n";} +$WD=strftime "%a", localtime; +print STDERR "wrote successfully to $DF\n"; +$NF="$DF-$WD"; +print STDERR "will now rename $DF to $NF\n"; +rename $DF,$NF or die "error renaming $DF to $NF\n"; +print STDERR "ok, backup successful!\n"; + diff --git a/scripts/maintenance/htmlbody.awk b/scripts/maintenance/htmlbody.awk new file mode 100755 index 0000000..b4af4e2 --- /dev/null +++ b/scripts/maintenance/htmlbody.awk @@ -0,0 +1,9 @@ +#!/usr/bin/awk -f +# +# This program extracts the body of an HTML file. +# +BEGIN { sp=0 } +/^.\/\/ { sp=sp+1; } +/.*/ { if(sp==1){ gsub("−","-"); print; } } +/^.\/ { sp=sp+1; } + diff --git a/scripts/maintenance/remote-build.sh.in b/scripts/maintenance/remote-build.sh.in new file mode 100644 index 0000000..7026584 --- /dev/null +++ b/scripts/maintenance/remote-build.sh.in @@ -0,0 +1,28 @@ +#!/bin/bash +# $Id: remote-build.sh.in 221 2009-02-26 21:23:28Z dezperado $ +# This script is intended to test interactively a fim build on a remote machine. +# It should be run interactively while build and fixing. + +FD=@PACKAGE@-@VERSION@ +DF=$FD.tar.gz +UH= +RD= +alias fail="exit -1" +alias if_err='[ $? == 0 ] || ' + +[ -z "$FD" ] && { fail; } +[ -z "$UH" -a -z "$1" ] && { echo -e "usage: $0 user@host [directory]\n $DF will be copied and built there via ssh\n" ; fail ; } +[ -z "$UH" -a -n "$1" ] && { UH=$1 ; } +[ -z "$RD" -a -n "$2" ] && { RD=$2 ; } +MS="fim build FAILURE report" + +make dist +[ -f "$DF" ] || { fail; } +if_err fail +scp $DF $UH:$RD +if_err fail +ssh $UH "cd $RD && tar xzf $DF && cd $FD && ./configure && make" +if_err fail +ssh $UH "rm -fR $RD/$FD" +if_err fail + diff --git a/scripts/maintenance/yacc2grammar.awk b/scripts/maintenance/yacc2grammar.awk new file mode 100755 index 0000000..d898252 --- /dev/null +++ b/scripts/maintenance/yacc2grammar.awk @@ -0,0 +1,10 @@ +#!/usr/bin/awk -f +# +# This program prints out the Grammar section of a yacc.output file. +# +BEGIN { sp=0 } +/program:/ { sp=sp+1; } +/^Grammar/ { sp=sp+1; } +/^Terminals/ { sp=sp+1; } +#/.*/ { if(sp==3){ print; } } +/.*/ { if(sp==3){ gsub("^[ \t]*[0-9][0-9]*","\t"); print; } } diff --git a/scripts/maintenance/yacc2grammar.h b/scripts/maintenance/yacc2grammar.h new file mode 100644 index 0000000..52b721c --- /dev/null +++ b/scripts/maintenance/yacc2grammar.h @@ -0,0 +1,16 @@ +/* + This file translates some lex/yacc symbol labels in a literal form. +*/ +#define SYSTEM '|' +#define NOT '!' +#define GE '>=' +#define LE '<=' +#define EQ '==' +#define REGEXP_MATCH '=~' +#define NE '!=' +#define AND '&&' +#define OR '||' +#define WHILE 'while' +#define IF 'if' +#define ELSE 'else' +#define DO 'do' diff --git a/scripts/rc/fimrc.eog b/scripts/rc/fimrc.eog new file mode 100644 index 0000000..f3ed550 --- /dev/null +++ b/scripts/rc/fimrc.eog @@ -0,0 +1,16 @@ +# eog like configuration file for fim +# copy this file to ~/.fimrc to have eog keyboard shortcuts in fim +# NOTE: it is not complete + +bind "PageUp" "prev;"; +bind "PageDown" "next;"; +bind "Home" "0;"; +bind "End" "$;"; +# rotate by 90 degrees : +# bind 'r' ... +bind 'C-0' "100%;"; +bind 'C-+' "magnify"; +bind 'C--' "reduce"; +bind '+' "magnify"; +bind '-' "reduce"; + diff --git a/scripts/rc/fimrc.gqview b/scripts/rc/fimrc.gqview new file mode 100644 index 0000000..4b7fa68 --- /dev/null +++ b/scripts/rc/fimrc.gqview @@ -0,0 +1,138 @@ +# gqview like configuration file for fim, according to http://gqview.sourceforge.net/docs/11_2_keyboard_shortcuts.html +# copy this file to ~/.fimrc to have gqview keyboard shortcuts in fim +# NOTE: it is not complete + +# Image Navigation + +# PageDown Left Click on image view Mouse Wheel down (*) Change to next image. +bind "PageUp" "next;"; +# PageUp Middle Click on image view Mouse Wheel up (*) Change to previous image. +bind "PageDown" "prev;"; +# Home Change to first image. +bind "Home" "0;"; +# End Change to last image. +bind "End" "$;"; + +# Image panning (image has keyboard focus) + +# Arrow Keys Left Drag on image view [Shift] + Mouse Wheel (*) Pan image. +bind "Up" "panup"; +bind "Right" "panright"; +bind "Down" "pandown"; +bind "Left" "panleft"; +# [Shift] + Arrow Keys Pan Image faster. +# [Control] + Arrow Keys Pan to respective edge of image. +# SpaceBar Change to next image. +bind "Space" "next"; +# Backspace Change to previous image. +bind "Backspace" "prev"; + +# File Menu + +# [Control] + N New Window +# C Open a new empty collection window. +# O Display open collection dialog. +# F3 Open new search window. +# D Open new Find Duplicates window. +# [Shift] + P Open print dialog. +# [Control] + F Create new folder in current path. +# [Control] + C Copy selected images, opens destination selection dialog. +# [Control] + M Move selected images, opens destination selection dialog. +# [Control] + R Rename selected images, opens rename dialog. +# [Control] + D [Delete] Delete selected images. +# [Control] + W Close window, GQview exits when last window is closed. +# [Control] + Q Quit GQview. +bind('C-q',"quit"); + +# Edit Menu +# [Control] + 1 ... 0 Run external edit command on selected images. +# [Control] + A Select all images. +# [Control] + [Shift] + A Unselect all images. +# [Control] + P Open image properties window. +# [Control] + O Open GQview preferences window. +# ] Rotate image clockwise 90 degrees. +# [ Rotate image counterclockwise 90 degree. +# [Shift] + R Rotate image 180 degrees. +# [Shift] + M Flip image horizontally (mirror). +# [Shift] + F Flip image vertically. +# View Menu + +# +, = [Control] + Mouse Wheel up Zoom image in. +# - [Control + Mouse Wheel down Zoom image out. +# Z Reset zoom to original size (1:1). +bind 'z' "auto_scale;"; +# X Fit image to window size. +# W Zoom image to fit window width. +bind 'w' "auto_width_scale"; +# H Zoom image to fit window height. +bind 'h' "auto_height_scale"; +# 1 Set zoom to 1:1 +bind '1' "100%;"; +# 2 Set zoom to 2:1 +bind '2' "200%;"; +# 3 Set zoom to 3:1 +bind '3' "300%;"; +# 4 Set zoom to 4:1 +bind '4' "400%;"; +# 7 Set zoom to 1:4 +bind '7' "25%;"; +# 8 Set zoom to 1:3 +bind '8' "33%;"; +# 9 Set zoom to 1:2 +bind '9' "50%;"; +# T Toggle display of thumbnails when in list view. + +# [Control] + L Display file list as detailed list view. +# [Control] + I Display file list as icon view. +# [Control] + T Toggle folder display between list and tree views. +# R Refresh file list. +# L Toggle floating of file display. +# [Control] + H Toggle hiding of file display. +# [Control] + E Toggle EXIF sidebar. +# [Control] + S Toggle Sort Manager sidebar. +# [Control] + K Toggle Keywords sidebar. +# F V Toggle full screen. +# I Toggle information overlay in full screen. +# S Toggle slideshow. +# P Toggle pause of slideshow. + +# Help Menu +# F1 Open User Manual in browser. + +# Collection Window +# Arrow Keys Move selection. +# [Shift] + Arrow Keys Select multiple images. +# [Control] + Arrow Keys Move focus without changing selection. +# [SpaceBar] Select only image with focus. +# [Control] + [SpaceBar] Toggle selection of image with focus. +# [Home] Move focus to first image. +# [End] Move focus to last image. +# [Control] + A Select all images. +# [Control] + [Shift] + A Unselect all images. +# [Delete] Remove selected image from collection, does not delete image from disk. +# [Control] + L Add images from main window's file list. +# [Control] + T Toggle display of icon filenames. +# N Sort collection by name. +# D Sort collection by file date. +# B Sort collection by file size. +# P Sort collection by file path. +# I Sort collection by natural numerical order. +# [Enter] View image with focus in main window. +# V View image with focus in new window. +# [Control] + 1 ... 0 Run external edit command on selected images. +# S Save collection. +# [Control] + S Save collection as, opens destination dialog. +# A Append to collection, opens append dialog. +# [Control] + C Copy selected images, opens destination selection dialog. +# [Control] + M Move selected images, opens destination selection dialog. +# [Control] + R Rename selected images, opens rename dialog. +# [Control] + D Delete selected images. +# [Control] + P Open image properties window. +# [Control] + W Close collection window. + +# Find Duplicates Window (same as Collection Window above, with the following additions) + +# 1 Select group 1 duplicates. +# 2 Select group 2 duplicates. +# C Open new collection window and add selected images. + diff --git a/scripts/rc/fimrc.kuickshow b/scripts/rc/fimrc.kuickshow new file mode 100644 index 0000000..cfdb35e --- /dev/null +++ b/scripts/rc/fimrc.kuickshow @@ -0,0 +1,12 @@ +# kuickshow like configuration file for fim +# copy this file to ~/.fimrc to have kuickshow keyboard shortcuts in fim +# NOTE: it is not complete + +bind "PageUp" "prev;"; +bind "PageDown" "next;"; +bind 'o' "100%;"; +bind 'w' "auto_width_scale"; +bind '+' "magnify"; +bind '-' "reduce"; + +# missing : flipping and rotation, gamma, contrast, file editing ... diff --git a/scripts/rc/fimrc.lazy b/scripts/rc/fimrc.lazy new file mode 100644 index 0000000..74ceed4 --- /dev/null +++ b/scripts/rc/fimrc.lazy @@ -0,0 +1,28 @@ +# this is a sample fim configuration file (fimrc) +# +# this fimrc provides an example of simple and light lazy bound configuration + +autocmd_del "" "" ""; +autocmd "PostGoto" "" "load;"; +autocmd "PostNext" "" "load;"; +autocmd "PostPrev" "" "load;"; + +autocmd "PostLoad" "" "aalib_fix;"; + +autocmd "PostLoad" ".*/fbps-.*" "{auto_width_scale;;}"; +autocmd "PostLoad" "" "if(autowidth){auto_width_scale;}"; +autocmd "PostLoad" "" "if(v:auto_scale_v ){auto_scale;}"; +autocmd "PostLoad" "" "if(auto_width_v ){auto_scale_width ;}"; +autocmd "PostLoad" "" "if(auto_height_v){auto_scale_height;}"; + +autocmd "PostInteractiveCommand" "" "display;"; + +autocmd "PreExecutionCycle" "/fbps-" "_display_busy=0;_display_status=0;" ; +autocmd "PreExecutionCycle" "" "reload;"; +autocmd "PreExecutionCycle" "" "redisplay;"; + + +bind 'n' "next;"; +bind 'p' "prev;"; +bind 'b' "prev;"; + diff --git a/scripts/tests/font.sh b/scripts/tests/font.sh new file mode 100755 index 0000000..4c8d58d --- /dev/null +++ b/scripts/tests/font.sh @@ -0,0 +1,49 @@ +#!/bin/sh + +# tests font functionality in fim +# this script shall work whatever its configure options (even if fim was compiled 'dumb') + +f=src/fim +if test x != "$top_srcdir"; then true ; else top_srcdir=./ ; fi +ff="$top_srcdir/media/fim.png media/icon_smile.gif" +fa="-c quit $ff " +fv="-V " + +fail() +{ + echo "[!] $@"; + exit -1; +} + +resign() +{ + echo "[~] $@"; + exit 0; +} +succeed() +{ + echo "[*] $@"; + exit 0; +} + +which grep || fail "we don't go anywhere without grep in our pocket" +g="`which grep` -i" + +export FBFONT='' +e='s/^.*://g' + +POD='\(sdl\|fb\|imlib2\)' +$f $fv 2>&1 | $g -i 'supported output devices.*:' | $g "$POD"|| resign "missing a pixel oriented driver (as one of $POD)" +$f $fv 2>&1 | $g 'supported file formats:' | $g '\(png\|gif\)' | resign "missing adequate file format support" + +export FBFONT=/dev/null +if $f $fa ; then fail "$f $fa does not fail as it should on wrong font file" ; +else echo "$f $fa correctly recognizes an invalid FBFONT variable and exits" ; fi + +export FBFONT=$top_srcdir/var/fonts/Lat15-Terminus16.psf +if ! $f $fa ; then fail "$f $fa fails, but it should not, as a correct font was provided" ; +else echo "$f $fa correctly recognizes a valid font file" ; fi + +succeed "Font environment variables check PASSED" +exit 0 + diff --git a/scripts/tests/maxlenscript.fim b/scripts/tests/maxlenscript.fim new file mode 100644 index 0000000..c6eed51 --- /dev/null +++ b/scripts/tests/maxlenscript.fim @@ -0,0 +1,65402 @@ +# adding one byte to this script will prevent fim from executing it (somewhere in fim there is a hidden 65535 byte limit..). +return 0; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/scripts/tests/sanity.fim b/scripts/tests/sanity.fim new file mode 100755 index 0000000..2d9dd34 --- /dev/null +++ b/scripts/tests/sanity.fim @@ -0,0 +1,145 @@ +#!/usr/local/bin/fim -E + +# $Id: sanity.fim 203 2009-01-10 11:13:17Z dezperado $ + +# this script is going to be replaced, or regenerated, from the tests contained in src/testdir. + +#!/usr/local/bin/fim -t -E +#!/usr/local/bin/fim --no-framebuffer -E +#!/usr/bin/env fim -E + +# +# This script tests the Fim language correctness. +# It is used during Fim maintenance, debugging, and developement. +# +# Fim should execute this script and return 0 if all tests pass. +# + +if ( 1 ) { echo "if construct seems working"; } +else { echo "if construct seems not working"; } + +if ( 0 ) { echo "if construct seems not working"; } +else { echo "if construct seems working"; } + +if ( 0 == 0 ) { echo "equality works"; } +else { echo "equality does not work"; return -1; } + +if ( 0 != 1 ) { echo "disequality works"; } +else { echo "disequality does not work"; return -1; } + +if ( 40 == 50-10 ) { echo "basic integer arithmetics works"; } +else { echo "basic integer arithmetics does not work"; return -1; } + +if ( 41 != 50-10 ) { echo "basic integer arithmetics works"; } +else { echo "basic integer arithmetics does not work"; return -1; } + +iv=1; + +if ( iv ) { echo "integer variables work"; } +else { echo "integer variables don't work"; return -1; } + +iv=0; + +if ( !iv ) { echo "integer variables work"; } +else { echo "integer variables don't work"; return -1; } + +if ( !!iv ) { echo "integer variables don't work"; return -1; } +else { echo "integer variables work"; } + +if ( !!!iv ) { echo "integer variables work"; } +else { echo "integer variables don't work"; return -1; } + +if ( iv == 0 ) { echo "integer variables work"; } +else { echo "integer variables don't work"; return -1; } + +if ( iv == 3*iv-2*iv ) { echo "integer variables work"; } +else { echo "integer variables don't work"; return -1; } + +if ( iv != 3*iv-2*iv ) { echo "integer variables don't work"; return -1; } +else { echo "integer variables work"; } + +if ( iv != iv ) { echo "integer variables don't work"; return -1; } +else { echo "integer variables work"; } + +# Like in Vim, the following form is not correct for an arithmetic assignment: +# fv=2.0; +# The next one is the correct one: +fv="2.0"; + +if ( fv ) { echo "float variables work"; } +else { echo "float variables don't work"; return -1; } + +if ( !fv ) { echo "float variables don't work"; return -1; } +else { echo "float variables work"; } + +if ( !!fv ) { echo "float variables work"; } +else { echo "float variables don't work"; return -1; } + +if ( !!!fv ) { echo "float variables don't work"; return -1; } +else { echo "float variables work"; } + +if ( fv == "0.0" ) { echo "float variables don't work"; return -1; } +else { echo "float variables work"; } + +if ( ! ( fv != "0.0" ) ) { echo "float variables don't work"; return -1; } +else { echo "float variables work"; } + +if ( !!! ( fv != "0.0" ) ) { echo "float variables don't work"; return -1; } +else { echo "float variables work"; } + +if ( !! ( fv == "0.0" ) ) { echo "float variables don't work"; return -1; } +else { echo "float variables work"; } + +if ( fv == "2.0" ) { echo "float variables work"; } +else { echo "float variables don't work"; return -1; } + +if ( fv != "3.0" ) { echo "float variables work"; } +else { echo "float variables don't work"; return -1; } + +echo "tab works"; +echo + "newline works"; + +if +( 1==1 ) +{ + echo "multiline" " and multiarg constructs ". + "work" +} +else { return -1; } + +if( "aba"."a"=="a"."ba"."a" ){echo "string collation works";} +else {echo "string collation does not work"; return -1;} + +if( "aba"!="a"."sba"."a" ){echo "string collation works";} +else {echo "string collation does not work"; return -1;} + +if( "aba"=~"a.*a" ){echo "regular expressions work";} +else {echo "regular expressions does not work"; return -1;} + +if( !("aba"=~"a.*a") ) {echo "single negations on regular expressions does not work"; return -1;} +else {echo "single negations on regular expressions work";} + +# the following doesn't work in fim 0.3. +if( !(!("aba"=~"a.*a")) ){echo "double negations on regular expressions work";} +else {echo "double negations on regular expressions does not work"; } + +a=1; +{a=5} +if( a==5 ){echo "{command} constructs work";} +else {echo "{command} constructs don't work";} + +{a=10;} +if( a==10 ){echo "{command;} constructs work";} +else {echo "{command;} constructs don't work";} + +#the following does not work +#{a=20;;} + +if( a==20 ){echo "{command;;} constructs work";} +else {echo "{command;;} constructs don't work";} + + +rc=0; +return rc; + diff --git a/scripts/tests/version.sh b/scripts/tests/version.sh new file mode 100755 index 0000000..334e99f --- /dev/null +++ b/scripts/tests/version.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +# tests the -V switch in fim +# TODO : should be integrated in the vim-like test suite. + +f=src/fim + +fail() +{ + echo "[!] $@"; + exit -1; +} +succeed() +{ + echo "[*] $@"; + exit 0; +} + + +which grep || fail "we don't go anywhere without grep in our pocket" +g="`which grep` -i" + +# -V should return 0 +$f -V 2>&1 > /dev/null || fail "$f -V returns an incorrect code" + +e='s/^.*://g' + +for s in 'supported output devices' 'supported file formats' +do + $f -V 2>&1 | $g "$s" || fail "need the $s info message!" + [ -z "`$f -V 2>&1 | $g \"$s\" | sed \"$e\"`" ] && fail "no $s ?" +done +succeed "Version string check based test PASSED" + +exit 0 + diff --git a/scripts/utilities/fimscan.sh b/scripts/utilities/fimscan.sh new file mode 100755 index 0000000..4a21467 --- /dev/null +++ b/scripts/utilities/fimscan.sh @@ -0,0 +1,51 @@ +#!/bin/sh + +# This sample scripts shows the use of fim for assisted batch scanning in a X free environment. + +function die() { echo " [!] : " $@ ; exit 1 ; } +function info() { echo " [*] : " $@ ; } +function askn() { local c ; c='' ; info $@ ; read c ; if test "$c" != "y" -a "$c" != "Y" ; then return -1 ; fi ; return 0 ; } +function asky() { local c ; c='' ; info $@ ; read c ; if test "$c" != "n" -a "$c" != "N" ; then return 0 ; fi ; return -1 ; } +function askexit() { asky "are you sure you want to exit [Y/n]?" || return 0 ; info "ok. exiting now..." ; exit ; } + +[[ $1 != "" ]] && { info "this is a sample script using fim and scanimage... invoke it without arguments please." ; exit ; } + +shopt -s expand_aliases || die "no aliases ? you should update your bash shell.." +scanimage --version 2>&1 > /dev/null || die "no scanimage ?" + +GEOMETRY=' -l0mm -t0mm -x210mm -y300mm' +LODEPTH='--depth 1' +HIDEPTH='--depth 32' +HIRES='--resolution 200' +LORES='--resolution 20' +FORMAT='--format=tiff' +FORMAT= +alias scan.a4='scanimage $GEOMETRY $HIDEPTH $HIRES $FORMAT' +alias scan.lo='scanimage $GEOMETRY $LODEPTH $LORES $FORMAT' +alias scan='scan.a4' + +alias filter_bugged_scanimage_pnm="grep -v 'scanimage.*backend'" + +DIR="${TMPDIR-/var/tmp}/fbscan-$$" +TF=$DIR/scan.fim.tmp + +# we must have write permissions in that directory +mkdir -p $DIR || exit 1 + +# we want that directory clean after this script execution, no matter what happens +trap "rm -rf $DIR" EXIT + +i=1; +FN=`printf "scan-%004d.pnm" "$i"` + +while ! askn "do you to wish start scanning ? we begin with $FN [y/N]" ; do askexit ; done + +for ((i=1;i<100;i+=0)) +do + info "scanning $FN..." + scan.lo | filter_bugged_scanimage_pnm | fim -i -c 'bind "y" "return 0;";bind "n" "return -1;";status "press y to scan this image in high resolution. press n otherwise."' && scan.hi > $FN + if test "$?" = "0" ; then ((++i)) ; fi + FN=`printf "scan-%004d.pnm" "$i"` + while ! askn "do you wish to continue scanning ? we continue with $FN [y/N]" ; do askexit ; done +done + diff --git a/scripts/utilities/screenshot.sh b/scripts/utilities/screenshot.sh new file mode 100644 index 0000000..faea765 --- /dev/null +++ b/scripts/utilities/screenshot.sh @@ -0,0 +1,46 @@ +#!/bin/sh +# +# $Id: screenshot.sh 213 2009-02-21 01:15:08Z dezperado $ +# this script invokes fim to perform a screenshot of itself +# +# needs: fbgrab, convert, aa-enabled fim + +FIM=src/fim + +BFCMD="alias \"toggleVerbosity\" \"_display_console=1-_display_console;i:fresh=1;\"; +toggleVerbosity; +load; +echo \"we type \\\"help\\\":\"; +help; +echo \"we type \\\"commands\\\":\"; +commands; +redisplay; +split; +window 'down'; +vsplit; +auto_width_scale; +auto_width_scale; +display; +redisplay; +window 'right'; +auto_height_scale; +rotate '34'; +redisplay; +" + +EFCMD='!"fbgrab fim-shot-aa.png";quit;' +$FIM -o aa -c "$BFCMD$EFCMD" media/*png +EFCMD='!"fbgrab fim-shot-fb.png";quit;' +$FIM -v -c "$BFCMD$EFCMD" media/*png + +# let's see +#$FIM fim-shot-fb.png fim-shot-aa.png +# fim-shot-fb.png +SZ='400x300' +CA="-depth 3 -resize $SZ" + +convert fim-shot-aa.png $CA fim-shot-aa-mini.png +convert fim-shot-fb.png $CA fim-shot-fb-mini.png + +$FIM fim-shot-aa-mini.png fim-shot-fb-mini.png + diff --git a/src/AADevice.cpp b/src/AADevice.cpp new file mode 100644 index 0000000..863b939 --- /dev/null +++ b/src/AADevice.cpp @@ -0,0 +1,675 @@ +/* $LastChangedDate: 2016-09-15 17:21:32 +0200 (Thu, 15 Sep 2016) $ */ +/* + AADevice.cpp : aalib device Fim driver file + + (c) 2008-2016 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "fim.h" + +#ifdef FIM_WITH_AALIB + +#include "AADevice.h" +#include + +#define FIM_AA_MINWIDTH 2 +#define FIM_AA_MINHEIGHT 2 +/* + FIXME : aalib has two resolutions : an input one, and a screen one. + this is not well handled by our code, as we expect a 1:1 mapping. + */ +#define min(x,y) ((x)<(y)?(x):(y)) +typedef char fim_aa_char; /* a type for aalib chars */ + +static bool aainvalid; + + template + fim_err_t AADevice::clear_rect_( + void* dst, // destination gray array and source rgb array + fim_coo_t oroff,fim_coo_t ocoff, // row and column offset of the first output pixel + fim_coo_t orows,fim_coo_t ocols, // rows and columns drawable in the output buffer + fim_coo_t ocskip // output columns to skip for each line + ) + { + /* output screen variables */ + fim_byte_t PIXELVAL = (fim_byte_t) PIXELCOL; + fim_coo_t + oi,// output image row index + oj;// output image columns index + fim_coo_t lor,loc; + + if( oroff <0 ) return -8; + if( ocoff <0 ) return -9; + if( orows <=0 ) return -10; + if( ocols <=0 ) return -11; + if( ocskip<0 ) return -12; + + if( oroff>orows ) return -8-10*100; + if( ocoff>ocols ) return -9-11*100; + + if( ocskipirows ) return -3-4*100 ; + if( icoff>icols ) return -4-6*100; + if( oroff>orows ) return -8-10*100; + if( ocoff>ocols ) return -9-11*100; + + if( icskipdata:FIM_NULL;// source rgb array + if ( !rgb ) return FIM_ERR_GENERIC; + + if( iroff <0 ) return -2; + if( icoff <0 ) return -3; + if( irows <=0 ) return -4; + if( icols <=0 ) return -5; + if( icskip<0 ) return -6; + if( oroff <0 ) return -7; + if( ocoff <0 ) return -8; + if( orows <=0 ) return -9; + if( ocols <=0 ) return -10; + if( ocskip<0 ) return -11; + if( flags <0 ) return -12; + + if( iroff>irows ) return -2-3*100 ; + if( icoff>icols ) return -3-5*100; +// if( oroff>orows ) return -7-9*100;//EXP +// if( ocoff>ocols ) return -8-10*100;//EXP + if( oroff>height() ) return -7-9*100;//EXP + if( ocoff>width()) return -8-10*100;//EXP + + if( icskip height() ) return -9 -99*100; + if( ocols > width() ) return -10-99*100; + if( ocskip < width() ) return -11-99*100; + if( icskip( aa_image(ascii_context_), oroff,ocoff, oroff+orows,ocoff+ocols, ocskip); + + // cout << iroff << " " << icoff << " " << irows << " " << icols << " " << icskip << "\n"; +/* cout << oroff << " " << ocoff << " " << orows << " " << ocols << " " << ocskip << "\n"; + cout << " aa_scrwidth(ascii_context_):" << aa_scrwidth(ascii_context_) << " "; + cout << "aa_scrheight(ascii_context_):" <0) ascii_hwparms_.width = v-1; +// if((e=getenv("LINES" ))!=FIM_NULL && (v=fim_atoi(e))>0) ascii_hwparms_.height = v-1; +// if((e=getenv("COLUMNS"))!=FIM_NULL && (v=fim_atoi(e))>0) ascii_hwparms_.recwidth = v; +// if((e=getenv("LINES" ))!=FIM_NULL && (v=fim_atoi(e))>0) ascii_hwparms_.recheight = v; + +// ascii_hwparms_.width = 80; +// ascii_hwparms_.height = 56; +// +// ascii_hwparms_.width = 128-1; +// ascii_hwparms_.height = 48 -1; + + /*ascii_hwparms_.width() = 4; + ascii_hwparms_.height() = 4;*/ + + name_[0] = FIM_SYM_CHAR_NUL; + name_[1] = FIM_SYM_CHAR_NUL; + if(allow_windowed==0) + setenv(FIM_ENV_DISPLAY,"",1); /* running fim -o aalib in a window may render fim unusable */ + ascii_save_.name = (fim_aa_char*)name_; + ascii_save_.format = &aa_text_format; + ascii_save_.file = FIM_NULL; +// ascii_context_ = aa_init (&save_d, &ascii_hwparms_, &ascii_save_); + ascii_context_ = aa_autoinit (&ascii_hwparms_); + if(!ascii_context_) + { + std::cout << "problem initializing aalib!\n"; + return FIM_ERR_GENERIC; + } + if(!aa_autoinitkbd(ascii_context_, 0)) + { + std::cout << "problem initializing aalib keyboard!\n"; + return FIM_ERR_GENERIC; + } + /*if(!aa_autoinitmouse(ascii_context_, 0)) + { + std::cout << "problem initializing aalib mouse!\n"; + return FIM_ERR_GENERIC; + }*/ + aa_hidecursor (ascii_context_); + +#if 0 + /* won't help in the ill X11-windowed aalib shipped with many distros case */ + sym_keys["Left" ]=AA_LEFT; + sym_keys["Right"]=AA_RIGHT; + sym_keys["Up" ]=AA_UP; + sym_keys["Down" ]=AA_DOWN; + sym_keys["Esc" ]=AA_ESC; +#endif + + /* The mulx and muly are not reliable */ +#if 0 + if(ascii_context_->mulx>0 && ascii_context_->muly>0) + cc.setVariable("aascale",(((fim_scale_t)ascii_context_->muly)/((fim_scale_t)ascii_context_->mulx))); + cc.setVariable("aamuly",((fim_int)(ascii_context_->muly))); + cc.setVariable("aamulx",((fim_int)(ascii_context_->mulx))); +#endif + return FIM_ERR_NO_ERROR; + } + + void AADevice::finalize(void) + { + finalized_=true; + aa_close(ascii_context_); + } + int AADevice::get_chars_per_line(){return aa_scrwidth(ascii_context_);} + int AADevice::get_chars_per_column(){return aa_scrheight(ascii_context_);} + fim_coo_t AADevice::txt_width() { return aa_scrwidth(ascii_context_ ) ;} + fim_coo_t AADevice::txt_height(){ return aa_scrheight(ascii_context_) ;} + fim_coo_t AADevice::width() { return aa_imgwidth(ascii_context_ ) ;} + fim_coo_t AADevice::height(){ return aa_imgheight(ascii_context_) ;} + + fim_err_t AADevice::init_console(void) + { +#ifndef FIM_WANT_NO_OUTPUT_CONSOLE + //mc_.setRows ( -height()/2); + mc_.setRows ( get_chars_per_column()/2 ); + mc_.reformat( txt_width() ); +#endif /* FIM_WANT_NO_OUTPUT_CONSOLE */ + return FIM_ERR_NO_ERROR; + } + + fim_err_t AADevice::fs_puts(struct fs_font *f, fim_coo_t x, fim_coo_t y, const fim_char_t *str) + { +#if (!FIM_AALIB_DRIVER_DEBUG) + aa_puts(ascii_context_,x,y, + //AA_REVERSE, + AA_NORMAL, + //AA_SPECIAL, + (const fim_aa_char*)str); +#endif /* FIM_AALIB_DRIVER_DEBUG */ + return FIM_ERR_NO_ERROR; + } + + void AADevice::flush(void) + { + aa_flush(ascii_context_); + } + + fim_err_t AADevice::clear_rect(fim_coo_t x1, fim_coo_t x2, fim_coo_t y1, fim_coo_t y2) + { + /* FIXME : only if initialized ! + * TODO : define the exact conditions to use this member function + * */ + + return clear_rect_(aa_image(ascii_context_),y1, x1, y2-y1+1, x2-x1+1,aa_imgwidth(ascii_context_)); + } + + fim_err_t AADevice::fill_rect(fim_coo_t x1, fim_coo_t x2, fim_coo_t y1,fim_coo_t y2, fim_color_t color) + { + if( color == FIM_CNS_WHITE ) + return clear_rect_(aa_image(ascii_context_),y1, x1, y2-y1+1, x2-x1+1,aa_imgwidth(ascii_context_)); + else + return clear_rect_(aa_image(ascii_context_),y1, x1, y2-y1+1, x2-x1+1,aa_imgwidth(ascii_context_)); + } + + fim_err_t AADevice::status_line(const fim_char_t *msg) + { + fim_coo_t th=txt_height(); + if(th<1) + goto err; +#if (!FIM_AALIB_DRIVER_DEBUG) + aa_printf(ascii_context_,0,th-1,AA_NORMAL,"%s",msg); +#endif /* FIM_AALIB_DRIVER_DEBUG */ + aa_flush(ascii_context_); +err: + return FIM_ERR_NO_ERROR; + } + + AADevice::~AADevice(void) + { + /* seems like in some cases some aa stuff doesn't get freed. is this possible ? */ + if(!finalized_) + finalize(); + } + + static aa_context *fim_aa_ascii_context; /* This was a global variable just for the use in fim_aa_get_input. Now one it's of no use. */ + static fim_sys_int fim_aa_get_input(fim_key_t * c, bool want_poll, bool * srp) + { + if(srp) + *srp = true; + if(!c) + return 0; + *c = 0x0; /* blank */ + *c = aa_getevent(fim_aa_ascii_context,0);/* 1 if want to receive AA_RELEASE events, too */ + if(*c==AA_UNKNOWN) + *c=0; + if(*c) + std::cout << "";/* FIXME : removing this breaks things. console-related problem, I guess */ + if(!*c) + return 0; +#if 0 + if(*c==AA_UP ){*c=272;return 1;} + if(*c==AA_DOWN ){*c=274;return 1;} + if(*c==AA_LEFT ){*c=276;return 1;} + if(*c==AA_RIGHT){*c=275;return 1;} +#else + if(*c==AA_UP ){*c=AA_UP;return 1;} + if(*c==AA_DOWN ){*c=AA_DOWN;return 1;} + if(*c==AA_LEFT ){*c=AA_LEFT;return 1;} + if(*c==AA_RIGHT){*c=AA_RIGHT;return 1;} +#endif + /* FIXME : see defaultConfiguration.cpp */ + if(*c==AA_UP ){*c=4283163;return 1;} + if(*c==AA_DOWN ){*c=4348699;return 1;} + if(*c==AA_LEFT ){*c=4479771;return 1;} + if(*c==AA_RIGHT){*c=4414235;return 1;} + if(*c==AA_BACKSPACE){*c=127;return 1;} + + /* FIXME : these five bindings work only under X .. */ + if(*c==65765){*c=2117491483;return 1;}/* pageup (arbitrary) */ + if(*c==65766){*c=2117425947;return 1;}/* pagedown (arbitrary) */ + if(*c==65779){*c=2117229339;return 1;}/* ins (arbitrary) */ + if(*c==65760){*c=2117163803;return 1;}/* home (arbitrary) */ + if(*c==65767){*c=2117360411;return 1;}/* end (arbitrary) */ + + if(*c==AA_ESC) + { + *c=27; + return 1; + /* esc */ + } + if(srp) + *srp = false; + return 0; + } + + fim_sys_int AADevice::get_input(fim_key_t * c, bool want_poll) + { + fim_sys_int rc = 0; + bool sr = false; + + fim_aa_ascii_context = ascii_context_; + rc = fim_aa_get_input(c, want_poll, &sr); + + if(sr) + return rc; + + if(*c==65907) + { + status_line((const fim_char_t*)"control key not yet supported in aa. sorry!"); + return 1; + /* left ctrl (arbitrary) */ + } + if(*c==65908) + { + status_line((const fim_char_t*)"control key not yet supported in aa. sorry!"); + return 1; + /* right ctrl (arbitrary) */ + } + if(*c==65909) + { + status_line((const fim_char_t*)"lock key not yet supported in aa. sorry!"); + return 1; + /* right ctrl (arbitrary) */ + } + if(*c==65906) + { + status_line((const fim_char_t*)"shift key not yet supported in aa. sorry!"); + return 1; + /* shift (arbitrary) */ + } + if(*c==AA_MOUSE) + { + status_line((const fim_char_t *)"mouse events not yet supported in aa. sorry!"); + return 1; + /* */ + } + if(*c==AA_RESIZE ) + { + //status_line((const fim_char_t *)"window resizing not yet supported. sorry!"); + cc.resize(0,0); + /*aa_resize(ascii_context_);*//*we are not yet ready : the FimWindow and Viewport stuff .. */ + return 0; + /* */ + } + + //std::cout << "event : " << *c << "\n"; + //if(*c<0x80) return 1; + return 1; + } + + fim_err_t AADevice::resize(fim_coo_t w, fim_coo_t h) + { + /* resize is handled by aalib */ + const bool want_resize_=true; +#if AA_LIB_VERSIONCODE>=104000 + /* aalib version 104000 calls exit(-1) on zero-width/height contexts. this is simply stupid. + the code we have here is not completely clean, but it catches the situation and proposes + a fallback solution, by reinitializing the library video mode to reasonable defaults. */ + { + fim_coo_t width=0, height=0; + ascii_context_->driver->getsize(ascii_context_, &width, &height); + if (width < FIM_AA_MINWIDTH || height < FIM_AA_MINHEIGHT ) + { + /* this is a fix to avoid a segfault in aalib following to-zero window resize */ + aa_close(ascii_context_); + memcpy (&ascii_hwparms_, &aa_defparams, sizeof (struct aa_hardware_params)); + ascii_context_ = aa_autoinit (&ascii_hwparms_); + if(!aa_autoinitkbd(ascii_context_, 0)) + ;// error handling / reporting missing + return FIM_ERR_NO_ERROR; + } + } +#else /* AA_LIB_VERSIONCODE */ + /* FIXME: shall track back the first evil aalib version */ +#endif /* AA_LIB_VERSIONCODE */ + if(!want_resize_) + return FIM_ERR_GENERIC; + + if(1==aa_resize(ascii_context_)) + { + cc.setVariable(FIM_VID_SCREEN_WIDTH, (fim_int)width() ); + cc.setVariable(FIM_VID_SCREEN_HEIGHT,(fim_int)height()); + return FIM_ERR_NO_ERROR; + } + return FIM_ERR_GENERIC; + } + + fim_coo_t AADevice::status_line_height(void)const + { + return 1; + } + +#ifndef FIM_WANT_NO_OUTPUT_CONSOLE + AADevice::AADevice(MiniConsole & mc_, fim::string opts ):DisplayDevice(mc_), +#else /* FIM_WANT_NO_OUTPUT_CONSOLE */ + AADevice( fim::string opts ):DisplayDevice(), +#endif /* FIM_WANT_NO_OUTPUT_CONSOLE */ + allow_windowed(0) + { + this->reinit(opts.c_str()); + } + +#endif /* FIM_WITH_AALIB */ diff --git a/src/AADevice.h b/src/AADevice.h new file mode 100644 index 0000000..1b10a9a --- /dev/null +++ b/src/AADevice.h @@ -0,0 +1,100 @@ +/* $LastChangedDate: 2015-12-13 22:13:07 +0100 (Sun, 13 Dec 2015) $ */ +/* + AADevice.h : aalib device Fim driver header file + + (c) 2008-2015 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +#ifndef FIM_AADEVICE_H +#define FIM_AADEVICE_H +#ifdef FIM_WITH_AALIB + +#include "DisplayDevice.h" +#include + +/* + * Debugging only! + * */ +#define FIM_AALIB_DRIVER_DEBUG 0 + +class AADevice:public DisplayDevice +{ + int allow_windowed; + private: + aa_context *ascii_context_; + //struct aa_renderparams *ascii_rndparms;//we rely on aa_defrenderparams + struct aa_hardware_params ascii_hwparms_; + struct aa_savedata ascii_save_; + fim_char_t name_[2]; /* For ascii_save_.name */ + public: +#ifndef FIM_WANT_NO_OUTPUT_CONSOLE + AADevice(MiniConsole & mc_, fim::string opts); +#else /* FIM_WANT_NO_OUTPUT_CONSOLE */ + AADevice( fim::string opts ); +#endif /* FIM_WANT_NO_OUTPUT_CONSOLE */ + + virtual ~AADevice(void); + + virtual fim_err_t display( + void *ida_image_img, // source image structure (struct ida_image *)(but we refuse to include header files here!) + //void* rgb,// destination gray array and source rgb array + fim_coo_t iroff,fim_coo_t icoff, // row and column offset of the first input pixel + fim_coo_t irows,fim_coo_t icols,// rows and columns in the input image + fim_coo_t icskip, // input columns to skip for each line + fim_coo_t oroff,fim_coo_t ocoff,// row and column offset of the first output pixel + fim_coo_t orows,fim_coo_t ocols,// rows and columns to draw in output buffer + fim_coo_t ocskip,// output columns to skip for each line + fim_flags_t flags// some flags + ); + fim_err_t initialize(sym_keys_t &sym_keys); + void finalize(void); + + int get_chars_per_line(void); + int get_chars_per_column(void); + fim_coo_t txt_width(void); + fim_coo_t txt_height(void); + fim_coo_t width(void); + fim_coo_t height(void); + fim_err_t status_line(const fim_char_t *msg); + //void status_screen(int desc,int draw_output){} + fim_bool_t handle_console_switch(void) + { + return false; + } + template + fim_err_t clear_rect_( + void* dst, + fim_coo_t oroff,fim_coo_t ocoff, + fim_coo_t orows,fim_coo_t ocols, + fim_coo_t ocskip); + + fim_err_t clear_rect(fim_coo_t x1, fim_coo_t x2, fim_coo_t y1, fim_coo_t y2); + fim_err_t fill_rect(fim_coo_t x1, fim_coo_t x2, fim_coo_t y1,fim_coo_t y2, fim_color_t color); + fim_err_t fs_puts(struct fs_font *f, fim_coo_t x, fim_coo_t y, const fim_char_t *str); + void flush(void); + fim_err_t init_console(void); + fim_bpp_t get_bpp(void) + { + return 1; + } + fim_sys_int get_input(fim_key_t * c, bool want_poll=false); + virtual fim_err_t reinit(const fim_char_t *rs); + fim_err_t resize(fim_coo_t w, fim_coo_t h); + virtual fim_coo_t status_line_height(void)const; +}; + +#endif /* FIM_WITH_AALIB */ +#endif /* FIM_AADEVICE_H*/ diff --git a/src/Arg.cpp b/src/Arg.cpp new file mode 100644 index 0000000..3cc7ab1 --- /dev/null +++ b/src/Arg.cpp @@ -0,0 +1,30 @@ +/* $LastChangedDate: 2015-02-11 17:51:25 +0100 (Wed, 11 Feb 2015) $ */ +/* + Arg.cpp : + + (c) 2007-2015 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "fim.h" +namespace fim +{ + bool Arg::operator==(fim_int i){fim_int v=fim_atoi(val_.c_str());return v==i;} + bool Arg::operator<=(fim_int i){fim_int v=fim_atoi(val_.c_str());return v<=i;} + bool Arg::operator>=(fim_int i){fim_int v=fim_atoi(val_.c_str());return v>=i;} + bool Arg::operator <(fim_int i){fim_int v=fim_atoi(val_.c_str());return v (fim_int i){fim_int v=fim_atoi(val_.c_str());return v >i;} +} diff --git a/src/Arg.h b/src/Arg.h new file mode 100644 index 0000000..cb8f6e9 --- /dev/null +++ b/src/Arg.h @@ -0,0 +1,41 @@ +/* $LastChangedDate: 2015-02-11 17:51:25 +0100 (Wed, 11 Feb 2015) $ */ +/* + Arg.h : Argument class + + (c) 2007-2015 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +#ifndef FIM_ARG_H +#define FIM_ARG_H +#include "fim.h" +namespace fim +{ +class Arg +{ + public: + fim::string val_; + Arg(const fim::string &s):val_(s){} + Arg(const Arg &arg):val_(arg.val_){} + bool operator==(fim_int i); + bool operator<=(fim_int i); + bool operator>=(fim_int i); + bool operator <(fim_int i); + bool operator >(fim_int i); +}; + + +} +#endif /* FIM_ARG_H */ diff --git a/src/Benchmarkable.h b/src/Benchmarkable.h new file mode 100644 index 0000000..fb07510 --- /dev/null +++ b/src/Benchmarkable.h @@ -0,0 +1,38 @@ +/* $LastChangedDate: 2013-11-06 19:33:57 +0100 (Wed, 06 Nov 2013) $ */ +/* + Benchmarkable.h.h : header file for benchmarkable classes + + (c) 2011-2013 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +#ifndef FIM_BENCHMARKABLE_H +#define FIM_BENCHMARKABLE_H +#include "fim.h" +#if FIM_WANT_BENCHMARKS + class Benchmarkable{ + private: + fim_int benchmarkstate; + public: + Benchmarkable(void){benchmarkstate=0;} + virtual ~Benchmarkable(void){} + virtual fim_int get_n_qbenchmarks(void)const=0; + virtual void quickbench(fim_int qbi)=0; + virtual string get_bresults_string(fim_int qbi, fim_int qbtimes, fim_fms_t qbttime)const=0; + virtual void quickbench_init(fim_int qbi)=0; + virtual void quickbench_finalize(fim_int qbi)=0; + }; +#endif /* FIM_WANT_BENCHMARKS */ +#endif /* FIM_BENCHMARKABLE_H */ diff --git a/src/Browser.cpp b/src/Browser.cpp new file mode 100644 index 0000000..5b3c5c0 --- /dev/null +++ b/src/Browser.cpp @@ -0,0 +1,2044 @@ +/* $LastChangedDate: 2016-03-01 19:09:08 +0100 (Tue, 01 Mar 2016) $ */ +/* + Browser.cpp : Fim image browser + + (c) 2007-2016 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#define firstorval(x,v) ((x.size()>0)?((int)(x[0])):(v)) +#define firstorzero(x) firstorval((x),(0)) +#define firstorone(x) firstorval((x),(1)) +#define firstforzero(x) (x.size()>0?((float)(x[0])):0.0) +#define FIM_HORRIBLE_CACHE_INVALIDATING_HACK 1 + +#include +#include /* POSIX Standard: 2.6 Primitive System Data Types (e.g.: ssize_t) */ +#include "fim.h" +#ifdef HAVE_LIBGEN_H +#include +#endif /* HAVE_LIBGEN_H */ + +#define FIM_READ_BLK_DEVICES 1 + +#define FIM_BROWSER_INSPECT 0 +#if FIM_BROWSER_INSPECT +#define FIM_PR(X) printf("BROWSER:%c:%20s: f:%d/%d p:%d/%d %s\n",X,__func__,getGlobalIntVariable(FIM_VID_FILEINDEX),getGlobalIntVariable(FIM_VID_FILELISTLEN),getGlobalIntVariable(FIM_VID_PAGE),/*(image()?image()->getIntVariable(FIM_VID_PAGES):-1)*/-1,current().c_str()); +#else /* FIM_BROWSER_INSPECT */ +#define FIM_PR(X) +#endif /* FIM_BROWSER_INSPECT */ + +namespace fim +{ + int Browser::current_n(void)const + { + return cf_; + } + + fim::string Browser::fcmd_list(const args_t &args) + { + fim::string result = FIM_CNS_EMPTY_RESULT; + FIM_PR('*'); + if(args.size()<1) + { + /* returns a string with the info about the files in list (const op) */ + fim::string fileslist; + + for(size_t i=0;in_files(); + } + else if(args[0]=="remove") + { + args_t argsc(args); + argsc.erase(argsc.begin()); + result = do_filter(argsc); + } + else if(args[0]=="push") + { + args_t argsc(args); + argsc.erase(argsc.begin()); + result = do_push(argsc); + } +#ifdef FIM_READ_DIRS + else if(args[0]=="pushdir") + { + if(args.size()>=2) + push_dir(args[1]); + else + push_dir("."); + result = FIM_CNS_EMPTY_RESULT; + } + + else if(args[0]=="pushdirr") + { +#ifdef FIM_RECURSIVE_DIRS + if(args.size()>=2) + push_dir(args[1],true); + else + push_dir(".",true); + result = FIM_CNS_EMPTY_RESULT; +#else /* FIM_RECURSIVE_DIRS */ + result = "Please recompile with +FIM_RECURSIVE_DIRS to activate pushdirr."; +#endif /* FIM_RECURSIVE_DIRS */ + } +#endif /* FIM_READ_DIRS */ + else if(args[0]=="filesnum") + { + result = n_files(); + } +#if FIM_WANT_FILENAME_MARK_AND_DUMP + else if(args[0]=="mark" || args[0]=="unmark") + { + bool domark = (args[0]=="mark"); +#if FIM_WANT_PIC_LBFL + if(args.size() > 1) + { + args_t argsc(args); + argsc.erase(argsc.begin()); + do_filter(argsc,CmtMatch,false,domark ? Mark : Unmark); + } + else +#endif /* FIM_WANT_PIC_LBFL */ + cc.markCurrentFile(domark); + goto ret; + } + else if(args[0]=="marked") + { + std::string mfl = cc.marked_files_list(); + if( mfl != FIM_CNS_EMPTY_STRING ) + { + result += "The following files have been marked by the user :\n"; + result += mfl; + } + else + result += "No files have been marked by the user.\n"; + goto ret; + } +#else /* FIM_WANT_FILENAME_MARK_AND_DUMP */ + else if(args[0]=="mark") + result = FIM_EMSG_NOMARKUNMARK; + else if(args[0]=="marked") + result = FIM_EMSG_NOMARKUNMARK; + else if(args[0]=="unmark") + result = FIM_EMSG_NOMARKUNMARK; +#endif /* FIM_WANT_FILENAME_MARK_AND_DUMP */ + else result = FIM_CMD_HELP_LIST; + } +ret: + FIM_PR('.'); + return result; + } + + std::ostream& Browser::print(std::ostream &os)const + { + for(size_t i=0; irecenter(); + if( commandConsole_.redisplay() ) + this->display_status(current().c_str()); + } + FIM_AUTOCMD_EXEC(FIM_ACM_POSTREDISPLAY,c); + } + FIM_PR('.'); + } + +#ifdef FIM_READ_STDIN_IMAGE + void Browser::set_default_image(Image *stdin_image) + { + /* + * this is used mainly to set image files read from pipe or stdin + * */ + FIM_PR('*'); + if( !stdin_image || stdin_image->check_invalid() ) + goto ret; + if( default_image_ ) + delete default_image_; + default_image_ = stdin_image; +ret: + FIM_PR('.'); + return; + } +#endif /* FIM_READ_STDIN_IMAGE */ + + Browser::Browser(CommandConsole &cc): +#ifdef FIM_NAMESPACES + Namespace(&cc,FIM_SYM_NAMESPACE_BROWSER_CHAR), +#endif /* FIM_NAMESPACES */ +#if FIM_WANT_PIC_LBFL + flist_(tlist_), +#endif /* FIM_WANT_PIC_LBFL */ + nofile_(FIM_CNS_EMPTY_STRING),commandConsole_(cc) + { + cf_ = 0; + } + + const fim::string Browser::pop_current(void) + { + /* + * pops the current image filename from the filenames list + * ( note that it doesn't refresh the image in any way ! ) + * + * WARNING : SAME AS ERASE ! + */ + fim::string s; + + if( flist_.size() <= 0 ) + return nofile_; + assert(cf_); + flist_.erase( flist_.begin() + current_n() ); + setGlobalVariable(FIM_VID_FILELISTLEN,n_files()); + return s; + } + + const fim::string Browser::pop(fim::string filename) + { + /* + * pops the last image filename from the filenames list + * ( note that it doesn't refresh the image in any way ! ) + */ + fim::string s; + + if( flist_.size() <= 1 ) + return nofile_; + assert(cf_); + if( filename == FIM_CNS_EMPTY_STRING ) + { + flist_.erase( flist_.begin() + current_n() ); + if( cf_ >= (int)flist_.size() && cf_ > 0 ) + cf_--; + s = flist_[flist_.size()-1]; + } + else + { + // FIXME: shall use a search member function/function + for( size_t i=0; i < flist_.size(); ++i ) + if( flist_[i] == filename ) + flist_.erase(flist_.begin()+i); + cf_ = FIM_MAX(FIM_MIN(flist_.size()-1,cf_),0); + } + setGlobalVariable(FIM_VID_FILEINDEX,current_image()); + setGlobalVariable(FIM_VID_FILELISTLEN,n_files()); + return s; + } + + fim::string Browser::pan(const args_t &args) + { + FIM_PR('*'); + + if( args.size() < 1 || (!args[0].c_str()) ) + goto nop; + + if( c_image() ) + { + fim::string c = current(); + fim_char_t f = tolower(*args[0].c_str()); + if( f ) + { + FIM_AUTOCMD_EXEC(FIM_ACM_PREPAN,c); + if(c_image() && viewport()) + viewport()->pan(args); + FIM_AUTOCMD_EXEC(FIM_ACM_POSTPAN,c); + } + } + else + prev(); +nop: + FIM_PR('.'); + return FIM_CNS_EMPTY_RESULT; + } + + fim::string Browser::fcmd_scale(const args_t &args) + { + /* + * scales the image to a certain scale factor + * FIXME: no user error checking -- poor error reporting for the user + * TODO: wxh / w:h syntax needed + * FIXME: this shall belong to viewport + */ + fim_scale_t newscale = FIM_CNS_SCALEFACTOR_ZERO; + fim_char_t fc = FIM_SYM_CHAR_NUL; + const fim_char_t*ss = FIM_NULL; + int sl = 0; + bool pcsc = false; + FIM_PR('*'); + + if( args.size() < 1 || !(ss=args[0].c_str() )) + goto nop; + fc = tolower(*ss); + sl = strlen(ss); + if( isalpha(fc) ) + { + if( !( fc == 'w' || fc == 'h' || fc == 'a' || fc == 'b' ) ) + goto nop; + } + else + { + if( sl == 1 && ( fc =='+' || fc == '-' ) ) + { + if( fc == '+' ) + newscale=(fim_scale_t)getGlobalFloatVariable(FIM_VID_MAGNIFY_FACTOR); + if( fc == '-' ) + newscale=(fim_scale_t)getGlobalFloatVariable(FIM_VID_REDUCE_FACTOR); + goto comeon; + } + if( sl >= 2 && ( fc == '+' || fc == '-' ) ) + { + fim_char_t sc =ss[1]; + + if( fc == '+' ) + { + fim_scale_t vmf = getGlobalFloatVariable(FIM_VID_MAGNIFY_FACTOR); + fim_scale_t vrf = getGlobalFloatVariable(FIM_VID_REDUCE_FACTOR); + fim_scale_t sfd = getGlobalFloatVariable(FIM_VID_SCALE_FACTOR_DELTA); + fim_scale_t sfm = getGlobalFloatVariable(FIM_VID_SCALE_FACTOR_MULTIPLIER); + if( sfd <= FIM_CNS_SCALEFACTOR_ZERO ) + sfd = FIM_CNS_SCALEFACTOR_DELTA; + if( sfm <= FIM_CNS_SCALEFACTOR_ONE ) + sfm = FIM_CNS_SCALEFACTOR_MULTIPLIER; + + switch(sc) + { + case('+'): + { + vrf += sfd; + vmf += sfd; + } + break; + case('-'): + { + vrf -= sfd; + vmf -= sfd; + } + break; + case('*'): + { + vrf *= sfm; + vmf *= sfm; + } + break; + case('/'): + { + vrf /= sfm; + vmf /= sfm; + } + break; + default: + goto noplus; + } + + setGlobalVariable(FIM_VID_REDUCE_FACTOR, vrf); + setGlobalVariable(FIM_VID_MAGNIFY_FACTOR,vmf); + goto nop; + } +noplus: + if( fc == '+' || fc == '-') + { + newscale = fim_atof(ss+1); + pcsc = (strstr(ss,"%") != FIM_NULL ); + if(pcsc) + newscale *= .01; + if( !newscale ) + goto nop; +#if 1 + if( fc == '+' ) + newscale = 1.0 + newscale; + if( fc == '-' ) + newscale = 1.0 - newscale; + fc = FIM_SYM_CHAR_NUL; +#endif + goto comeon; + } + goto nop; + } + if( sl ) + { + if(fc=='*') + { + ++ss; + if(!*ss) + goto nop; /* a '*' alone. may assign a special meaning to this... */ + } + newscale = fim_atof(ss); + if(fc=='*') + { + fc = '+'; + goto comeon; + } + pcsc = (strstr(ss,"%") != FIM_NULL ); + if(pcsc) + newscale *= .01; + if( newscale == FIM_CNS_SCALEFACTOR_ZERO ) + goto nop; + pcsc = false; + goto comeon; + } + goto nop; + } +comeon: +#if FIM_WANT_BDI + if(1) +#else /* FIM_WANT_BDI */ + if(c_image()) +#endif /* FIM_WANT_BDI */ + { + fim::string c = current(); + FIM_AUTOCMD_EXEC(FIM_ACM_PRESCALE,c); + if(image()) + image()->update();/* rotation update */ /* FIXME: shall separate scaling from orientation */ + if( c_image() ) + switch( fc ) + { + case('w'): + if(viewport()) + viewport()->auto_width_scale(); + break; + case('h'): + if(viewport()) + viewport()->auto_height_scale(); + break; + case('a'): + if(viewport()) + viewport()->auto_scale(); + break; + case('b'): + if(viewport()) + viewport()->auto_scale_if_bigger(); + break; + case('-'): + { + if( newscale ) + { + if(image()) + image()->reduce(newscale); + if(viewport()) + viewport()->scale_position_reduce(newscale); + } + else + { + if(image()) + image()->reduce(); + if(viewport()) + viewport()->scale_position_reduce(); + } + } + break; + case('+'): + { + if( newscale ) + { + if(image()) + image()->magnify(newscale); + if(viewport()) + viewport()->scale_position_magnify(newscale); + } + else + { + if(image()) + image()->magnify(); + if(viewport()) + viewport()->scale_position_magnify(); + } + } + break; + default: + if( pcsc ) + image()->scale_multiply(newscale); + else + image()->setscale(newscale); + } + FIM_AUTOCMD_EXEC(FIM_ACM_POSTSCALE,c); + } +nop: + FIM_PR('.'); + return FIM_CNS_EMPTY_RESULT; + } + + fim::string Browser::fcmd_negate(const args_t &args) + { + /* + */ + if( !image() ) + goto nop; + + if( image() && image()->negate() ) + goto nop; +nop: + return FIM_CNS_EMPTY_RESULT; + } + + fim::string Browser::fcmd_desaturate(const args_t &args) + { + /* + */ + if( !image() ) + goto nop; + + if( image() && image()->desaturate() ) + goto nop; +nop: + return FIM_CNS_EMPTY_RESULT; + } + +#if FIM_WANT_PIC_LBFL + fim::string Browser::fcmd_limit(const args_t &args) + { + fim::string result = FIM_CNS_EMPTY_RESULT; + + if( args.size() > 2 ) + { + result = "Provided more than two arguments to " FIM_FLT_LIMIT ". Using the first two, ignoring the rest.\n"; + } + + if( args.size() > 0 ) + { + fim_int lbl = n_files(); /* length before limiting */ + if(tlist_.size()) + flist_ = tlist_; /* reset the first time */ + if( args.size() > 1 ) + ;// result = result + "Limiting to " + args[0] + " = " + args[1] + "\n"; + tlist_ = flist_; /* limiting */ +#if FIM_WANT_FILENAME_MARK_AND_DUMP + if( args[0] == "!" ) + { + // result = result + "Limiting to marked files\n"; + do_filter(args,MarkedMatch,true); /* this is remove on filenames; need remove on comments */ + } + else +#endif /* FIM_WANT_FILENAME_MARK_AND_DUMP */ + do_filter(args,VarMatch,true); /* this is remove on filenames; need remove on comments */ + if(lbl != n_files()) + reload(); + } + else + { + // result = "Restoring the original browsable files list."; + flist_ = tlist_; /* reset */ + } + setGlobalVariable(FIM_VID_FILELISTLEN,n_files()); /* TODO: need a specific 'refresh' function */ +nop: + return result; + } +#endif /* FIM_WANT_PIC_LBFL */ + + fim::string Browser::display_status(const fim_char_t *l) + { + fim_bool_t wcs = cc.isSetVar(FIM_VID_WANT_CAPTION_STATUS); + FIM_PR('*'); + + if( getGlobalIntVariable(FIM_VID_DISPLAY_STATUS) == 1 ) + { + fim::string dss ; + + if( cc.isSetVar(FIM_VID_DISPLAY_STATUS_FMT) ) + { + dss = c_image()->getInfoCustom(cc.getStringVariable(FIM_VID_DISPLAY_STATUS_FMT).c_str()); + } + commandConsole_.set_status_bar(dss != FIM_CNS_EMPTY_STRING ? dss.c_str() : l, image()?(image()->getInfo().c_str()):"*"); + } + else + { + if(wcs) + wcs = cc.set_wm_caption(FIM_NULL); + } + FIM_PR('.'); + return FIM_CNS_EMPTY_RESULT; + } + + fim::string Browser::fcmd_display(const args_t &args) + { + /* + * displays the current image, (if already loaded), on screen + */ + fim::string c = current(); + FIM_PR('*'); + + if( c_image() ) + { + FIM_AUTOCMD_EXEC(FIM_ACM_PREDISPLAY,c); + /* FIXME: need a "help" request answer. */ + /* + * the following is a trick to override redisplaying.. + */ + if( args.size()>0 && args[0] == "reinit" ) + { + string arg = args.size()>1?args[1]:""; + commandConsole_.display_reinit(arg.c_str()); + } + if( args.size()>0 && args[0] == "resize" ) + { + fim_coo_t nww = c_image()->width(); + fim_coo_t nwh = c_image()->height(); + fim_bool_t wsl = (getGlobalIntVariable(FIM_VID_DISPLAY_BUSY)) ? true : false;; + +#if 0 + if( args.size() == 2 && args[1] == "original" ) + nww = c_image()->original_width(), + nwh = c_image()->original_height() + fh; +#endif + if( args.size()>2 ) + nww = args[1], + nwh = args[2], + wsl = false; + commandConsole_.resize(nww,nwh,wsl); + } + if(image() && (getGlobalIntVariable(FIM_VID_OVERRIDE_DISPLAY)!=1)) + // if(c_image()) + { + //fb_clear_screen(); + //viewport().display(); + /* + * we redraw the whole screen and thus all of the windows + * */ + if( commandConsole_.display() ) + this->display_status(current().c_str()); +// FIXME: +// if(commandConsole_.window)commandConsole_.window->recursive_display(); + } + FIM_AUTOCMD_EXEC(FIM_ACM_POSTDISPLAY,c); + } + else + { + cout << "no image to display, sorry!"; + commandConsole_.set_status_bar("no image loaded.", "*"); + } + FIM_PR('.'); + return FIM_CNS_EMPTY_RESULT; + } + +#if FIM_WANT_FAT_BROWSER + fim::string Browser::fcmd_no_image(const args_t &args) + { + /* sets no image as the current one */ + FIM_PR('*'); + free_current_image(); + FIM_PR('.'); + return FIM_CNS_EMPTY_RESULT; + } +#endif /* FIM_WANT_FAT_BROWSER */ + + int Browser::load_error_handle(fim::string c) + { + /* + * assume there was a load attempt : check and take some action in case of error + * + * FIXME : this behaviour is BUGGY, because recursion will be killed off + * by the autocommand loop prevention mechanism. (this is not true, as 20090215) + * */ + static int lehsof = 0; /* './fim FILE NONFILE' and hitting 'prev' will make this necessary */ + int retval = 0; + FIM_PR('*'); + + if( lehsof ) + goto ret; /* this prevents infinite recursion */ + if( /*image() &&*/ viewport() && ! (viewport()->check_valid()) ) + { + free_current_image(); + ++ lehsof; +#ifdef FIM_REMOVE_FAILED + //pop(c); //removes the currently specified file from the list. (pop doesn't work in this way) + args_t args; + args.push_back(c.c_str()); + do_filter(args); // remove is an experimental function +#ifdef FIM_AUTOSKIP_FAILED + if(n_files()) + { + //next(1); + reload(); /* this is effective, at least partially */ + } +#endif /* FIM_AUTOSKIP_FAILED */ +#endif /* FIM_REMOVE_FAILED */ + --lehsof; + retval = 1; + } +ret: + FIM_PR('.'); + return retval; + } + + fim::string Browser::reload(void) + { + /* + * FIXME + * + * reload the current filename + * */ + if( n_files() ) + return fcmd_reload( args_t() ); + return FIM_CNS_EMPTY_RESULT; + } + + fim_err_t Browser::loadCurrentImage(void) + { + /* + * FIXME + * + * an attempt to load the current image + * */ + fim_err_t errval = FIM_ERR_NO_ERROR; + + FIM_PR('*'); + try + { +#ifndef FIM_BUGGED_CACHE + #ifdef FIM_CACHE_DEBUG + if( viewport() ) std::cout << "browser::loadCurrentImage(\"" << current().c_str() << "\")\n"; + #endif /* FIM_CACHE_DEBUG */ + if( viewport() + && !( current()!=FIM_STDIN_IMAGE_NAME && !is_file(current()) ) /* FIXME: this is an unelegant fix to prevent crashes on non-existent files. One shall better fix this by a good exception mechanism for Image::Image() and a clean approach w.r.t. e.g. free_current_image() */ + ) + { + ViewportState viewportState; + FIM_PR('0'); + viewport()->setImage( cache_.useCachedImage(cache_key_t(current(),(current()==FIM_STDIN_IMAGE_NAME)?FIM_E_STDIN:FIM_E_FILE),&viewportState,getGlobalIntVariable(FIM_VID_PAGE)) );// FIXME + viewport()->setState(viewportState); + } +#else /* FIM_BUGGED_CACHE */ + // warning : in this cases exception handling is missing + #ifdef FIM_READ_STDIN_IMAGE + if( current() != FIM_STDIN_IMAGE_NAME ) + { + FIM_PR('1'); + if(viewport()) + viewport()->setImage( new Image(current().c_str()) ); + } + else + { + FIM_PR('2'); + if( viewport() && default_image_ ) + { + // a one time only image (new, experimental) + viewport()->setImage(default_image_->getClone()); + //default_image_=FIM_NULL; + } + } + #else + FIM_PR('3'); + if( viewport() ) + viewport()->setImage( new Image(current().c_str()) ); + #endif /* FIM_READ_STDIN_IMAGE */ +#endif /* FIM_BUGGED_CACHE */ + } + catch(FimException e) + { + FIM_PR('E'); + if(viewport()) + viewport()->setImage( FIM_NULL ); +// commented temporarily for safety reasons +// if( e != FIM_E_NO_IMAGE )throw FIM_E_TRAGIC; /* hope this never occurs :P */ + } + FIM_PR('.'); + return errval; + } + + void Browser::free_current_image(void) + { + /* + * FIXME + * only cleans up the internal data structures + * */ + FIM_PR('*'); + if( viewport() ) + viewport()->free(); + setGlobalVariable(FIM_VID_CACHE_STATUS,cache_.getReport().c_str()); + FIM_PR('.'); + } + + fim::string Browser::fcmd_prefetch(const args_t &args) + { +#ifdef FIM_BUGGED_CACHE + return " prefetching disabled"; +#endif /* FIM_BUGGED_CACHE */ + FIM_PR('*'); + + FIM_AUTOCMD_EXEC(FIM_ACM_PREPREFETCH,current()); + if( args.size() > 0 ) + goto ret; + + setGlobalVariable(FIM_VID_WANT_PREFETCH,(fim_int)0); + if(cache_.prefetch(cache_key_t(get_next_filename( 1).c_str(),FIM_E_FILE)))// we prefetch 1 file forward +#ifdef FIM_AUTOSKIP_FAILED + pop(get_next_filename( 1));/* if the filename doesn't match a loadable image, we remove it */ +#else /* FIM_AUTOSKIP_FAILED */ + {} /* beware that this could be dangerous and trigger loops */ +#endif /* FIM_AUTOSKIP_FAILED */ + if(cache_.prefetch(cache_key_t(get_next_filename(-1).c_str(),FIM_E_FILE)))// we prefetch 1 file backward +#ifdef FIM_AUTOSKIP_FAILED + pop(get_next_filename(-1));/* if the filename doesn't match a loadable image, we remove it */ +#else /* FIM_AUTOSKIP_FAILED */ + {} /* beware that this could be dangerous and trigger loops */ +#endif /* FIM_AUTOSKIP_FAILED */ + FIM_AUTOCMD_EXEC(FIM_ACM_POSTPREFETCH,current()); + setGlobalVariable(FIM_VID_WANT_PREFETCH,(fim_int)1); +ret: + FIM_PR('.'); + return FIM_CNS_EMPTY_RESULT; + } + + fim::string Browser::fcmd_reload(const args_t &args) + { + /* + * deletes the structures associated to the present image + * and then + * tries to load a new one from the current filename + */ + fim::string c = current(); + fim::string result; + + FIM_PR('*'); + //for(size_t i=0;i 0 ) + { + fim_int mci = getGlobalIntVariable(FIM_VID_MAX_CACHED_IMAGES); + setGlobalVariable(FIM_VID_MAX_CACHED_IMAGES,(fim_int)0); + free_current_image(); + setGlobalVariable(FIM_VID_MAX_CACHED_IMAGES,mci); + } +#else /* FIM_HORRIBLE_CACHE_INVALIDATING_HACK */ + free_current_image(); +#endif /* FIM_HORRIBLE_CACHE_INVALIDATING_HACK */ + loadCurrentImage(); + //if(image())image()->reload(); + +// while( n_files() && viewport() && ! (viewport()->check_valid() ) && load_error_handle(c) ); + load_error_handle(c); + FIM_AUTOCMD_EXEC(FIM_ACM_POSTRELOAD,c); + result = FIM_CNS_EMPTY_RESULT; +ret: + FIM_PR('.'); + return result; + } + + fim::string Browser::fcmd_load(const args_t &args) + { + /* + * loads the current file, if not already loaded + */ + fim::string c = current(); + fim::string result = FIM_CNS_EMPTY_RESULT; + FIM_PR('*'); + + //for(size_t i=0;igetName() == current()) ) + { + result = "image already loaded\n"; //warning + goto ret; + } + if( empty_file_list() ) + { + result = "sorry, no image to load\n"; //warning + goto ret; + } + FIM_AUTOCMD_EXEC(FIM_ACM_PRELOAD,c); + commandConsole_.set_status_bar("please wait while loading...", "*"); + + loadCurrentImage(); + + load_error_handle(c); + FIM_AUTOCMD_EXEC(FIM_ACM_POSTLOAD,c); +ret: + FIM_PR('.'); + return result; + } + + fim_int Browser::find_file_index(const fim::string nf)const + { + /* + * returns whether the file nf is in the files list + */ + fim_int fi = -1; +#if 1 + for(args_t::const_iterator fit=flist_.begin();fit!=flist_.end();++fit) + if( *fit == nf ) + { + fi = fit - flist_.begin(); + goto ret; + } +#else + for(fim_size_t i=0;i= 0 ) + ip = true; + return ip; + } + +#ifdef FIM_READ_DIRS + bool Browser::push_dir(fim::string nf, fim_flags_t pf) + { + // TODO: may introduce some more variable to control recursive push + DIR *dir = FIM_NULL; + struct dirent *de = FIM_NULL; + fim::string f; + bool retval = false; + FIM_PR('*'); + + if(cc.getIntVariable(FIM_VID_PRELOAD_CHECKS)!=1) + goto nostat; + /* we want a dir .. */ +#ifdef HAVE_LIBGEN_H + if( !is_dir( nf.c_str() ) ) + nf = fim_dirname(nf); +#else /* HAVE_LIBGEN_H */ + if( !is_dir( nf )) + goto ret; +#endif /* HAVE_LIBGEN_H */ + +nostat: + if ( ! ( dir = opendir(nf.c_str() ) )) + goto ret; + + f += nf; + f += FIM_CNS_DIRSEP_STRING; + //are we sure -1 is not paranoid ? + while( ( de = readdir(dir) ) != FIM_NULL ) + { + if( de->d_name[0] == '.' && de->d_name[1] == '.' && !de->d_name[2] ) + continue; + if( de->d_name[0] == '.' && !de->d_name[1] ) + continue; +#if 1 + /* + * We follow the convention of ignoring hidden files. + * */ + if( de->d_name[0] == '.' ) + continue; +#endif + + /* + * Warning : this is dangerous, as following circular links may cause memory exhaustion. + * */ + if( is_dir( f + fim::string(de->d_name)) ) + { +#ifdef FIM_RECURSIVE_DIRS + if( pf & FIM_FLAG_PUSH_REC ) + push_dir( f + fim::string(de->d_name) ); + else +#endif /* FIM_RECURSIVE_DIRS */ + continue; + } + else + { + fim::string re = getGlobalStringVariable(FIM_VID_PUSHDIR_RE); + fim::string fn = f + fim::string( de->d_name ); + + if( re == FIM_CNS_EMPTY_STRING ) + re = FIM_CNS_PUSHDIR_RE; + if( fn.re_match(re.c_str()) ) + push( f + fim::string(de->d_name) ); + //std::cout << re << " " << f + fim::string(de->d_name) << "!\n"; + } + } +ret: + retval = ( closedir(dir) == 0 ); + FIM_PR('.'); + return retval; + } +#endif /* FIM_READ_DIRS */ + + bool Browser::push(fim::string nf, fim_flags_t pf) + { + /* + * FIX ME: + * are we sure we want no repetition!???? + * */ + bool retval = false; + FIM_PR('*'); + + if( nf == FIM_STDIN_IMAGE_NAME ) + goto isfile; + + if(cc.getIntVariable(FIM_VID_PRELOAD_CHECKS)!=1) + { + int sl = strlen(nf.c_str()); + + if(sl < 1) + goto ret; + + if( nf[sl-1] == FIM_CNS_SLASH_CHAR ) + { + goto isdir; + } + else + { + goto isfile; + } + } + + { +#ifdef FIM_CHECK_FILE_EXISTENCE + /* + * skip adding the filename in the list if + * it is not existent or it is a directory... + */ + struct stat stat_s; + + /* if the file doesn't exist, return */ + if( -1 == stat(nf.c_str(),&stat_s) ) + { +#if 0 + if( errno != EOVERFLOW) /* this may happen with a readable file... */ +#endif + { + /* fim_perror("!"); */ + goto ret; + } + } + /* if it is a character device , return */ + //if( S_ISCHR(stat_s.st_mode))return FIM_CNS_EMPTY_RESULT; + /* if it is a block device , return */ + //if( S_ISBLK(stat_s.st_mode))return FIM_CNS_EMPTY_RESULT; + /* if it is a directory , return */ + //if( S_ISDIR(stat_s.st_mode))return FIM_CNS_EMPTY_RESULT; +#ifdef FIM_READ_DIRS + if( getGlobalIntVariable(FIM_VID_PUSH_PUSHES_DIRS) == 1 ) + if( S_ISDIR(stat_s.st_mode)) + { + goto isdir; + } +#endif /* FIM_READ_DIRS */ + /* we want a regular file .. */ + if( + ! S_ISREG(stat_s.st_mode) +#ifdef FIM_READ_BLK_DEVICES + && ! S_ISBLK(stat_s.st_mode) // NEW +#endif /* FIM_READ_BLK_DEVICES */ + ) + { + /* + * i am not fully sure this is effective + * */ + nf += " is not a regular file!"; + commandConsole_.set_status_bar(nf.c_str(), "*"); + goto ret; + } +#endif /* FIM_CHECK_FILE_EXISTENCE */ + } +isfile: +#ifdef FIM_CHECK_DUPLICATES + if( present(nf) ) + { + //there could be an option to have duplicates... + //std::cout << "no duplicates allowed..\n"; + goto ret; + } +#endif /* FIM_CHECK_DUPLICATES */ + flist_.push_back(nf); + //std::cout << "pushing " << nf << FIM_CNS_NEWLINE; + setGlobalVariable(FIM_VID_FILELISTLEN,n_files()); + goto ret; +#ifdef FIM_READ_DIRS +isdir: + retval = push_dir(nf,pf); +#endif /* FIM_READ_DIRS */ +ret: + FIM_PR('.'); + return retval; + } + + fim_int Browser::n_files(void)const + { + /* + * the number of files in the filenames list + */ + return flist_.size(); + } + +#define FIM_SORT_BY_DATE 0 +#if FIM_SORT_BY_DATE +struct FimDateSorter +{ + bool operator() (fim::string lfn, fim::string rfn) + { + struct stat lstat_s; + struct stat rstat_s; + stat(lfn.c_str(),&lstat_s); + stat(rfn.c_str(),&rstat_s); + return (lstat_s.st_mtime < rstat_s.st_mtime); + } +} fimDateSorter; +#endif + +struct FimBaseNameSorter +{ + bool operator() (fim::string lfn, fim::string rfn) + { + const char * ls = lfn.c_str(); + const char * rs = rfn.c_str(); + int scr = 0; + + if(ls && rs) + scr = (strcmp(fim_basename_of(ls),fim_basename_of(rs))); + return (scr < 0); + + } +} fimBaseNameSorter; + + fim::string Browser::_sort(const fim_char_t sc) + { + /* + * sorts the image filenames list + */ + if(sc=='f') + std::sort(flist_.begin(),flist_.end()); + if(sc=='b') + std::sort(flist_.begin(),flist_.end(),fimBaseNameSorter); +#if FIM_SORT_BY_DATE + if(sc=='d') + std::sort(flist_.begin(),flist_.end(),fimDateSorter); +#endif + return n_files() ? (flist_[current_n()]) : nofile_; + } + + fim::string Browser::_random_shuffle(bool dts) + { + /* + * sorts the image filenames list + * if dts==true, do time() based seeding + * TODO: it would be cool to support a user supplied seed value + */ + if( dts ) + std::srand(time(FIM_NULL)); /* FIXME: AFAIK, effect of srand() on random_shuffle is not mandated by any standard. */ + std::random_shuffle(flist_.begin(),flist_.end()); + return n_files() ? (flist_[current_n()]) : nofile_; + } + + fim::string Browser::_clear_list(void) + { + /* + */ + flist_.erase(flist_.begin(),flist_.end()); + return 0; + } + + fim::string Browser::_reverse(void) + { + /* + * sorts the image filenames list + */ + std::reverse(flist_.begin(),flist_.end()); + return n_files()?(flist_[current_n()]):nofile_; + } + + fim::string Browser::regexp_goto(const args_t &args, int src_dir) + { + /* + * goes to the next filename-matching file + * TODO: this member function shall only find the index and return it ! + */ + size_t i,j,c = current_n(),s = flist_.size(); + const char *rso = cc.isSetVar(FIM_VID_RE_SEARCH_OPTS) ? cc.getStringVariable(FIM_VID_RE_SEARCH_OPTS).c_str() : "bi"; + int rsic = 1; /* ignore case */ + int rsbn = 1; /* base name */ + FIM_PR('*'); + + if ( rso && strchr(rso,'i') ) + rsic = 1; + else + if ( rso && strchr(rso,'I') ) + rsic = 0; + if ( rso && strchr(rso,'b') ) + rsbn = 1; + else + if ( rso && strchr(rso,'f') ) + rsbn = 0; + + if( args.size() < 1 || s < 1 ) + goto nop; + + last_regexp_ = args[0]; + last_src_dir_ = src_dir; + + for(j=0;jis_multipage()) +#else /* FIM_WANT_BDI */ + if( N==1 && c_image() && c_image()->is_multipage()) +#endif /* FIM_WANT_BDI */ + { + //if(1)std::cout<<"goto page "<goto_page(n); + result = N; + goto ret; + } +#if FIM_WANT_GOTOLAST + if(getGlobalIntVariable(FIM_VID_LASTFILEINDEX) != current_image()) + setGlobalVariable(FIM_VID_LASTFILEINDEX, current_image()); +#endif /* FIM_WANT_GOTOLAST */ + cf_ = n; + cf_ = FIM_MOD(cf_,N); + FIM_PR(' '); + setGlobalVariable(FIM_VID_PAGE ,(fim_int)0); + setGlobalVariable(FIM_VID_FILEINDEX,current_image()); + //setGlobalVariable(FIM_VID_FILEINDEX,cf_); + setGlobalVariable(FIM_VID_FILENAME, current().c_str()); + FIM_PR(' '); + //loadCurrentImage(); + result = n_files()?(flist_[current_n()]):nofile_; +ret: + FIM_PR('.'); + return result; + } + + fim::string Browser::get_next_filename(int n)const + { + /* + * returns to the next image in the list, the mechanism + * p.s.: n<>0 + */ + int ccp = cf_ + n; + int N = flist_.size(); + + if( !N ) + return FIM_CNS_EMPTY_RESULT; + ccp = FIM_MOD(ccp,N); + return flist_[ccp]; + } + + fim::string Browser::next(int n) + { + fim::string gs = "+"; + + gs += fim::string(n); + return goto_image_internal(gs.c_str(),FIM_X_NULL); + } + + fim::string Browser::prev(int n) + { + fim::string gs = "-"; + + gs += fim::string(n); + return goto_image_internal(gs.c_str(),FIM_X_NULL); + } + + fim::string Browser::fcmd_goto_image(const args_t &args) + { + if( args.size() > 0 ) + return goto_image_internal(args[0].c_str(),FIM_X_NULL); + else + return goto_image_internal(FIM_NULL,FIM_X_NULL); + } + + fim::string Browser::goto_image_internal(const fim_char_t *s,fim_xflags_t xflags) + { + /* + */ + const fim_char_t*errmsg = FIM_CNS_EMPTY_STRING; + //const int cf=cf_,cp=c_page(),pc=n_pages(),fc=n_files(); + const int cf = cf_,cp =getGlobalIntVariable(FIM_VID_PAGE),pc = FIM_MAX(1,n_pages()),fc = n_files(); + fim_int gv = 0,nf = cf,mv = 0,np = cp; + FIM_PR('*'); + + if( n_files() == 0 || !s ) + { + errmsg = FIM_CMD_HELP_GOTO; + goto err; + } + if(!s) + { + errmsg = FIM_CMD_HELP_GOTO; + goto err; + } + else + { + fim_char_t c = FIM_SYM_CHAR_NUL; + fim_char_t l = FIM_SYM_CHAR_NUL; + int sl = 0,li = 0; + bool pcnt = false; + bool isre = false; + bool ispg = false; + bool isfg = false; + bool isrj = false; + + if( !s ) + goto ret; + sl = strlen(s); + if( sl < 1 ) + goto ret; + c = *s; + //for(li=sl-2;li=2) && ('/'==s[sl-1]) && (((sl>=3) && (c=='+' || c=='-') && s[1]=='/') ||( c=='/'))); + isrj = (c=='+' || c=='-'); + if( isdigit(c) || c == '-' || c == '+' ) + { + gv = fim_atoi(s); + if(gv == FIM_CNS_LAST) + gv = -1; + } + else + if( c == '^' || c == 'f' ) + gv = 1; + else + if( c == '$' || c == 'l' ) + gv = -1;// temporarily + else + if( c == '?' ) + { + gv = find_file_index(string(s).substr(1,sl-1)); + //std::cout< 0 && ( isfg || pcnt || ispg )) + { + l = tolower( s[ li = sl-2 ] ); + if( l == '%' ) + pcnt = true; + if( l == 'p' ) + ispg = true; + if( l == 'f' ) + isfg = true; + } + if( c=='$' || c == 'l' ) + gv = mv - 1; + if( (isrj) && (!isfg) && (!ispg) && pc > 1 ) + { + ispg = true; + if(( cp == 0 && gv < 0 ) || (cp == pc-1 && gv > 0 ) ) + if( fc > 1 ) + isfg = true, ispg = false; + } + if( ispg ) + mv = pc; + else + mv = fc; + if( pcnt ) + { + gv = FIM_INT_PCNT_OF_100(gv,mv); + } + if( !mv ) + { + goto ret; + } + if( isfg && ispg ) + { + // std::cout << "!\n"; + goto err; + } + //if((!isre) && (!isrj))nf=gv; + //if(isrj && gv<0 && cf==1){cf=0;}//TODO: this is a bugfix + if( (!isrj) && gv > 0 ) + gv = gv - 1;// user input is interpreted as 1-based + gv = FIM_MOD(gv,mv); + /* gv=FIM_MAX(FIM_MIN(gv,mv-1),0); */ + //cout << "at " << cf <<", gv="<goto_page(np); + else + goto_image(nf,isfg?true:false); + + if(!(xflags&FIM_X_NOAUTOCMD)) + { FIM_AUTOCMD_EXEC(FIM_ACM_POSTGOTO,c); } + } + } +ret: + errmsg = FIM_CNS_EMPTY_RESULT; +err: + FIM_PR('.'); + return errmsg; + } + + fim::string Browser::do_filter(const args_t &args, MatchMode rm, bool negative, enum FilterAction faction) + { + /* + * TODO: flags for negative, ... + * TODO: message like 'marked xxx files' ... + */ + fim::string result; + int N = 0; + fim_int matched = 0, marked = 0; + + FIM_PR('*'); +#if FIM_WANT_FILENAME_MARK_AND_DUMP + if ( rm == MarkedMatch ) + { + for(size_t i=0;i0) + { + /* + * the list is unsorted. it may contain duplicates + * if this software will have success, we will have indices here :) + * sort(rlist.begin(),rlist.end());... + */ + //fim_int lf = flist_.size(); +#if FIM_WANT_PIC_LVDN + if ( rm == VarMatch ) + if(rlist.size() < 2) + rm = CmtMatch; +#else + if ( rm == VarMatch ) + rm = FullFileNameMatch; +#endif /* FIM_WANT_PIC_LVDN */ + for(size_t r=0;ronRight() && viewport()->onBottom()) + next(); + else + if(viewport()->onRight()) + { + viewport()->pan("down",FIM_CNS_SCROLL_DEFAULT); + while(!(viewport()->onLeft()))viewport()->pan("left",FIM_CNS_SCROLL_DEFAULT); + } + else + viewport()->pan("right",FIM_CNS_SCROLL_DEFAULT); + } + else + next(1); + FIM_AUTOCMD_EXEC(FIM_ACM_POSTPAN,c); + FIM_PR('.'); + return FIM_CNS_EMPTY_RESULT; + } + + fim::string Browser::fcmd_scrolldown(const args_t &args) + { + /* + * scrolls the image down + * + * FIX ME : move to Viewport + */ + fim::string c = current(); + FIM_PR('*'); + + FIM_AUTOCMD_EXEC(FIM_ACM_PREPAN,c); + if(c_image() && viewport()) + { + if(viewport()->onBottom()) + next(); + else + viewport()->pan("down",FIM_CNS_SCROLL_DEFAULT); + } + else + next(1); + FIM_AUTOCMD_EXEC(FIM_ACM_POSTPAN,c); + FIM_PR('.'); + return FIM_CNS_EMPTY_RESULT; + } + + fim::string Browser::fcmd_info(const args_t &args) + { + /* + * short information in status-line format + */ +#if 0 + string fl; + for(size_t r=0;rgetInfo(); + else + r += " (unloaded)"; + FIM_PR('.'); + return r; +#endif + } + + fim::string Browser::info(void) + { + /* + * short information in status-line format + */ + return fcmd_info(args_t(0)); + } + + fim::string Browser::fcmd_rotate(const args_t &args) + { + /* + * rotates the displayed image a specified amount of degrees + */ + fim_angle_t angle; + + FIM_PR('*'); + + if( args.size() == 0 ) + angle = FIM_CNS_ANGLE_ONE; + else + angle = fim_atof(args[0].c_str()); + if( angle == FIM_CNS_ANGLE_ZERO) + goto ret; + + if(c_image()) + { + //angle = (double)getGlobalFloatVariable(FIM_VID_ANGLE); + fim::string c = current(); +// FIM_AUTOCMD_EXEC(FIM_ACM_PREROTATE,c);//FIXME + FIM_AUTOCMD_EXEC(FIM_ACM_PRESCALE,c); //FIXME + if( c_image() ) + { + if(angle) + { + if(image()) + image()->rotate(angle); + } + else + { + if(image()) + image()->rotate(); + } + } +// FIM_AUTOCMD_EXEC(FIM_ACM_POSTROTATE,c);//FIXME + FIM_AUTOCMD_EXEC(FIM_ACM_POSTSCALE,c); //FIXME + } +ret: + FIM_PR('.'); + return FIM_CNS_EMPTY_RESULT; + } + +#if FIM_WANT_FAT_BROWSER + fim::string Browser::fcmd_magnify(const args_t &args) + { + /* + * magnifies the displayed image + */ + FIM_PR('*'); + if(c_image()) + { + fim_scale_t factor; + fim::string c = current(); + factor = firstforzero(args); + if( !factor ) + factor = (fim_scale_t)getGlobalFloatVariable(FIM_VID_MAGNIFY_FACTOR); + FIM_AUTOCMD_EXEC(FIM_ACM_PRESCALE,c); + if(c_image()) + { + if(factor) + { + if(image()) + image()->magnify(factor); + if(viewport()) + viewport()->scale_position_magnify(factor); + } + else + { + if(image()) + image()->magnify(); + if(viewport()) + viewport()->scale_position_magnify(); + } + } + FIM_AUTOCMD_EXEC(FIM_ACM_POSTSCALE,c); + } + FIM_PR('.'); + return FIM_CNS_EMPTY_RESULT; + } + + fim::string Browser::fcmd_reduce(const args_t &args) + { + /* + * reduces the displayed image size + */ + FIM_PR('*'); + if(c_image()) + { + fim_scale_t factor; + factor = firstforzero(args); + if(!factor) + factor = (fim_scale_t)getGlobalFloatVariable(FIM_VID_REDUCE_FACTOR); + fim::string c = current(); + FIM_AUTOCMD_EXEC(FIM_ACM_PRESCALE,c); + if(c_image()) + { + if(factor) + { + if(image()) + image()->reduce(factor); + if(viewport()) + viewport()->scale_position_reduce(factor); + } + else + { + if(image()) + image()->reduce(); + if(viewport()) + viewport()->scale_position_reduce(); + } + } + FIM_AUTOCMD_EXEC(FIM_ACM_POSTSCALE,c); + } + FIM_PR('.'); + return FIM_CNS_EMPTY_RESULT; + } +#endif /* FIM_WANT_FAT_BROWSER */ + + fim::string Browser::fcmd_align(const args_t &args) + { + /* + * aligns to top/bottom the displayed image + * TODO: incomplete + */ + FIM_PR('*'); + if( args.size() < 1 ) + goto err; + if( !args[0].c_str() || !args[0].re_match("^(bottom|top|left|right|center)") ) + goto err; + if( c_image() ) + { + fim::string c = current(); + FIM_AUTOCMD_EXEC(FIM_ACM_PREPAN,c); + if(c_image() && viewport()) + { + // FIXME: need a switch/case construct here + if(args[0].re_match("top")) + viewport()->align('t'); + if(args[0].re_match("bottom")) + viewport()->align('b'); + if(args[0].re_match("left")) + viewport()->align('l'); + if(args[0].re_match("right")) + viewport()->align('r'); + if(args[0].re_match("center")) + viewport()->align('c'); + } + FIM_AUTOCMD_EXEC(FIM_ACM_POSTPAN,c); + } + FIM_PR('.'); + return FIM_CNS_EMPTY_RESULT; +err: + FIM_PR('.'); + return FIM_CMD_HELP_ALIGN; + } + + const Image *Browser::c_image(void)const + { + /* + * a const pointer to the currently loaded image + */ + const Image * image = FIM_NULL; + + if( commandConsole_.current_viewport() ) + image = commandConsole_.current_viewport()->c_getImage(); + return image; + } + + Image *Browser::image(void)const + { + /* + * the image loaded in the current viewport is returned + */ + Image * image = FIM_NULL; + + if( commandConsole_.current_viewport() ) + image = commandConsole_.current_viewport()->getImage(); + return image; + } + + Viewport* Browser::viewport(void)const + { + /* + * A valid pointer will be returned + * whenever the image is loaded ! + * + * FIM_NULL is returned in case no viewport is loaded. + * */ + return (commandConsole_.current_viewport()); + } + + fim::string Browser::current(void)const + { + /* + * dilemma : should the current() filename and next() operations + * be relative to viewport's own current's ? + * */ + if( empty_file_list() ) + return nofile_; // FIXME: patch! + //return cf_?flist_[current_n()]:nofile_; + return cf_ >= 0 ? flist_[cf_] : nofile_; + } + + int Browser::empty_file_list(void)const + { + /* + * is the filename list empty ? + */ + return flist_.size() == 0; + } + + fim::string Browser::display(void) + { + /* + * display the current image + */ + return fcmd_display(args_t()); + } + + fim::string Browser::pop_current(const args_t &args) + { + /* + * pops the last image filename off the image list + */ + return pop_current(); + } + + fim::string Browser::do_push(const args_t &args) + { + /* + * pushes a new image filename on the back of the image list + */ + for(size_t i=0;in_pages(); + return pi; + } + + fim_int Browser::c_page(void)const + { + fim_int pi = 0; + +#if !FIM_WANT_BDI + if( c_image() ) +#endif /* FIM_WANT_BDI */ + pi = c_image()->c_page(); + return pi; + } + + size_t Browser::byte_size(void)const + { + size_t bs = 0; + + bs += cache_.byte_size();; + bs += sizeof(*this); + /* TODO: this is incomplete ... */ + return bs; + } +} + diff --git a/src/Browser.h b/src/Browser.h new file mode 100644 index 0000000..179f4f9 --- /dev/null +++ b/src/Browser.h @@ -0,0 +1,178 @@ +/* $LastChangedDate: 2015-12-28 14:42:54 +0100 (Mon, 28 Dec 2015) $ */ +/* + Browser.h : Image browser header file + + (c) 2007-2015 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +#ifndef FIM_BROWSER_H +#define FIM_BROWSER_H +#include "fim.h" + +#define FIM_FLAG_DEFAULT 0 +#define FIM_FLAG_PUSH_REC 1 + +namespace fim +{ + extern CommandConsole cc; +/* + * A Browser object oversees image browsing. + */ +#ifdef FIM_NAMESPACES +class Browser:public Namespace +#else /* FIM_NAMESPACES */ +class Browser +#endif /* FIM_NAMESPACES */ +{ + private: + enum MatchMode{ FullFileNameMatch, PartialFileNameMatch, VarMatch, CmtMatch, MarkedMatch }; /* FIXME */ + enum FilterAction{ Mark, Unmark, Delete }; /* FIXME */ + args_t flist_; /* the names of files in the slideshow. */ +#if FIM_WANT_PIC_LBFL + args_t tlist_; /* the names of files in the slideshow. */ + args_t llist_; /* limited file list */ +#endif /* FIM_WANT_PIC_LBFL */ + + const fim::string nofile_; /* a dummy empty filename */ + + /* + * cf_ is zero only when there are no files in the list. + * the current file index is in current_n() + */ + fim_int cf_; + +#ifndef FIM_WINDOWS + /* when compiled with no multiple windowing support, one viewport only will last. */ + Viewport *only_viewport_; +#endif /* FIM_WINDOWS */ + CommandConsole &commandConsole_; + Image *image(void)const; + +#ifdef FIM_READ_STDIN_IMAGE + Image *default_image_; // experimental +#endif /* FIM_READ_STDIN_IMAGE */ + Viewport* viewport(void)const; + + int current_n(void)const; + int current_n(int ccp)const; + const fim::string pop(fim::string filename=FIM_CNS_EMPTY_STRING); + fim::string get_next_filename(int n)const; + + fim_int current_image(void)const; + public: + fim::string last_regexp_; // was private + int last_src_dir_; + Cache cache_; // was private +#ifdef FIM_READ_STDIN_IMAGE + void set_default_image(Image *stdin_image); +#endif /* FIM_READ_STDIN_IMAGE */ + const Image *c_image(void)const; // was private + int empty_file_list(void)const; + + Browser(CommandConsole &cc); + ~Browser(void) { } + private: + Browser& operator= (const Browser &b){return *this;/* a disabled copy constructor */} + Browser(const Browser &b): + Namespace(b), + flist_(args_t()), +#if FIM_WANT_PIC_LBFL + tlist_(args_t()), +#endif /* FIM_WANT_PIC_LBFL */ +#if FIM_WANT_PIC_LBFL + llist_(args_t()), +#endif /* FIM_WANT_PIC_LBFL */ + nofile_(""), + cf_(0), + commandConsole_(cc), +#ifdef FIM_READ_STDIN_IMAGE + default_image_(FIM_NULL), +#endif /* FIM_READ_STDIN_IMAGE */ + last_regexp_(fim::string()), + last_src_dir_(0), + cache_(Cache()) + {} + public: + fim::string current(void)const; + fim::string regexp_goto(const args_t &args, int src_dir=1); + fim::string fcmd_prefetch(const args_t &args); + fim::string fcmd_goto_image(const args_t &args); + fim::string goto_image_internal(const fim_char_t *s, fim_xflags_t xflags); + fim::string goto_image(int n, bool isfg=false); + fim::string fcmd_align(const args_t &args); + fim::string pan(const args_t &args); + fim::string fcmd_scrolldown(const args_t &args); + fim::string fcmd_scrollforward(const args_t &args); + fim::string fcmd_scale(const args_t &args); +#if FIM_WANT_FAT_BROWSER + fim::string fcmd_reduce(const args_t &args); + fim::string fcmd_magnify(const args_t &args); + fim::string fcmd_next(const args_t &args); + fim::string fcmd_prev(const args_t &args); + fim::string fcmd_no_image(const args_t &args); +#endif /* FIM_WANT_FAT_BROWSER */ + fim::string fcmd_rotate(const args_t &args);/* FIXME : UNFINISHED */ + fim::string fcmd_display(const args_t &args); + fim::string display_status(const fim_char_t *l); + fim::string fcmd_negate(const args_t &args); + fim::string fcmd_desaturate(const args_t &args); + +#if FIM_WANT_PIC_LBFL + fim::string fcmd_limit(const args_t &args); +#endif /* FIM_WANT_PIC_LBFL */ + fim::string fcmd_reload(const args_t &args); + fim::string fcmd_list(const args_t &args); + fim::string do_push(const args_t &args); + fim::string prev(int n=1); + fim::string fcmd_info(const args_t &args); + fim::string info(void); + std::ostream& print(std::ostream &os)const; + void redisplay(void); + fim::string fcmd_redisplay(const args_t &args); + fim::string fcmd_load(const args_t &args); + const fim::string pop_current(void); + fim::string pop_current(const args_t &args); + bool present(const fim::string nf)const; + fim_int find_file_index(const fim::string nf)const; +#ifdef FIM_READ_DIRS + bool push_dir(fim::string nf, fim_flags_t pf=FIM_FLAG_PUSH_REC); +#endif /* FIM_READ_DIRS */ + bool push(fim::string nf, fim_flags_t pf=FIM_FLAG_PUSH_REC); + + fim::string display(void); + fim::string _random_shuffle(bool dts=true); + fim::string _sort(const fim_char_t sc='f'); + fim::string _clear_list(void); + private: + fim::string do_filter(const args_t &args, MatchMode rm=FullFileNameMatch, bool negative=false, enum FilterAction faction = Delete); + fim_err_t loadCurrentImage(void); + fim::string reload(void); + + fim_int n_files(void)const; + fim_int n_pages(void)const; + fim::string _reverse(void); + fim::string next(int n=1); + + void free_current_image(void); + int load_error_handle(fim::string c); + public: + fim_int c_page(void)const; + virtual size_t byte_size(void)const; + fim_float_t file_progress(void)const { /* FIXME: relies on range 0... */ double fp = (((double)(1+this->current_n()))/this->n_files()); return FIM_MIN(1.0,fp);} +}; +} + +#endif /* FIM_BROWSER_H */ diff --git a/src/CACADevice.cpp b/src/CACADevice.cpp new file mode 100644 index 0000000..6c31233 --- /dev/null +++ b/src/CACADevice.cpp @@ -0,0 +1,371 @@ +/* $LastChangedDate: 2015-12-19 01:44:41 +0100 (Sat, 19 Dec 2015) $ */ +/* + CACADevice.cpp : cacalib device Fim driver file + + (c) 2008-2015 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/* 20080504 this CACA driver doesn't work yet */ + +#include "fim.h" + +#ifdef FIM_WITH_CACALIB + +#include "CACADevice.h" + +#define min(x,y) ((x)<(y)?(x):(y)) + + int CACADevice::clear_rect_( + void* dst, // destination gray array and source rgb array + int oroff,int ocoff, // row and column offset of the first output pixel + int orows,int ocols, // rows and columns drawable in the output buffer + int ocskip // output columns to skip for each line + ) + { + /* output screen variables */ + int + oi,// output image row index + oj;// output image columns index + + int gray; + int idr,idc,lor,loc; + + if( oroff <0 ) return -8; + if( ocoff <0 ) return -9; + if( orows <=0 ) return -10; + if( ocols <=0 ) return -11; + if( ocskip<0 ) return -12; + + if( oroff>orows ) return -8-10*100; + if( ocoff>ocols ) return -9-11*100; + + if( ocskipirows ) return -3-4*100 ; + if( icoff>icols ) return -4-6*100; + if( oroff>orows ) return -8-10*100; + if( ocoff>ocols ) return -9-11*100; + + if( icskipdata:FIM_NULL;// source rgb array + if ( !rgb ) return FIM_ERR_GENERIC; + + if( iroff <0 ) return -2; + if( icoff <0 ) return -3; + if( irows <=0 ) return -4; + if( icols <=0 ) return -5; + if( icskip<0 ) return -6; + if( oroff <0 ) return -7; + if( ocoff <0 ) return -8; + if( orows <=0 ) return -9; + if( ocols <=0 ) return -10; + if( ocskip<0 ) return -11; + if( flags <0 ) return -12; + + if( iroff>irows ) return -2-3*100 ; + if( icoff>icols ) return -3-5*100; +// if( oroff>orows ) return -7-9*100;//EXP +// if( ocoff>ocols ) return -8-10*100;//EXP + if( oroff>height() ) return -7-9*100;//EXP + if( ocoff>width()) return -8-10*100;//EXP + + if( icskip height() ) return -9 -99*100; + if( ocols > width() ) return -10-99*100; + if( ocskip < width() ) return -11-99*100; + if( icskip + +/* 20080504 this CACA driver doesn't work yet */ +class CACADevice:public DisplayDevice +{ + private: + unsigned int r[256], g[256], b[256], a[256]; + + int XSIZ, YSIZ; + struct caca_bitmap *caca_bitmap; + fim_char_t *bitmap; + + public: +#ifndef FIM_WANT_NO_OUTPUT_CONSOLE + CACADevice(MiniConsole & mc_):DisplayDevice(mc_){} +#else /* FIM_WANT_NO_OUTPUT_CONSOLE */ + CACADevice():DisplayDevice(){} +#endif /* FIM_WANT_NO_OUTPUT_CONSOLE */ + + fim_err_t display( + void *ida_image_img, // source image structure (struct ida_image *)(but we refuse to include header files here!) + //void* rgb,// destination gray array and source rgb array + fim_coo_t iroff,fim_coo_t icoff, // row and column offset of the first input pixel + fim_coo_t irows,fim_coo_t icols,// rows and columns in the input image + fim_coo_t icskip, // input columns to skip for each line + fim_coo_t oroff,fim_coo_t ocoff,// row and column offset of the first output pixel + fim_coo_t orows,fim_coo_t ocols,// rows and columns to draw in output buffer + fim_coo_t ocskip,// output columns to skip for each line + fim_flags_t flags// some flags + ); + int initialize(sym_keys_t &sym_keys); + void finalize(void); + + int get_chars_per_line(void); + int txt_width(void); + int txt_height(void); + int width(void); + int height(void); + fim_err_t status_line(const fim_char_t *msg); + void status_screen(int desc,int draw_output){} + fim_err_t console_control(fim_cc_t code); + fim_bool_t handle_console_switch(void); + int clear_rect_( + void* dst, + int oroff,int ocoff, + int orows,int ocols, + int ocskip); + fim_err_t clear_rect(fim_coo_t x1, fim_coo_t x2, fim_coo_t y1,fim_coo_t y2); + fim_err_t fill_rect(fim_coo_t x1, fim_coo_t x2, fim_coo_t y1,fim_coo_t y2, fim_color_t color) {/* FIXME: bogus implementation */ return clear_rect(x1,x2,y1,y2); } + fim_err_t fs_puts(struct fs_font *f, fim_coo_t x, fim_coo_t y, const fim_char_t *str); + + int get_chars_per_column(void); + fim_bpp_t get_bpp(void) + { + return 1; + } + virtual fim_coo_t status_line_height(void)const; + fim_sys_int get_input(fim_key_t * c, bool want_poll=false); +}; + + +#endif /* FIM_WITH_CACALIB */ +#endif /* FIM_CACADEVICE_H */ diff --git a/src/Cache.cpp b/src/Cache.cpp new file mode 100644 index 0000000..c4e32a8 --- /dev/null +++ b/src/Cache.cpp @@ -0,0 +1,795 @@ +/* $LastChangedDate: 2017-04-17 14:54:21 +0200 (Mon, 17 Apr 2017) $ */ +/* + Cache.cpp : Cache manager source file + + (c) 2007-2017 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +#include "fim.h" +/* #include */ +#ifdef HAVE_SYS_TIME_H + #include +#else /* HAVE_SYS_TIME_H */ + #include +#endif /* HAVE_SYS_TIME_H */ + +#define FIM_CACHE_INSPECT 0 +#if FIM_CACHE_INSPECT +#define FIM_PR(X) printf("CACHE:%c:%20s:%s",X,__func__,getReport(FIM_CR_CD).c_str()); +#else /* FIM_CACHE_INSPECT */ +#define FIM_PR(X) +#endif /* FIM_CACHE_INSPECT */ + +//#define FIM_CACHE_DEBUG 0 + +#if 0 +#define FIM_LOUD_CACHE_STUFF FIM_PR(-10); FIM_LINE_COUT +#else +#define FIM_LOUD_CACHE_STUFF +#endif +#define FIM_VCBS(VI) ( sizeof(VI) + VI.size() * ( sizeof(vcachels_t::mapped_type) + sizeof(vcachels_t::key_type) ) ) +/* TODO: maybe fim_basename_of is excessive ? */ + extern CommandConsole cc; +namespace fim +{ + static fim_time_t fim_time(void) /* stand-alone function */ + { +#ifdef HAVE_SYS_TIME_H + struct timeval tv; + const fim_time_t prec = 1000; /* fraction of second precision */ + gettimeofday(&tv, NULL); + return tv.tv_sec * prec + tv.tv_usec / ( 1000000 / prec ); +#else /* HAVE_SYS_TIME_H */ + return time(NULL); +#endif /* HAVE_SYS_TIME_H */ + } + + fim_time_t Cache::reltime(void)const + { + return fim_time()-time0_; + } + + Cache::Cache(void) + :Namespace(&cc) +#if FIM_WANT_BDI + ,dummy_img_() +#endif /* FIM_WANT_BDI */ + { + /* FIXME : potential flaw ? */ + FIM_LOUD_CACHE_STUFF; + lru_.erase(lru_.begin(),lru_.end()); + time0_ = fim_time(); + } + + int Cache::cached_elements(void)const + { + FIM_LOUD_CACHE_STUFF; + return imageCache_.size(); + } + + Image* Cache::get_lru( bool unused )const + { + lru_t::const_iterator lrui; + + /* warning : syscall ! */ + fim_time_t m_time; + m_time = reltime(); + Image* l_img=NULL; + cachels_t::const_iterator ci; + FIM_LOUD_CACHE_STUFF; + + if ( cached_elements() < 1 ) + goto ret; + + for( ci=imageCache_.begin();ci!=imageCache_.end();++ci) + if( ci->second /* <- so we can call this function in some intermediate states .. */ + && last_used(ci->first) < m_time && ( (! unused) || (used_image(ci->first)<=0) ) ) + { + l_img = ci->second; + m_time = last_used(ci->first); + } +ret: + return l_img; + } + + bool Cache::free_all(void) + { + /* + * free all unused elements from the cache + */ + rcachels_t rcc = reverseCache_; + + FIM_LOUD_CACHE_STUFF; + FIM_PR(' '); + for( rcachels_t::const_iterator rcci=rcc.begin(); rcci!=rcc.end();++rcci ) + if(usageCounter_[rcci->first->getKey()]==0) + erase( rcci->first ); + return true; + } + + int Cache::free_some_lru(void) + { + /* + * this triggering deletion (and memory freeing) of cached elements + * (yes, it is a sort of garbage collector, with its pros and cons) + */ + FIM_LOUD_CACHE_STUFF; + FIM_PR(' '); + if ( cached_elements() < 1 ) + return 0; + return erase( get_lru(true) ); + } + + int Cache::erase_clone(fim::Image* oi) + { + FIM_LOUD_CACHE_STUFF; + FIM_PR(' '); +#ifdef FIM_CACHE_DEBUG + std::cout << "erasing clone " << fim_basename_of(oi->getName()) << "\n"; +#endif /* FIM_CACHE_DEBUG */ + cloneUsageCounter_.erase(oi); + delete oi; + clone_pool_.erase(oi); + return 0; + } + + bool Cache::need_free(void)const + { + /* temporary : we free elements for more than some cached images */ + + /* + struct mallinfo mi = mallinfo(); + cout << "allocated : " << mi.uordblks << "\n"; + if( mi.uordblks > getIntGlobalVariable(FIM_VID_MAX_CACHED_MEMORY) ) + return true; + + these are not the values we want .. + */ + int mci = getGlobalIntVariable(FIM_VID_MAX_CACHED_IMAGES); + int mcm = getGlobalIntVariable(FIM_VID_MAX_CACHED_MEMORY); /* getIntGlobalVariable */ + size_t smcm = mcm > 0 ? mcm : 0; + + if( smcm > 0 && img_byte_size()/FIM_CNS_CSU > smcm ) + goto rt; + + if(mci==-1) + goto rf; + + /* return ( cached_elements() > ( ( mci>0)?mci:-1 ) ); */ + if(mci > 0 && cached_elements() > mci) + goto rt; +rf: + return false; +rt: + return true; + } + + int Cache::used_image(cache_key_t key)const + { + /* acca' nun stimm'a'ppazzia' */ + //return usageCounter_[key] ; + FIM_LOUD_CACHE_STUFF; + return ( usageCounter_.find(key)!=usageCounter_.end() ) ? (*(usageCounter_.find(key))).second : 0; + } + + bool Cache::is_in_clone_cache(fim::Image* oi)const + { + /* acca' nun stimm'a'ppazzia' */ + FIM_LOUD_CACHE_STUFF; + if(!oi) + return -1; + //return *(clone_pool_.find(oi))==oi; + return ( clone_pool_.find(oi)!=clone_pool_.end() ) + && + ((*clone_pool_.find(oi)) == oi ); + } + + bool Cache::is_in_cache(cache_key_t key)const + { + /* acca' nun stimm'a'ppazzia' */ + //return imageCache_[key]!=NULL; + FIM_LOUD_CACHE_STUFF; + return ( imageCache_.find(key)!=imageCache_.end() ) + && + ((*(imageCache_.find(key))).second!=NULL) ; + } + + bool Cache::is_in_cache(fim::Image* oi)const + { + /* acca' nun stimm'a'ppazzia' */ + FIM_LOUD_CACHE_STUFF; + if(!oi) + return -1; + return ( reverseCache_.find(oi)!=reverseCache_.end() ) + && + ( (*(reverseCache_.find(oi))).second.first.c_str()== oi->getKey().first ); + } + +#if 0 + int Cache::free(fim::Image* oi) + { + /* acca' nun stimm'a'ppazzia' */ + if(!oi) + return -1; + + if(!is_in_cache(oi)) + { +#if 0 + /* if the image is not already one of ours, it + * is probably a cloned one, and the caller + * didn't know this. + * + * in this case we keep it in the cache, + * so it could be useful in the future. + * */ + if( oi->revertToLoaded() )//removes internal scale caches + cacheImage( oi ); //FIXME : validity should be checked .. +#else + delete oi; +#endif + return 0; + } + + /* + * fixme : we should explicitly mark for deletion someday.. + * */ + + //if(need_free())return erase(oi); + /* careful here !! */ + //if(need_free())free_some_lru(); + else return 0; /* no free needed */ + } +#endif + + int Cache::prefetch(cache_key_t key) + { + int retval = 0; + FIM_PR('*'); + + FIM_LOUD_CACHE_STUFF; + if(is_in_cache(key)) + { + FIM_PR('c'); + goto ret; + } +#if 0 + if(need_free()) + free_some_lru(); + if(need_free()) + { + FIM_PR('f'); + goto ret; /* skip prefetch if cache is full */ + } +#endif + if(key.first == FIM_STDIN_IMAGE_NAME) + { + FIM_PR('s'); + goto ret;// just a fix in the case the browser is still lame + } +#ifdef FIM_CACHE_DEBUG + std::cout << "prefetch request for "<< key.first << " \n"; +#endif /* FIM_CACHE_DEBUG */ + + if( regexp_match(key.first.c_str(),FIM_CNS_ARCHIVE_RE,1) ) + { + /* FIXME: This is a hack. One shall determine unprefetchability othwerwise. */ + FIM_PR('j'); + goto ret; + } + + if(!loadNewImage(key,0,true)) + { + retval = -1; +#ifdef FIM_CACHE_DEBUG + std::cout << "loading failed\n"; +#endif /* FIM_CACHE_DEBUG */ + goto ret; + } + else + { + FIM_PR('l'); + } + setGlobalVariable(FIM_VID_CACHED_IMAGES,(fim_int)cached_elements()); + setGlobalVariable(FIM_VID_CACHE_STATUS,getReport().c_str()); +ret: + FIM_PR('.'); + return retval; + } + + Image * Cache::loadNewImage(cache_key_t key, fim_page_t page, fim_bool_t delnc) + { + Image *ni = NULL; + FIM_PR('*'); + + FIM_LOUD_CACHE_STUFF; + /* load attempt as alternative approach */ + try + { + if( ( ni = new Image(key.first.c_str(), NULL, page) ) ) + { +#ifdef FIM_CACHE_DEBUG + std::cout << "loadNewImage("<cacheable() ) + cacheNewImage( ni ); + else + if (delnc) // delete non cacheable + { + delete ni; + ni = NULL; + } + } + } + catch(FimException e) + { + FIM_PR('E'); + ni = NULL; /* not a big problem */ +// if( e != FIM_E_NO_IMAGE )throw FIM_E_TRAGIC; /* hope this never occurs :P */ + } +ret: + FIM_PR(' '); + return ni; + } + + Image * Cache::getCachedImage(cache_key_t key) + { + /* + * returns an image if already in cache .. + * */ + Image *ni = NULL; + FIM_LOUD_CACHE_STUFF; + FIM_PR(' '); + + /* acca' nun stimm'a'ppazzia' */ + //if(!key.first)return ni; + + /* cache lookup */ + //this->cached_elements(); + if( ( ni = this->imageCache_[key]) ) + { + this->lru_touch(key); + } + return ni; + } + + bool Cache::cacheNewImage( fim::Image* ni ) + { + FIM_LOUD_CACHE_STUFF; + FIM_PR(' '); +#ifdef FIM_CACHE_DEBUG + std::cout << "going to cache: "<< ni << "\n"; +#endif /* FIM_CACHE_DEBUG */ + this->imageCache_[ni->getKey()]=ni; + this->reverseCache_[ni]= ni->getKey(); + lru_touch( ni->getKey() ); + usageCounter_[ ni->getKey()]=0; // we yet don't assume any usage + setGlobalVariable(FIM_VID_CACHED_IMAGES,(fim_int)cached_elements()); + return true; + } + + int Cache::erase(fim::Image* oi) + { + /* + * erases the image from the image cache + * */ + /* acca' nun stimm'a'ppazzia' */ + int retval=-1; + FIM_PR(' '); + + FIM_LOUD_CACHE_STUFF; + if(!oi) + { + goto ret; + } + + if(is_in_cache(oi) ) + { + usageCounter_[oi->getKey()]=0; + /* NOTE : the user should call usageCounter_.erase(key) after this ! */ +#ifdef FIM_CACHE_DEBUG + std::cout << "will erase "<< oi << " " << fim_basename_of(oi->getName()) << " time:"<< lru_[oi] << "\n"; + std::cout << "erasing original " << fim_basename_of(oi->getName()) << "\n"; +#endif /* FIM_CACHE_DEBUG */ + lru_.erase(oi); + imageCache_.erase(reverseCache_[oi]); + reverseCache_.erase(oi); +// delete imageCache_[reverseCache_[oi]]; + delete oi; + setGlobalVariable(FIM_VID_CACHED_IMAGES,(fim_int)cached_elements()); + retval = 0; + } +ret: + return retval; + } + + fim_time_t Cache::last_used(cache_key_t key)const + { + fim_time_t retval=0; + + FIM_LOUD_CACHE_STUFF; + if(imageCache_.find(key)==imageCache_.end()) + goto ret; + if(lru_.find(imageCache_.find(key)->second )==lru_.end()) + goto ret; + retval = lru_.find(imageCache_.find(key)->second )->second; +ret: + return retval; + } + + int Cache::lru_touch(cache_key_t key) + { + /* + * if the specified file is cached, in this way it is marked as used, too + * + * NOTE : the usage count is not affected, + * */ + FIM_LOUD_CACHE_STUFF; + FIM_PR(' '); +// std::cout << lru_[imageCache_[key]] << " -> "; + lru_[imageCache_[key]]= reltime(); +// std::cout << lru_[imageCache_[key]] << "\n"; + return 0; + } + + bool Cache::freeCachedImage(Image *image, const ViewportState *vsp) + { + /* + * TODO: rename to free(). + * + * If the supplied image is cached as a master image of a clone, it is freed and deregistered. + * If not, no action is performed. + * */ + // WARNING : FIXME : DANGER !! + FIM_LOUD_CACHE_STUFF; + FIM_PR('*'); + + if( !image ) + goto err; + +// if( is_in_cache(image) && usageCounter_[image->getKey()]==1 ) + if(vsp) + { + viewportInfo_[image->getKey()] = *vsp; + } + if( is_in_clone_cache(image) ) + { + usageCounter_[image->getKey()]--; + FIM_PR('c'); + erase_clone(image); // we _always_ immediately delete clones + setGlobalVariable(FIM_VID_CACHE_STATUS,getReport().c_str()); + goto ret; + } + else + if( is_in_cache(image) ) + { + FIM_PR('-'); + lru_touch( image->getKey() ); // we have been using it until now + usageCounter_[image->getKey()]--; +#if FIM_WANT_EXPERIMENTAL_MIPMAPS + image->mm_free(); +#endif /* FIM_WANT_EXPERIMENTAL_MIPMAPS */ + if( + (usageCounter_[image->getKey()])==0 && + image->getKey().second!=FIM_E_STDIN + ) + { +#if 0 + if( need_free() && image->getKey().second!=FIM_E_STDIN ) + { + cache_key_t key = image->getKey(); + this->erase( image ); + usageCounter_.erase(key); + } +#else + /* doing it here is dangerous : */ + if( need_free() ) + { + Image * lrui = get_lru(true); + FIM_PR('o'); + if( lrui ) + { + cache_key_t key = lrui->getKey(); + if( FIM_VCBS(viewportInfo_) > FIM_CNS_VICSZ ) + viewportInfo_.erase(key); + if(( key.second != FIM_E_STDIN )) + { + this->erase( lrui ); + usageCounter_.erase(key); + } + } + // missing usageCounter_.erase().. + } +#endif + } + setGlobalVariable(FIM_VID_CACHE_STATUS,getReport().c_str()); + goto ret; + } +err: + FIM_PR('.'); + return false; +ret: + FIM_PR('.'); + return true; + } + + Image * Cache::useCachedImage(cache_key_t key, ViewportState *vsp, fim_page_t page) + { + /* + * TODO: rename to get(). + * + * The caller invokes this member function to obtain an Image object pointer. + * If the object is cached and it already used, a clone is built and returned. + * + * If we have an unused master copy, we return that. + * + * Then declare this image as used and increase a relative counter. + * + * A freeImage action will do the converse operation (and delete). + * If the image is not already cached, it is loaded, if possible. + * + * So, if there is no such image, NULL is returned + * */ + Image * image = NULL; + + FIM_LOUD_CACHE_STUFF; + FIM_PR('*'); +#ifdef FIM_CACHE_DEBUG + std::cout << " useCachedImage(\""<cacheable()) + goto ret; // we keep it but don't cache it + usageCounter_[key]=1; + } + else // is_in_cache(key) + { + image = getCachedImage(key);// in this way we update the LRU cache :) + if(!image) + { +#ifdef FIM_CACHE_DEBUG + cout << "critical internal cache error!\n"; +#endif /* FIM_CACHE_DEBUG */ + goto done; + } + if( used_image( key ) ) + { + // if the image was already used, cloning occurs +// image = image->getClone(); // EVIL !! + try + { +#ifdef FIM_CACHE_DEBUG + Image * oi=image; +#endif /* FIM_CACHE_DEBUG */ + image = new Image(*image); // cloning +#ifdef FIM_CACHE_DEBUG + std::cout << " cloned image: \"" <getName())<< "\" "<< image << " from \""<getName()) <<"\" " << oi << "\n"; +#endif /* FIM_CACHE_DEBUG */ + } + catch(FimException e) + { + FIM_PR('E'); + /* we will survive :P */ + image = NULL; /* we make sure no taint remains */ +// if( e != FIM_E_NO_IMAGE )throw FIM_E_TRAGIC; /* hope this never occurs :P */ + } + if(!image) + goto ret; //means that cloning failed. + clone_pool_.insert(image); // we have a clone + cloneUsageCounter_[image]=1; + } +#if FIM_WANT_EXPERIMENTAL_MIPMAPS + if(getGlobalIntVariable(FIM_VID_WANT_MIPMAPS)>0) + if(!image->has_mm()) + image->mm_make(); +#endif /* FIM_WANT_EXPERIMENTAL_MIPMAPS */ + lru_touch( key ); + // if loading and eventual cloning succeeded, we count the image as used of course + usageCounter_[key]++; + } +done: + setGlobalVariable(FIM_VID_CACHE_STATUS,getReport().c_str()); +ret: + if(vsp && image) + { + *vsp = viewportInfo_[image->getKey()]; + /* *vsp = viewportInfo_[key]; */ + } + FIM_PR('.'); + return image; + } + + Image * Cache::setAndCacheStdinCachedImage(Image * image) + { + /* FIXME : document me + * */ + cache_key_t key(FIM_STDIN_IMAGE_NAME,FIM_E_STDIN); + FIM_LOUD_CACHE_STUFF; + FIM_PR('*'); + + if(!image) + goto ret; + + try + { +#ifdef FIM_CACHE_DEBUG + Image * oi=image; +#endif /* FIM_CACHE_DEBUG */ + image = new Image(*image); // cloning + if(image) + { + cacheNewImage( image ); + } + } + catch(FimException e) + { + FIM_PR('E'); + /* we will survive :P */ + image = NULL; /* we make sure no taint remains */ +// if( e != FIM_E_NO_IMAGE )throw FIM_E_TRAGIC; /* hope this never occurs :P */ + } + if(!image) + goto ret; //means that cloning failed. + setGlobalVariable(FIM_VID_CACHE_STATUS,getReport().c_str()); +ret: + return image; //so, it could be a clone.. + } + + fim::string Cache::getReport(int type)const + { + /* TODO: rename to info(). */ + fim::string cache_report; + + if(type == FIM_CR_CN || type == FIM_CR_CD) + { + fim_char_t buf[FIM_PRINTFNUM_BUFSIZE]; + int mci = getGlobalIntVariable(FIM_VID_MAX_CACHED_IMAGES); + int mcm = getGlobalIntVariable(FIM_VID_MAX_CACHED_MEMORY); + mcm = mcm >= 0 ? mcm*FIM_CNS_CSU:0; + cache_report = " "; + cache_report += "count:"; + cache_report += fim::string(cached_elements()); + cache_report += "/"; + cache_report += fim::string(mci); + cache_report += " "; + cache_report += "occupation:"; + fim_snprintf_XB(buf, sizeof(buf), img_byte_size());cache_report += buf; + cache_report += "/"; + fim_snprintf_XB(buf, sizeof(buf), mcm);cache_report += buf; + cache_report += " "; + for(ccachels_t::const_iterator ci=usageCounter_.begin();ci!=usageCounter_.end();++ci) + if( + ( type == FIM_CR_CD && ( imageCache_.find(ci->first) != imageCache_.end() ) ) || + ( type == FIM_CR_CN && ( imageCache_.find(ci->first) != imageCache_.end() && ci->second) ) + ) + { + cache_report+= fim_basename_of((*ci).first.first.c_str()); + cache_report+=":"; + cache_report+=fim::string((*ci).second); + cache_report+=":"; + fim_snprintf_XB(buf, sizeof(buf), imageCache_.find(ci->first)->second->byte_size()); + cache_report += buf; + cache_report+="@"; + cache_report+=fim::string((size_t)last_used(ci->first)); + cache_report+=" "; + } + cache_report += "\n"; + goto ret; + } + cache_report = "cache contents : \n"; + FIM_LOUD_CACHE_STUFF; +#if 0 + cachels_t::const_iterator ci; + for( ci=imageCache_.begin();ci!=imageCache_.end();++ci) + { + cache_report+=((*ci).first); + cache_report+=" "; + cache_report+=fim::string(usageCounter_[((*ci).first)]); + cache_report+="\n"; + } +#else + for(ccachels_t::const_iterator ci=usageCounter_.begin();ci!=usageCounter_.end();++ci) + { + cache_report+=((*ci).first.first); + cache_report+=":"; + cache_report+=fim::string((*ci).first.second); + cache_report+=" ,usage:"; + cache_report+=fim::string((*ci).second); + cache_report+="\n"; + } + cache_report += "clone pool contents : \n"; + for(std::set< fim::Image* >::const_iterator cpi=clone_pool_.begin();cpi!=clone_pool_.end();++cpi) + { + cache_report+=fim_basename_of((*cpi)->getName()); + cache_report+=" " ; + cache_report+= string((int*)(*cpi)) ; + cache_report+=","; + } + cache_report+="\n"; +#endif +ret: + return cache_report; + } + + Cache::~Cache(void) + { + cachels_t::const_iterator ci; + FIM_LOUD_CACHE_STUFF; + for( ci=imageCache_.begin();ci!=imageCache_.end();++ci) + if(ci->second) + { +#ifdef FIM_CACHE_DEBUG + std::cout << "about to free " << (ci->first.first) << "\n"; +#endif /* FIM_CACHE_DEBUG */ + delete ci->second; + } + imageCache_.clear(); /* destroy Image objects */ + } + + size_t Cache::img_byte_size(void)const + { + size_t bs = 0; + cachels_t::const_iterator ci; + + FIM_LOUD_CACHE_STUFF; + for( ci=imageCache_.begin();ci!=imageCache_.end();++ci) + if(ci->second) + bs += ci->second->byte_size(); + return bs; + } + + size_t Cache::byte_size(void)const + { + size_t bs = 0; + cachels_t::const_iterator ci; + FIM_LOUD_CACHE_STUFF; + bs += img_byte_size(); + bs += sizeof(*this); + bs += FIM_VCBS(viewportInfo_); + /* + bs += sizeof(usageCounter_); + bs += sizeof(reverseCache_); */ + /* TODO: incomplete ... */ + return bs; + } + + void Cache::touch(cache_key_t key) + { + FIM_PR('*'); + getCachedImage(key); + FIM_PR('.'); + } + + void Cache::desc_update(void) + { + /* TODO: report error code */ +#if FIM_WANT_PIC_CMTS + cachels_t::const_iterator ci; + + FIM_LOUD_CACHE_STUFF; + for( ci=imageCache_.begin();ci!=imageCache_.end();++ci) + if(ci->second) + ci->second->desc_update(); +#endif /* FIM_WANT_PIC_CMTS */ + } +} + diff --git a/src/Cache.h b/src/Cache.h new file mode 100644 index 0000000..ab4c956 --- /dev/null +++ b/src/Cache.h @@ -0,0 +1,132 @@ +/* $LastChangedDate: 2015-12-14 23:25:55 +0100 (Mon, 14 Dec 2015) $ */ +/* + Cache.h : Cache manager header file + + (c) 2007-2015 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +#ifndef FIM_CACHE_H +#define FIM_CACHE_H +#include "fim.h" + +#ifdef HAVE_SYS_TIME_H +#include +#include +typedef uint64_t fim_time_t; +#else /* HAVE_SYS_TIME_H */ +typedef time_t fim_time_t; +#endif /* HAVE_SYS_TIME_H */ +#define FIM_CR_BS 0 /* base */ +#define FIM_CR_CN 1 /* not detailed */ +#define FIM_CR_CD 2 /* detailed */ +namespace fim +{ +#ifdef FIM_NAMESPACES +class Cache:public Namespace +#else +class Cache +#endif /* FIM_NAMESPACES */ +{ + typedef std::map lru_t; //filename - last usage time + typedef std::map cachels_t; //filename - image + typedef std::map rcachels_t; //image - filename + typedef std::map ccachels_t; //filename - counter + typedef std::map vcachels_t; //filename to viewport state + typedef std::map > cloned_cachels_t; //filename - cloned images?? + typedef std::map cuc_t; //image - filename + + cachels_t imageCache_; + rcachels_t reverseCache_; + lru_t lru_; + ccachels_t usageCounter_; + vcachels_t viewportInfo_; + cloned_cachels_t cloneCache_; + cuc_t cloneUsageCounter_; + std::set< fim::Image* > clone_pool_; + time_t time0_; +// clone_counter_t cloneCounter; + + /* whether we should free some cache .. */ + bool need_free(void)const; + + /**/ + int lru_touch(cache_key_t key); + + bool is_in_cache(fim::Image* oi)const; + bool is_in_cache(cache_key_t key)const; + bool is_in_clone_cache(fim::Image* oi)const; + fim_time_t last_used(cache_key_t key)const; + + bool cacheNewImage( fim::Image* ni ); + Image * loadNewImage(cache_key_t key, fim_page_t page, fim_bool_t delnc); + + /* returns an image from the cache or loads it from disk marking it as used in the LRU (internal) */ + Image * getCachedImage(cache_key_t key); + + /* the caller declares this image as free */ +// int free(fim::Image* oi); + + /* erases the image from the cache */ + int erase(fim::Image* oi); + + /* erases the image clone from the cache */ + int erase_clone(fim::Image* oi); + + /* get the lru_ element. if unused is true, only an unused image will be returned, _if any_*/ + Image* get_lru( bool unused = false )const; + + int free_some_lru(void); + + bool free_all(void); + + int used_image(cache_key_t key)const; + + fim_time_t reltime(void)const; + + public: + Cache(void); + +#if FIM_WANT_BDI + Image dummy_img_; // experimental +#endif /* FIM_WANT_BDI */ + + /* free() and counter update */ + bool freeCachedImage(Image *image, const ViewportState *vsp); + + /* getCachedImage() and counter update */ + Image * useCachedImage(cache_key_t key, ViewportState *vsp, fim_page_t page = 0); + + /* FIXME */ + Image * setAndCacheStdinCachedImage(Image * image); + + /**/ + int prefetch(cache_key_t key); + + void touch(cache_key_t key); + + fim::string getReport(int type = FIM_CR_CD )const; + ~Cache(void); + virtual size_t byte_size(void)const; + size_t img_byte_size(void)const; + + /* the count of cached images */ + int cached_elements(void)const; + void desc_update(void); +}; +} + +#endif /* FIM_CACHE_H */ + diff --git a/src/Command.cpp b/src/Command.cpp new file mode 100644 index 0000000..a37de5b --- /dev/null +++ b/src/Command.cpp @@ -0,0 +1,25 @@ +/* $LastChangedDate: 2013-07-04 19:38:23 +0200 (Thu, 04 Jul 2013) $ */ +/* + Command.cpp : + + (c) 2007-2013 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "fim.h" +namespace fim +{ +} diff --git a/src/Command.h b/src/Command.h new file mode 100644 index 0000000..af12a2b --- /dev/null +++ b/src/Command.h @@ -0,0 +1,88 @@ +/* $LastChangedDate: 2015-12-19 01:58:26 +0100 (Sat, 19 Dec 2015) $ */ +/* + Command.h : Fim Command class header file + + (c) 2007-2015 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +#ifndef FIM_COMMAND_H +#define FIM_COMMAND_H +#include "fim.h" +namespace fim +{ + +class Command +{ + public: + fim::string cmd_, + help_ ; + Command(fim::string cmd,fim::string help,Browser *b=FIM_NULL,fim::string(Browser::*bf)(const std::vector&)=FIM_NULL) :cmd_(cmd),help_(help),browserf(bf),browser(b),type(0) { type=BrowserT;} + Command(fim::string cmd,fim::string help,CommandConsole *c=FIM_NULL,fim::string(CommandConsole::*cf)(const std::vector&)=FIM_NULL) :cmd_(cmd),help_(help),consolef(cf),console(c),type(0) { type=CommandConsoleT;} +#ifdef FIM_WINDOWS + Command(fim::string cmd,fim::string help,FimWindow *w=FIM_NULL,fim::string(FimWindow::*cf)(const std::vector&)=FIM_NULL) :cmd_(cmd),help_(help),windowf(cf),window(w),type(0) { type=WindowT;} +#endif /* FIM_WINDOWS */ + + fim::string getHelp(void)const{return help_;} + private: + enum + { + BrowserT, +#ifdef FIM_WINDOWS + WindowT, +#endif /* FIM_WINDOWS */ + CommandConsoleT + }; + union{ + fim::string (Browser::*browserf)(const std::vector&) ; + fim::string (CommandConsole::*consolef)(const std::vector&) ; +#ifdef FIM_WINDOWS + fim::string (FimWindow::*windowf)(const std::vector&) ; +#endif /* FIM_WINDOWS */ + }; + union{ + Browser *browser; + CommandConsole *console; +#ifdef FIM_WINDOWS + FimWindow *window; +#endif /* FIM_WINDOWS */ + }; + fim_cmd_type_t type; + + public: + + ~Command(void) { } + + fim::string execute(const std::vector &args) + { + /* + * FIXME + */ + assert(browser && browserf); + + //std::cerr << "about to execute '"<*browserf)(args); + } + + bool operator < (Command c)const{return cmd_< c.cmd_;} + bool operator <=(Command c)const{return cmd_<=c.cmd_;} +}; +} +#endif /* FIM_COMMAND_H */ diff --git a/src/CommandConsole-cmd.cpp b/src/CommandConsole-cmd.cpp new file mode 100644 index 0000000..5ab8057 --- /dev/null +++ b/src/CommandConsole-cmd.cpp @@ -0,0 +1,914 @@ +/* $LastChangedDate: 2017-07-14 21:46:19 +0200 (Fri, 14 Jul 2017) $ */ +/* + CommandConsole-cmd.cpp : Fim console commands + + (c) 2009-2015 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + + + +#include "fim.h" +#ifdef HAVE_LIBGEN_H +#include +#endif /* HAVE_LIBGEN_H */ + +#define FIM_WANT_SYSTEM_CALL_DEBUG 0 + +namespace fim +{ + fim::string CommandConsole::fcmd_bind(const args_t& args) + { + /* + * this is the interactive bind command + * the user supplies a string with the key combination, and if valid, its keycode + * is associated to the user supplied action (be it a command, alias, etc..) + * FIX ME + */ + const fim_char_t *kerr=FIM_FLT_BIND" : invalid key argument (should be one of : k, C-k, K, }\n"; + const fim_char_t*kstr=FIM_NULL; + int l; + fim_key_t key=FIM_SYM_NULL_KEY; + + if(args.size()==0) + return getBindingsList(); + + kstr=(args[0].c_str()); + if(!kstr) + return kerr; + l=strlen(kstr); + if(!l) + return kerr; + +#ifdef FIM_WANT_RAW_KEYS_BINDING + if(l>=2 && isdigit(kstr[0]) && isdigit(kstr[1])) + { + /* special syntax for raw keys */ + key=atoi(kstr+1); + } +#endif /* FIM_WANT_RAW_KEYS_BINDING */ + else + { + if(sym_keys_.find(kstr)!= sym_keys_.end()) + key=sym_keys_[args[0]]; + } + if(key==FIM_SYM_NULL_KEY) + { + return "supplied key "+args[0]+" is invalid.\n"; + } + if(args.size()==1 && bindings_.find(key)==bindings_.end()) + { + return "no command bound to keycode "+string(key)+" (keysym "+args[0]+").\n"; + } + + if(args.size()==1) + { + //first arg should be a valid key code + fim::string binding_expanded; + binding_expanded+=FIM_FLT_BIND" '"; + binding_expanded+=args[0]; + binding_expanded+="' '"; + binding_expanded+=bindings_[key]; + binding_expanded+="'\n"; + return binding_expanded; + } + if(args.size()<2) + return kerr; + if(args[1]==FIM_CNS_EMPTY_STRING) + return unbind(args[0]); + + if(args.size()>=3) + bindings_help_[key]=args[2]; /* TODO: shall move to bind() */ + return bind(key,args[1]); + } + + fim::string CommandConsole::fcmd_unbind(const args_t& args) + { + /* + * unbinds the action eventually bound to the first key name specified in args.. + * IDEAS : multiple unbindings ? + * maybe you should made surjective the binding_keys mapping.. + */ + if(args.size()!=1) + return FIM_FLT_UNBIND" : specify the key to unbind\n"; + return unbind(args[0]); + } + +#if 0 + fim::string CommandConsole::fcmd_setenv(const args_t& args) + { + /* + * + */ + if(args.size()<2) return FIM_CNS_EMPTY_RESULT; + setenv(args[0].c_str(),args[1].c_str(),1); + setenv("DISPLAY","",1); + return FIM_CNS_EMPTY_RESULT; + } +#endif + + fim::string CommandConsole::fcmd_help(const args_t &args) + { + Command *cmd = FIM_NULL; + + if(!args.empty() && args[0].length()>0 ) + { + if((args[0].at(0))==FIM_CNS_SLASH_CHAR) + { + /* FIXME: this shall be regexp-based. */ + fim::string hstr,cstr,astr,bstr,ptn; + + ptn = args[0].substr(1,args[0].size()); + for(size_t i=0;ihelp_.find(ptn) != commands_[i]->help_.npos) + { + cstr += commands_[i]->cmd_; + cstr += " "; + } + + for( aliases_t::const_iterator ai=aliases_.begin();ai!=aliases_.end();++ai) + { + if(ai->first.find(ptn) != ai->first.npos) + { + astr +=((*ai).first); + astr += " "; + } + else + if(ai->second.first.find(ptn) != ai->second.first.npos) + { + astr +=((*ai).first); + astr += " "; + } + else + if(ai->second.second.find(ptn) != ai->second.second.npos) + { + astr +=((*ai).first); + astr += " "; + } + } + + for(bindings_t::const_iterator bi=bindings_.begin();bi!=bindings_.end();++bi) + { + key_syms_t::const_iterator ikbi=key_syms_.find(((*bi).first)); + bindings_help_t::const_iterator bhi=bindings_help_.find((*bi).first); + + if(ikbi!=key_syms_.end()) + { + if(ikbi->second.find(ptn) != ikbi->second.npos) + { + bstr += ikbi->second; + bstr += " "; + // std::cout << "key : " << ikbi->second << "\n"; + } + else + if(bi->second.find(ptn) != bi->second.npos) + { + bstr += ikbi->second; + bstr += " "; + // std::cout << "def : " << ikbi->second << "\n"; + } + if(bhi != bindings_help_.end() ) + if(bhi->second.find(ptn) != bhi->second.npos) + { + bstr += ikbi->second; + bstr += " "; + // std::cout << "dsc : " << ikbi->second << "\n"; + } + } + } + /* FIXME: may extend to autocmd's */ + + if(!cstr.empty()) + hstr+="Commands (type 'help' and one quoted command name to get more info):\n " + cstr + "\n"; + if(!astr.empty()) + hstr+="Aliases (type 'alias' and one quoted alias to get more info):\n " + astr + "\n"; + if(!bstr.empty()) + hstr+="Bindings (type 'bind' and one quoted binding to get more info):\n " + bstr + "\n"; + if(!hstr.empty()) + return "The following help items matched \"" + ptn + "\":\n" + hstr; + else + return "No item matched \"" + ptn + "\"\n"; + } + + { + fim::string sws; + sws = fim_help_opt(args[0].c_str()); + if(sws != FIM_CNS_EMPTY_STRING) + return sws+string("\n"); + } + cmd=findCommand(args[0]); + if(cmd) + return + string("\"")+(args[0]+string("\" is a command, documented:\n"))+ + cmd->getHelp()+string("\n"); + else + if(aliasRecall(fim::string(args[0]))!=FIM_CNS_EMPTY_STRING) + return + string("\"")+(args[0]+string("\" is an alias, and was declared as:\n"))+ + get_alias_info(args[0]); + else + { + if(isVariable(args[0])) + { + fim::string hs; + hs+=fim::string("\""); + hs+=args[0] + fim::string( "\" is a variable, with value:\n" ); + hs+=getStringVariable(args[0]); + hs+=fim::string("\nand description:\n"); + hs+=fim_var_help_db_query(args[0]); + hs+=fim::string("\n"); + return hs; + } + else + cout << args[0] << " : no such command, alias, or variable.\n"; + } + + } + this->setVariable(FIM_VID_DISPLAY_CONSOLE,(fim_int)1); + return "" FIM_FLT_HELP " " FIM_CNS_EX_ID_STRING ": provides help for " FIM_CNS_EX_ID_STRING ", if it is a variable, alias, or command. Use " FIM_KBD_TAB " in commandline mode to get a list of commands. Command line mode can be entered with the default key '" FIM_SYM_CONSOLE_KEY_STR "', and left pressing " FIM_KBD_ENTER ".\n"; + } + + fim::string CommandConsole::fcmd_quit(const args_t &args) + { + /* + * now the postcycle execution autocommands are enabled ! + * */ + show_must_go_on_=0; + if( args.size() < 1 ) + return_code_=0; + else + return_code_=(int)args[0]; + return FIM_CNS_EMPTY_RESULT; + } + +#ifndef FIM_WANT_NOSCRIPTING + fim::string CommandConsole::fcmd_executeFile(const args_t &args) + { + /* + * TODO : catch exceptions + * */ + for(size_t i=0;i0 ) fwrite(buf,rc,1,tfd); + rewind(tfd); + */ + /* + * Note that it would be much nicer to do this in another way, + * but it would require to rewrite much of the file loading stuff + * (which is quite fbi's untouched stuff right now) + * */ + Image* stream_image=FIM_NULL; + if(!tfd) + return FIM_ERR_GENERIC; + try{ stream_image=new Image(FIM_STDIN_IMAGE_NAME,fim_fread_tmpfile(tfd)); } + catch (FimException e){/* write me */} +#ifdef FIM_READ_STDIN_IMAGE + // DANGEROUS TRICK! + if(stream_image) + { + browser_.set_default_image(stream_image); + if(!cc.browser_.cache_.setAndCacheStdinCachedImage(stream_image)) + std::cerr << FIM_EMSG_CACHING_STDIN;// FIXME + browser_.push(FIM_STDIN_IMAGE_NAME); + } +#else /* FIM_READ_STDIN_IMAGE */ + /* FIXME: this point should be better not reached */ +#endif /* FIM_READ_STDIN_IMAGE */ + return FIM_ERR_NO_ERROR; + //pclose(tfd); + } + +#ifdef FIM_PIPE_IMAGE_READ + /* + * FBI/FIM FILE PROBING MECHANISMS ARE NOT THOUGHT WITH PIPES IN MIND! + * THEREFORE WE MUST FIND A SMARTER TRICK TO IMPLEMENT THIS + * */ + fim::string CommandConsole::fcmd_pread(const args_t& args) + { + /* + * we read a whole image file from pipe + * */ + size_t i; + FILE* tfd; + /* fim_char_t buf[FIM_PIPE_BUFSIZE]; int rc=0; */ + for(i=0;i= 500 + { + /* untested */ + fim_char_t *buf[PATH_MAX]; + getcwd(buf,PATH_MAX-1): + buf[PATH_MAX-1]=FIM_SYM_CHAR_NUL; + cwd=buf; + } +#endif /* _BSD_SOURCE || _XOPEN_SOURCE >= 500 */ +#endif /* HAVE_GET_CURRENT_DIR_NAME */ + return cwd; + } + +#ifndef FIM_NO_SYSTEM + fim::string CommandConsole::fcmd_system(const args_t& args) + { + /* + * executes the shell commands given in the arguments, + * one by one, and returns the (collated) standard output + * */ +#if FIM_WANT_SYSTEM_CALL_DEBUG + fim::string is=FIM_CNS_EMPTY_STRING; +#endif /* FIM_WANT_SYSTEM_CALL_DEBUG */ +#if FIM_WANT_SINGLE_SYSTEM_INVOCATION + /* 20110302 FIXME: inefficient */ + fim::string cc=FIM_CNS_EMPTY_STRING; + for(size_t i=0;i is bugful + * */ + res+=FIM_FLT_USLEEP" '"; +// res+=(int)recorded_actions_[i].second; + res+=ss; + res+="';\n"; + res+=recorded_actions_[i].first; + res+="\n"; + } + return res; + } + + fim::string CommandConsole::execute_record_buffer(const args_t &args) + { + /* + * all of the commands in the record buffer are re-executed. + * */ + if(recordMode_==Normal) + { + recordMode_=Playing; + execute_internal(dump_record_buffer(args).c_str(),FIM_X_NULL); + recordMode_=Normal; + } + /* for unknown reasons, the following code gives problems : image resizes don't work.. + * but the present (above) doesn't support interruptions ... + * */ +/* fim::string res; + for(size_t i=0;iconsole_control(0x01); + return FIM_CNS_EMPTY_RESULT; + } + + fim::string CommandConsole::scroll_down(const args_t& args) + { + if(!displaydevice_) + { } + else + displaydevice_->console_control(0x02); + return FIM_CNS_EMPTY_RESULT; + } + + fim::string CommandConsole::fcmd_clear(const args_t& args) + { + displaydevice_->console_control(0x03);//experimental + return FIM_CNS_EMPTY_RESULT; + } +#endif /* FIM_WANT_NO_OUTPUT_CONSOLE */ + + fim::string CommandConsole::fcmd_do_getenv(const args_t& args) + { + string help="usage : " FIM_FLT_GETENV " " FIM_CNS_EX_ID_STRING " will create a fim variable named " FIM_CNS_EX_ID_STRING " with value $" FIM_CNS_EX_ID_STRING " (if nonempty), from the current shell." +#ifndef HAVE_GETENV + " (note that getenv call was not available at build time, so it won't work)\n" +#endif /* HAVE_GETENV */ + ; + if( ! args.size()) + return help; +#ifdef HAVE_GETENV + if(1==args.size()) + { + if(fim_getenv(args[0].c_str())) + return setVariable( fim::string("ENV_")+args[0], fim_getenv(args[0].c_str()) ); + else + return FIM_CNS_EMPTY_RESULT; + } + else + return help; +#else /* HAVE_GETENV */ + return help; +#endif /* HAVE_GETENV */ + } + + fim::string CommandConsole::fcmd_desc(const args_t& args) + { +#if FIM_WANT_PIC_CMTS + fim_char_t sc = '\t'; + + if(2 > args.size() || args[0] != "load" ) + goto err; + if(2 < args.size()) + sc = *args[2].c_str(); + this->id_.fetch(args[1],sc); + browser_.cache_.desc_update(); +err: +#endif /* FIM_WANT_PIC_CMTS */ + return FIM_CNS_EMPTY_RESULT; + } + +} diff --git a/src/CommandConsole-help.cpp b/src/CommandConsole-help.cpp new file mode 100644 index 0000000..e8ec71d --- /dev/null +++ b/src/CommandConsole-help.cpp @@ -0,0 +1,236 @@ +/* $LastChangedDate: 2017-07-23 09:38:18 +0200 (Sun, 23 Jul 2017) $ */ +/* + CommandConsole-help.cpp : Fim console dispatcher--help methods + + (c) 2011-2016 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "fim.h" + +namespace fim +{ + fim::string CommandConsole::get_variables_reference(FimDocRefMode refmode)const + { + /* + * returns the reference of registered functions + */ + fim::string s; + fim::string sep=" "; + s+= fim_get_variables_reference(refmode); + + // FIXME: shall fix the following to work +#if 0 +#ifdef FIM_NAMESPACES + s+=browser_.get_variables_list(); + s+=sep; + if(browser_.c_image()) + { + s+=browser_.c_image()->get_variables_list(); + s+=sep; + } +#endif /* FIM_NAMESPACES */ +#endif +#if 0 +#ifdef FIM_WINDOWS + if(window_) + { + s+=window_->get_variables_list(); + s+=sep; + } + if(current_viewport()) + { + s+=current_viewport()->get_variables_list(); + s+=sep; + } +#endif /* FIM_WINDOWS */ +#endif + // FIXME: incomplete + return s; + } + + fim::string CommandConsole::get_commands_reference(FimDocRefMode refmode)const + { + /* + * returns the reference of registered commands_ + * TODO : should write better help messages + */ + fim::string s; + if(refmode==Man) + goto manmode; + for(size_t i=0;icmd_); + s+=" : "; + s+=(commands_[i])->getHelp(); + s+="\n"; + } + return s; +manmode: + for(size_t i=0;icmd_); + s+="\n.fi\n"; + s+=(commands_[i])->getHelp(); + s+="\n"; + s+=".fi\n"; + s+="\n"; + } + s.substitute("\\$","$\\:"); /* Zero-width break point on $ (that is, on long hardcoded regexps). */ + return s; + } + + fim::string CommandConsole::print_commands(void)const + { + cout << "VARIABLES : "< device + * output methods should be moved in some other, new class + * */ +#include "fim.h" +#ifdef FIM_DEFAULT_CONFIGURATION +#include "conf.h" +#endif /* FIM_DEFAULT_CONFIGURATION */ +#include +#include + +#ifdef FIM_USE_READLINE +#include "readline.h" +#endif /* FIM_USE_READLINE */ + +namespace fim +{ + +#if FIM_WANT_BENCHMARKS +static fim_err_t fim_bench_subsystem(Benchmarkable * bo) +{ + fim_int qbn,qbi; + fim_fms_t tbtime,btime;// ms + size_t times=1; + + if(!bo) + return FIM_ERR_GENERIC; + qbn=bo->get_n_qbenchmarks(); + + for(qbi=0;qbiquickbench_init(qbi); + do + { + btime=-getmilliseconds(); + //fim_bench_video(bfp); + bo->quickbench(qbi); + btime+=getmilliseconds(); + ++times; + tbtime-=btime; + } + while(btime>=0.0 && tbtime>0.0 && times>0); + --times; + tbtime=1000.0-tbtime; + std::cout << bo->get_bresults_string(qbi,times,tbtime); + bo->quickbench_finalize(qbi); + } + return FIM_ERR_NO_ERROR; +} +#endif /* FIM_WANT_BENCHMARKS */ + + + + fim_err_t CommandConsole::init(fim::string device) + { + /* + * TODO : move most of this stuff to the constructor, some day. + */ + fim_int xres=0,yres=0; + bool device_failure=false; + int dosso=device.find(FIM_SYM_DEVOPTS_SEP_STR); + bool wcs = false; + std::string dopts; + /* new : prevents atof, sprintf and such conversion mismatches! */ + setlocale(LC_ALL,"C"); /* portable (among Linux hosts) : should use dots for numerical radix separator */ + //setlocale(LC_NUMERIC,"en_US"); /* lame */ + //setlocale(LC_ALL,""); /* just lame */ + displaydevice_=FIM_NULL; /* TODO : is this really necessary ? */ + + if(dosso>0) + dopts=device.substr(dosso+strlen(FIM_SYM_DEVOPTS_SEP_STR),device.length()).c_str(); + +#ifndef FIM_WITH_NO_FRAMEBUFFER + if(device.find(FIM_DDN_INN_FB)==0) + { + extern fim_char_t *default_fbdev,*default_fbmode; /* FIXME: we don't want globals! */ + extern int default_vt; + extern float default_fbgamma; + FramebufferDevice * ffdp=FIM_NULL; + + displaydevice_=new FramebufferDevice( +#ifndef FIM_WANT_NO_OUTPUT_CONSOLE + mc_ +#endif /* FIM_WANT_NO_OUTPUT_CONSOLE */ + ); + if(!displaydevice_ || ((FramebufferDevice*)displaydevice_)->framebuffer_init()){cleanup();return FIM_ERR_GENERIC;} + ffdp=((FramebufferDevice*)displaydevice_); + setVariable(FIM_VID_DEVICE_DRIVER,FIM_DDN_VAR_FB); + if(default_fbdev)ffdp->set_fbdev(default_fbdev); + if(default_fbmode)ffdp->set_fbmode(default_fbmode); + if(default_vt!=-1)ffdp->set_default_vt(default_vt); + if(default_fbgamma!=-1.0)ffdp->set_default_fbgamma(default_fbgamma); + mangle_tcattr_=true; + } +#endif //#ifndef FIM_WITH_NO_FRAMEBUFFER + + + #ifdef FIM_WITH_LIBIMLIB2 + if(device.find(FIM_DDN_VAR_IL2)==0) + { + DisplayDevice *imld=FIM_NULL; + imld=new Imlib2Device( +#ifndef FIM_WANT_NO_OUTPUT_CONSOLE + mc_, +#endif /* FIM_WANT_NO_OUTPUT_CONSOLE */ + dopts + ); + if(imld && imld->initialize(sym_keys_)!=FIM_ERR_NO_ERROR){delete imld ; imld=FIM_NULL;} + if(imld && displaydevice_==FIM_NULL) + { + displaydevice_=imld; + setVariable(FIM_VID_DEVICE_DRIVER,FIM_DDN_VAR_IL2); + mangle_tcattr_=false; + } + else + { + device_failure=true; + } + wcs = true; /* FIXME: want cookie stream (for readline with no stdin) */ + } + #endif /* FIM_WITH_LIBIMLIB2 */ + + #ifdef FIM_WITH_LIBSDL + if(device.find(FIM_DDN_INN_SDL)==0) + { + DisplayDevice *sdld=FIM_NULL; + fim::string fopts; +#if FIM_WANT_SDL_OPTIONS_STRING + fopts=dopts; +#endif /* FIM_WANT_SDL_OPTIONS_STRING */ + sdld=new SDLDevice( +#ifndef FIM_WANT_NO_OUTPUT_CONSOLE + mc_, +#endif /* FIM_WANT_NO_OUTPUT_CONSOLE */ + fopts + ); + if(sdld && sdld->initialize(sym_keys_)!=FIM_ERR_NO_ERROR){delete sdld ; sdld=FIM_NULL;} + if(sdld && displaydevice_==FIM_NULL) + { + displaydevice_=sdld; + setVariable(FIM_VID_DEVICE_DRIVER,FIM_DDN_VAR_SDL); + mangle_tcattr_=false; + } + else + { + device_failure=true; + } + wcs = true; /* FIXME: want cookie stream (for readline with no stdin) */ + } + #endif /* FIM_WITH_LIBSDL */ + + #ifdef FIM_WITH_CACALIB + if(device.find(FIM_DDN_INN_CACA)==0) + { + DisplayDevice *cacad=FIM_NULL; + cacad=new CACADevice( +#ifndef FIM_WANT_NO_OUTPUT_CONSOLE + mc_ +#endif /* FIM_WANT_NO_OUTPUT_CONSOLE */ + ); if(cacad && cacad->initialize(sym_keys_)!=FIM_ERR_NO_ERROR){delete cacad ; cacad=FIM_NULL;} + if(cacad && displaydevice_==FIM_NULL) + { + displaydevice_=cacad; + setVariable(FIM_VID_DEVICE_DRIVER,FIM_DDN_VAR_CACA); + mangle_tcattr_=false; + } + else + device_failure=true; + } + #endif /* FIM_WITH_CACALIB */ + + #ifdef FIM_WITH_AALIB + if(device.find(FIM_DDN_INN_AA)==0) + { + aad_=new AADevice( +#ifndef FIM_WANT_NO_OUTPUT_CONSOLE + mc_, +#endif /* FIM_WANT_NO_OUTPUT_CONSOLE */ + dopts + ); + + if(aad_ && aad_->initialize(sym_keys_)!=FIM_ERR_NO_ERROR){delete aad_ ; aad_=FIM_NULL;} + { + if(aad_ && displaydevice_==FIM_NULL) + { + displaydevice_=aad_; + setVariable(FIM_VID_DEVICE_DRIVER,FIM_DDN_VAR_AA); +#if FIM_WANT_SCREEN_KEY_REMAPPING_PATCH + /* + * FIXME + * + * seems like the keymaps get shifted when running under screen + * weird, isn't it ? + * Regard this as a weird patch. + * */ + const fim_char_t * term = fim_getenv(FIM_CNS_TERM_VAR); + if(term && string(term).re_match("screen")) + { + sym_keys_[FIM_KBD_LEFT]-=3072; + sym_keys_[FIM_KBD_RIGHT]-=3072; + sym_keys_[FIM_KBD_UP]-=3072; + sym_keys_[FIM_KBD_DOWN]-=3072; + } + mangle_tcattr_=false; +#endif /* FIM_WANT_SCREEN_KEY_REMAPPING_PATCH */ + } + else device_failure=true; + } + } + #endif /* FIM_WITH_AALIB */ + if(mangle_tcattr_) + tty_raw();// this inhibits unwanted key printout (raw mode), and saves the current tty state + // FIXME: an error here on, leaves the terminal in raw mode, and this is not cool + + if( displaydevice_==FIM_NULL) + { + displaydevice_=&dummydisplaydevice_; + setVariable(FIM_VID_DEVICE_DRIVER,FIM_DDN_VAR_DUMB); + if(device_failure) + { + std::cerr << "Failure using the \""<width(),yres=displaydevice_->height(); + + // textual console reformatting (should go to displaydevice some day) + displaydevice_->init_console(); + // FIXME: shall check the error result + +#ifdef FIM_WINDOWS + /* true pixels if we are in framebuffer mode */ + /* fake pixels if we are in text (er.. less than!) mode */ + if( xres<=0 || yres<=0 ) + { + std::cerr << "Unable to spawn a suitable display.\n"; + return FIM_ERR_BAD_PARAMS; + } + + try + { + window_ = new FimWindow( *this, Rect(0,0,xres,yres) ); + + if(window_)window_->setroot(); + } + catch(FimException e) + { + if( e == FIM_E_NO_MEM || true ) quit(FIM_E_NO_MEM); + } + + /* + * TODO: exceptions should be launched here in case ... + * */ + addCommand(new Command(fim::string(FIM_FLT_WINDOW),fim::string(FIM_CMD_HELP_WINDOW), window_,&FimWindow::fcmd_cmd)); +#else /* FIM_WINDOWS */ + try + { + viewport_ = new Viewport(*this); + } + catch(FimException e) + { + if( e == FIM_E_NO_MEM || true ) quit(FIM_E_NO_MEM); + } +#endif /* FIM_WINDOWS */ +#ifdef FIM_NAMESPACES + if(displaydevice_) + setVariable(FIM_VID_FIM_BPP ,(fim_int) displaydevice_->get_bpp()); +#endif /* FIM_NAMESPACES */ + setVariable(FIM_VID_SCREEN_WIDTH, xres); + setVariable(FIM_VID_SCREEN_HEIGHT,yres); + + /* Here the program loads initialization scripts */ + + FIM_AUTOCMD_EXEC(FIM_ACM_PRECONF,""); + FIM_AUTOCMD_EXEC(FIM_ACM_PREHFIMRC,""); + + #ifndef FIM_WANT_NOSCRIPTING + if(preConfigCommand_!=fim::string("")) + execute_internal(preConfigCommand_.c_str(),FIM_X_HISTORY); + + if(getIntVariable(FIM_VID_NO_DEFAULT_CONFIGURATION)==0 ) + { + #ifdef FIM_DEFAULT_CONFIGURATION + /* so the user could inspect what goes in the default configuration */ + setVariable(FIM_VID_FIM_DEFAULT_CONFIG_FILE_CONTENTS,FIM_DEFAULT_CONFIG_FILE_CONTENTS); + execute_internal(FIM_DEFAULT_CONFIG_FILE_CONTENTS,FIM_X_QUIET); + #endif /* FIM_DEFAULT_CONFIGURATION */ + } + #endif /* FIM_WANT_NOSCRIPTING */ + +#ifndef FIM_NOFIMRC + #ifndef FIM_WANT_NOSCRIPTING + fim_char_t rcfile[FIM_PATH_MAX]; + const fim_char_t *e = fim_getenv(FIM_CNS_HOME_VAR); + + FIM_AUTOCMD_EXEC(FIM_ACM_POSTHFIMRC,""); + FIM_AUTOCMD_EXEC(FIM_ACM_PREGFIMRC,""); + + if((getIntVariable(FIM_VID_LOAD_DEFAULT_ETC_FIMRC)==1 ) + && (getStringVariable(FIM_VID_DEFAULT_ETC_FIMRC)!=FIM_CNS_EMPTY_STRING) + ) + { + string ef=getStringVariable(FIM_VID_DEFAULT_ETC_FIMRC); + if(is_file(ef.c_str())) + if(FIM_ERR_NO_ERROR!=executeFile(ef.c_str())); + } + + /* execution of command line-set autocommands */ + FIM_AUTOCMD_EXEC(FIM_ACM_POSTGFIMRC,""); + FIM_AUTOCMD_EXEC(FIM_ACM_PREUFIMRC,""); + + { + #include "grammar.h" + setVariable(FIM_VID_FIM_DEFAULT_GRAMMAR_FILE_CONTENTS,FIM_DEFAULT_GRAMMAR_FILE_CONTENTS); + } + + if(e && strlen(e) 2 ) + { + if( varname.length() > 2 ) + id = varname.c_str()+2; + } + else +#endif /* FIM_NAMESPACES */ + id = varname; + return id; + } + + Namespace * CommandConsole::rns(const fim::string varname) + { + Namespace * nsp = FIM_NULL; +#ifdef FIM_NAMESPACES + if( varname[1]==FIM_SYM_NAMESPACE_SEP ) + { + try + { + //a specific namespace was selected! + fim_char_t ns = varname[0]; + fim::string id = varname.c_str()+2; + + if( ns == FIM_SYM_NAMESPACE_WINDOW_CHAR ) +#ifdef FIM_WINDOWS + { + //window variable + nsp = window_; + goto err; + } + else + if( ns == FIM_SYM_NAMESPACE_VIEWPORT_CHAR ) + { + //viewport variable + if(window_) + nsp = window_->current_viewportp(); + goto err; + } + else +#endif /* FIM_WINDOWS */ + if( ns == FIM_SYM_NAMESPACE_IMAGE_CHAR ) + { + //image variable + nsp = (Image*) browser_.c_image(); /* FIXME: porcata assurda */ + goto err; + } + else + if( ns == FIM_SYM_NAMESPACE_BROWSER_CHAR ) + { + //browser variable + nsp = & browser_; + goto err; + } + else + if( ns == FIM_SYM_NAMESPACE_GLOBAL_CHAR ) + { + nsp = (Namespace*) this; + goto err; + } + else + if( ns != FIM_SYM_NAMESPACE_GLOBAL_CHAR ) + { + //invalid namespace + goto err; + } + } + catch(FimException e){} + } +#endif /* FIM_NAMESPACES */ + nsp = this; +err: + return nsp; + } + + const Namespace * CommandConsole::c_rns(const fim::string varname)const + { + const Namespace * nsp = FIM_NULL; +#ifdef FIM_NAMESPACES + if( varname[1]==FIM_SYM_NAMESPACE_SEP ) + { + try + { + //a specific namespace was selected! + fim_char_t ns = varname[0]; + fim::string id = varname.c_str()+2; + + if( ns == FIM_SYM_NAMESPACE_WINDOW_CHAR ) +#ifdef FIM_WINDOWS + { + //window variable + nsp = window_; + goto err; + } + else + if( ns == FIM_SYM_NAMESPACE_VIEWPORT_CHAR ) + { + //viewport variable + if(window_) + nsp = window_->current_viewportp(); + goto err; + } + else +#endif /* FIM_WINDOWS */ + if( ns == FIM_SYM_NAMESPACE_IMAGE_CHAR ) + { + //image variable + nsp = (Image*) browser_.c_image(); /* FIXME: porcata assurda */ + goto err; + } + else + if( ns == FIM_SYM_NAMESPACE_BROWSER_CHAR ) + { + //browser variable + nsp = & browser_; + goto err; + } + else + if( ns == FIM_SYM_NAMESPACE_GLOBAL_CHAR ) + { + nsp = (Namespace*) this; + goto err; + } + else + if( ns != FIM_SYM_NAMESPACE_GLOBAL_CHAR ) + { + //invalid namespace + goto err; + } + } + catch(FimException e){} + } +#endif /* FIM_NAMESPACES */ + nsp = this; +err: + return nsp; + } + + fim_int CommandConsole::setVariable(const fim::string& varname,fim_int value) + { + fim_int retval = 0; + Namespace *nsp = rns(varname); + + if(nsp) + retval = nsp->setVariable(rnid(varname),value); +err: + return retval; + } + + fim_float_t CommandConsole::setVariable(const fim::string& varname,fim_float_t value) + { + fim_float_t retval = FIM_CNS_EMPTY_FP_VAL; + Namespace *nsp = rns(varname); + + if(nsp) + retval = nsp->setVariable(rnid(varname),value); +err: + return retval; + } + + fim_int CommandConsole::setVariable(const fim::string& varname,const fim_char_t*value) + { + fim_int retval = 0; + Namespace *nsp = rns(varname); + + if(nsp) + retval = nsp->setVariable(rnid(varname),value); +err: + return retval; + } + + Var CommandConsole::setVariable(const fim::string varname,const Var&value) + { + Var retval = (fim_int)0; + Namespace *nsp = rns(varname); + + if(nsp) + retval = nsp->setVariable(rnid(varname),value); +err: + return retval; + } + + fim_int CommandConsole::getIntVariable(const fim::string &varname)const + { + fim_int retval = 0; + const Namespace *nsp = c_rns(varname); + + if(nsp) + retval = nsp->getIntVariable(rnid(varname)); +err: + return retval; + } + + fim_float_t CommandConsole::getFloatVariable(const fim::string &varname)const + { + fim_float_t retval = FIM_CNS_EMPTY_FP_VAL; + const Namespace *nsp = c_rns(varname); + + if(nsp) + retval = nsp->getFloatVariable(rnid(varname)); + return retval; + } + + fim::string CommandConsole::getStringVariable(const fim::string &varname)const + { + fim::string retval = FIM_CNS_EMPTY_RESULT; + const Namespace *nsp = c_rns(varname); + + if(nsp) + retval = nsp->getStringVariable(rnid(varname)); + return retval; + } + + Var CommandConsole::getVariable(const fim::string &varname)const + { + const Namespace *nsp = c_rns(varname); + + if(nsp) + return nsp->getVariable(rnid(varname)); + else + return Var(); + } +} diff --git a/src/CommandConsole.cpp b/src/CommandConsole.cpp new file mode 100644 index 0000000..086c30b --- /dev/null +++ b/src/CommandConsole.cpp @@ -0,0 +1,2476 @@ +/* $LastChangedDate: 2017-07-14 21:46:19 +0200 (Fri, 14 Jul 2017) $ */ +/* + CommandConsole.cpp : Fim console dispatcher + + (c) 2007-2016 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/* + * TODO: + * framebufferdevice -> device + * output methods should be moved in some other, new class + * */ +#include "fim.h" +#include +#include + +#ifdef FIM_USE_READLINE +#include "readline.h" +#endif /* FIM_USE_READLINE */ + +#include + +#include +#include + +#if HAVE_GET_CURRENT_DIR_NAME +#else /* HAVE_GET_CURRENT_DIR_NAME */ +#if _BSD_SOURCE || _XOPEN_SOURCE >= 500 +#include /* getcwd, as replacement for get_current_dir_name */ /* STDIN_FILENO */ +#endif /* _BSD_SOURCE || _XOPEN_SOURCE >= 500 */ +#endif /* HAVE_GET_CURRENT_DIR_NAME */ + +#if FIM_WANT_RAW_KEYS_BINDING +#define FIM_CNS_RAW_KEYS_MESG "; if " FIM_CNS_EX_KSY_STRING " is at least two characters long and begins with 0 (zero), the integer number after the 0 will be treated as a raw keycode to bind the specified " FIM_CNS_EX_KSY_STRING " to. activate the " FIM_VID_VERBOSE_KEYS " variable to discover (display device dependent) raw keys." +#else /* FIM_WANT_RAW_KEYS_BINDING */ +#define FIM_CNS_RAW_KEYS_MESG +#endif /* FIM_WANT_RAW_KEYS_BINDING */ +#define FIM_INVALID_IDX -1 + +#define FIM_KEY_OFFSET '0' + +extern fim_sys_int yyparse(); + +namespace fim +{ + + static bool nochars(const fim_char_t *s) + { + /* + * true if the string is null or empty, false otherwise + */ + if(s==FIM_NULL) + return true; + while(*s && isspace(*s)) + ++s; + return *s=='\0'?true:false; + } + + int CommandConsole::findCommandIdx(fim::string cmd)const + { + /* + * check whether cmd is a valid internal (registered) Fim command and returns index + */ + for(size_t i=0;icmd_==cmd) + return i; + return FIM_INVALID_IDX; + } + + Command* CommandConsole::findCommand(fim::string cmd)const + { + /* + * check whether cmd is a valid internal (registered) Fim command and returns pointer + */ + int idx=findCommandIdx(cmd); + + if(idx!=FIM_INVALID_IDX) + return commands_[idx]; + return FIM_NULL; + } + + fim::string CommandConsole::bind(fim_key_t c,const fim::string binding) + { + /* + * binds keycode c to the action specified in binding + + * note : the binding translation map is used as a necessary + * indirection... + */ + bindings_t::const_iterator bi=bindings_.find(c); + fim::string rs("keycode "); + string ksym = key_syms_[c]; + if( ksym != FIM_CNS_EMPTY_STRING ) + ksym = " (keysym \"" + ksym + "\")"; + + bindings_[c]=binding; /* this is the operation; what follows is only debug info */ + + rs+=string((int)c); + rs+=ksym; + if(bi!=bindings_.end()) + rs+=" successfully reassigned to \""; + else + rs+=" successfully assigned to \""; + rs+=bindings_[c]; + rs+="\"\n"; + return rs; + } + + fim::string CommandConsole::getBindingsList(void)const + { + /* + * collates all registered action bindings_ together in a single string + * */ + fim::string bindings_expanded; + bindings_t::const_iterator bi; + + for( bi=bindings_.begin();bi!=bindings_.end();++bi) + { + //if(bi->second == FIM_CNS_EMPTY_STRING)continue;//FIX : THIS SHOULD NOT OCCUR + bindings_expanded+=FIM_FLT_BIND" \""; + key_syms_t::const_iterator ikbi=key_syms_.find(((*bi).first)); + if(ikbi!=key_syms_.end()) + bindings_expanded+=ikbi->second; + bindings_expanded+="\" \""; + bindings_expanded+=((*bi).second); + if( bindings_help_.find((*bi).first) != bindings_help_.end() ) + bindings_expanded+="\" # ", + bindings_expanded+=string(bindings_help_.find((*bi).first) -> second), + bindings_expanded+="\n"; + else + bindings_expanded+="\"\n"; + } + return bindings_expanded; + } + + fim::string CommandConsole::unbind(const fim::string& kfstr) + { + /* + * unbinds the action eventually bound to the first key name specified in args.. + * IDEAS : multiple unbindings ? + * maybe you should made surjective the binding_keys mapping.. + */ + fim_key_t key=FIM_SYM_NULL_KEY; +#ifdef FIM_WANT_RAW_KEYS_BINDING + const fim_char_t*kstr=kfstr.c_str(); + + if(strlen(kstr)>=2 && isdigit(kstr[0]) && isdigit(kstr[1])) + { + key=atoi(kstr+1); + } + else +#endif /* FIM_WANT_RAW_KEYS_BINDING */ + { + sym_keys_t::const_iterator kbi=sym_keys_.find(kfstr); + if(kbi!=sym_keys_.end()) + key=sym_keys_[kfstr]; + } + return unbind(key); + } + + fim_key_t CommandConsole::find_keycode_for_bound_cmd(fim::string binding) + { + /* + * looks for a binding to 'cmd' and returns a string description for its bound key + */ + bindings_t::const_iterator bi; + fim_key_t key=FIM_SYM_NULL_KEY; + + for( bi=bindings_.begin();bi!=bindings_.end();++bi) + { + /* FIXME: should move this functionality to an ad-hoc search routine */ + if(bi->second==binding) + { + key = bi->first; + goto ret; + } + } +ret: return key; + } + + fim::string CommandConsole::find_key_for_bound_cmd(fim::string binding) + { + /* + * looks for a binding to 'cmd' and returns a string description for its bound key + */ + fim_key_t key = find_keycode_for_bound_cmd(binding); + + if( key != FIM_SYM_NULL_KEY) + { + return key_syms_[key]; + } + + return FIM_CNS_EMPTY_RESULT; + } + + fim::string CommandConsole::unbind(fim_key_t c) + { + /* + * unbinds the action eventually bound to the key combination code c + */ + fim::string rs(FIM_FLT_UNBIND" "); + bindings_t::const_iterator bi=bindings_.find(c); + + if(bi!=bindings_.end()) + { + bindings_.erase(c); + rs+=c; + rs+=": successfully unbound.\n"; + if( bindings_help_.find(c) != bindings_help_.end() ) + bindings_help_.erase(c); + } + else + { + rs+=c; + rs+=": there is not such binding.\n"; + } + return rs; + } + + fim::string CommandConsole::aliasRecall(fim::string cmd)const + { + /* + * returns the alias command eventually specified by token cmd + * + * Note : return aliases_[cmd] would create an entry associated to cmd + * ( and this member function could not be const anymore ). + */ + aliases_t::const_iterator ai=aliases_.find(cmd); + + if(ai!=aliases_.end()) + return ai->second.first; + return FIM_CNS_EMPTY_RESULT; + } + + fim::string CommandConsole::getAliasesList(void)const + { + /* + * collates all registered action aliases together in a single string + * */ + fim::string aliases_expanded; + aliases_t::const_iterator ai; + + for( ai=aliases_.begin();ai!=aliases_.end();++ai) + { +#if 0 + if(ai->second.first == FIM_CNS_EMPTY_STRING)continue;//FIX THIS : THIS SHOULD NOT OCCUR + aliases_expanded+=FIM_FLT_ALIAS" "; + aliases_expanded+=((*ai).first); + aliases_expanded+="=\""; + aliases_expanded+=((*ai).second.first); + aliases_expanded+="\"\n"; +#endif + aliases_expanded+=get_alias_info((*ai).first); + } + return aliases_expanded; + } + + fim::string CommandConsole::get_alias_info(const fim::string aname)const + { + string r; + r+=fim::string(FIM_FLT_ALIAS" \""); + r+=aname; + r+=fim::string("\" \""); + + aliases_t::const_iterator ai=aliases_.find(aname); + if(ai!=aliases_.end()) + r+=ai->second.first; + r+=fim::string("\""); + if(ai!=aliases_.end()) + if(ai->second.second!=FIM_CNS_EMPTY_STRING) + { + r+=" # "; + r+=ai->second.second; + } + r+=fim::string("\n"); + return r; + } + + fim::string CommandConsole::fcmd_alias(std::vector args) + { + /* + * assigns to an alias some action + */ + fim::string cmdlist,desc; + + if(args.size()==0) + { + return getAliasesList(); + } + if(args.size()<2) + { + return get_alias_info(args[0].val_); + } + //for(size_t i=1;i=2) + cmdlist+=args[1].val_; + if(args.size()>=3) + desc +=args[2].val_; + if(aliases_[args[0].val_].first!=FIM_CNS_EMPTY_STRING) + { + string r; + aliases_[args[0].val_]=std::pair(cmdlist,desc); + r+=fim::string(FIM_FLT_ALIAS" "); + r+=args[0].val_; + r+=fim::string(" successfully replaced.\n"); + return r; + } + else + { + string r; + aliases_[args[0].val_].first=cmdlist; + aliases_[args[0].val_].second=desc; + r+=fim::string(FIM_FLT_ALIAS" "); + r+=args[0].val_; + r+=fim::string(" successfully added.\n"); + return r; + } + } + + fim::string CommandConsole::dummy(std::vector args) + { + /* + * useful for test purposes + * */ + //std::cout << "dummy function : for test purposes :)\n"; + return "dummy function : for test purposes :)\n"; + } + + CommandConsole::CommandConsole(/*FramebufferDevice &_framebufferdevice*/): +#ifndef FIM_WANT_NO_OUTPUT_CONSOLE +#ifndef FIM_KEEP_BROKEN_CONSOLE + mc_(*this), +#endif /* FIM_KEEP_BROKEN_CONSOLE */ +#endif /* FIM_WANT_NO_OUTPUT_CONSOLE */ + fontserver_(), + show_must_go_on_(1), + return_code_(0) + ,mangle_tcattr_(false) + ,browser_(*this) + //,framebufferdevice(_framebufferdevice) + ,cycles_(0) +#ifdef FIM_RECORDING + ,recordMode_(Normal) /* we start not recording anything */ + ,dont_record_last_action_(false) /* this variable is only useful in record mode */ +#endif /* FIM_RECORDING */ + ,fim_stdin_(STDIN_FILENO) +#ifndef FIM_WANT_NO_OUTPUT_CONSOLE + ,dummydisplaydevice_(this->mc_) +#else /* FIM_WANT_NO_OUTPUT_CONSOLE */ + ,dummydisplaydevice_() +#endif /* FIM_WANT_NO_OUTPUT_CONSOLE */ + ,displaydevice_(FIM_NULL) /* the display device could be FIM_NULL ! (FIXME) */ + { + addCommand(new Command(fim::string(FIM_FLT_ALIAS),fim::string(FIM_FLT_ALIAS " [" FIM_CNS_EX_ID_STRING " [" FIM_CNS_EX_CMDS_STRING " [" FIM_CNS_EX_DSC_STRING "]]]"),this,&CommandConsole::fcmd_foo)); + addCommand(new Command(fim::string(FIM_FLT_ALIGN),fim::string(FIM_CMD_HELP_ALIGN),&browser_,&Browser::fcmd_align)); +#ifdef FIM_AUTOCMDS + addCommand(new Command(fim::string(FIM_FLT_AUTOCMD),fim::string(FIM_FLT_AUTOCMD " " FIM_CNS_EX_EVT_STRING " " FIM_CNS_EX_PAT_STRING " " FIM_CNS_EX_CMDS_STRING " : manipulate auto commands"),this,&CommandConsole::fcmd_autocmd)); + addCommand(new Command(fim::string(FIM_FLT_AUTOCMD_DEL),fim::string(FIM_FLT_AUTOCMD_DEL" : manipulate auto commands. usage: " FIM_FLT_AUTOCMD_DEL " " FIM_CNS_EX_EVT_STRING " " FIM_CNS_EX_PAT_STRING " " FIM_CNS_EX_CMDS_STRING),this,&CommandConsole::fcmd_autocmd_del)); /* this syntax is incompatible with vim ('autocmd!')*/ +#endif /* FIM_AUTOCMDS */ + addCommand(new Command(fim::string(FIM_FLT_BASENAME),fim::string(FIM_FLT_BASENAME" {filename} : returns the basename of {filename}"),this,&CommandConsole::fcmd_basename)); + addCommand(new Command(fim::string(FIM_FLT_BIND),fim::string(FIM_FLT_BIND" [" FIM_CNS_EX_KSY_STRING " [" FIM_CNS_EX_CMDS_STRING "]] : bind a keyboard symbol/shortcut " FIM_CNS_EX_KSY_STRING " to " FIM_CNS_EX_CMDS_STRING "" FIM_CNS_RAW_KEYS_MESG "; binding is dynamical, so you can rebind keys even during program's execution"),this,&CommandConsole::fcmd_bind)); + addCommand(new Command(fim::string(FIM_FLT_CD),fim::string(FIM_CMD_HELP_CD ),this,&CommandConsole::fcmd_cd)); +#ifndef FIM_WANT_NO_OUTPUT_CONSOLE + addCommand(new Command(fim::string(FIM_FLT_CLEAR),fim::string(FIM_FLT_CLEAR" : clear the virtual console"),this,&CommandConsole::fcmd_clear)); + // 20110507 we other means for scrolling the console, now + //addCommand(new Command(fim::string("scroll_console_up" ),fim::string("scrolls up the virtual console"),this,&CommandConsole::scroll_up)); + //addCommand(new Command(fim::string("scroll_console_down"),fim::string("scrolls down the virtual console"),this,&CommandConsole::scroll_down)); +#endif /* FIM_WANT_NO_OUTPUT_CONSOLE */ + addCommand(new Command(fim::string(FIM_FLT_COMMANDS),fim::string(FIM_FLT_COMMANDS " : display the existing commands"),this,&CommandConsole::fcmd_commands_list)); + + addCommand(new Command(fim::string(FIM_FLT_DESATURATE),fim::string(FIM_FLT_DESATURATE" : desaturate the displayed image colors. To get back the original you will have to reload the image." ),&browser_,&Browser::fcmd_desaturate)); + addCommand(new Command(fim::string(FIM_FLT_DESC),fim::string(FIM_FLT_HELP_DESC),this,&CommandConsole::fcmd_desc)); + addCommand(new Command(fim::string(FIM_FLT_DISPLAY),fim::string(FIM_FLT_HELP_DISPLAY),&browser_,&Browser::fcmd_display)); + addCommand(new Command(fim::string(FIM_FLT_DUMP_KEY_CODES),fim::string(FIM_FLT_DUMP_KEY_CODES " : dump the active key codes (unescaped, for inspection)"),this,&CommandConsole::fcmd_dump_key_codes)); + addCommand(new Command(fim::string(FIM_FLT_ECHO),fim::string(FIM_FLT_ECHO " " FIM_CNS_EX_ARGS_STRING ": print the " FIM_CNS_EX_ARGS_STRING " on console"),this,&CommandConsole::fcmd_echo)); + addCommand(new Command(fim::string(FIM_FLT_ELSE),fim::string("if(expression){action;}['else'{action;}] : see else"),this,&CommandConsole::fcmd_foo));// FIXME: need a special "help grammar" command ! +#ifdef FIM_RECORDING + addCommand(new Command(fim::string(FIM_FLT_EVAL),fim::string(FIM_CMD_HELP_EVAL),this,&CommandConsole::fcmd_eval)); +#endif /* FIM_RECORDING */ +#ifndef FIM_WANT_NOSCRIPTING + addCommand(new Command(fim::string(FIM_FLT_EXEC),fim::string(FIM_FLT_EXEC " " FIM_CNS_EX_FNS_STRING " : execute script " FIM_CNS_EX_FNS_STRING ""),this,&CommandConsole::fcmd_executeFile)); +#endif /* FIM_WANT_NOSCRIPTING */ + addCommand(new Command(fim::string(FIM_FLT_GETENV),fim::string(FIM_FLT_GETENV " " FIM_CNS_EX_ID_STRING " : display the value of the " FIM_CNS_EX_ID_STRING " environment variable"),this,&CommandConsole::fcmd_do_getenv)); + addCommand(new Command(fim::string(FIM_FLT_GOTO),fim::string(FIM_CMD_HELP_GOTO),&browser_,&Browser::fcmd_goto_image)); + addCommand(new Command(fim::string(FIM_FLT_HELP),fim::string(FIM_CMD_HELP_HELP),this,&CommandConsole::fcmd_help)); + addCommand(new Command(fim::string(FIM_FLT_IF),fim::string("if(expression){action;}['else'{action;}] : see if"),this,&CommandConsole::fcmd_foo));// FIXME: need a special "help grammar" command ! + addCommand(new Command(fim::string(FIM_FLT_INFO),fim::string(FIM_FLT_INFO" : display information about the current file" ),&browser_,&Browser::fcmd_info)); +#if FIM_WANT_PIC_LBFL + addCommand(new Command(fim::string(FIM_FLT_LIMIT),fim::string(FIM_FLT_LIMIT " [{expression} |{variable} {value}] : A browsable file list filtering function (like limiting in the \'mutt\' program). Uses information loaded via --" FIM_OSW_LOAD_IMG_DSC_FILE ". If one argument only is provided, restrict to files whose description string matches {expression}. If two arguments are provided, restrict to files having property {variable} set to {value}." +#if FIM_WANT_FILENAME_MARK_AND_DUMP + " If invoked with one exclamation point ('!') as argument will restrict to the currently marked files only. " +#endif /* FIM_WANT_FILENAME_MARK_AND_DUMP */ + " Invoked with no arguments, the original browsable files list is restored." ),&browser_,&Browser::fcmd_limit)); +#endif /* FIM_WANT_PIC_LBFL */ + addCommand(new Command(fim::string(FIM_FLT_LIST),fim::string(FIM_CMD_HELP_LIST),&browser_,&Browser::fcmd_list)); + addCommand(new Command(fim::string(FIM_FLT_LOAD),fim::string(FIM_FLT_LOAD" : load the image, if not yet loaded (see also " FIM_FLT_RELOAD ")"),&browser_,&Browser::fcmd_load)); + addCommand(new Command(fim::string(FIM_FLT_NEGATE),fim::string(FIM_FLT_NEGATE" : negate the displayed image colors." ),&browser_,&Browser::fcmd_negate)); + addCommand(new Command(fim::string(FIM_FLT_PAN),fim::string( FIM_FLT_PAN" {'down'|'up'|'left'|'right'|'ne'|'nw'|'se'|'sw'} [{steps}['%']] pan the image {steps} pixels in the desired direction;" " if the '%' specifier is present, {steps} will be treated as a percentage of current screen dimensions;" " if {steps} is not specified, the \"" FIM_VID_STEPS "\" variable will be used;" " if present, the \"" FIM_VID_HSTEPS "\" variable will be considered for horizontal panning;" " if present, the \"" FIM_VID_VSTEPS "\" variable will be considered for vertical panning;" " the variables may be terminated by the \'%\' specifier" " "),&browser_,&Browser::pan)); + addCommand(new Command(fim::string(FIM_FLT_POPEN),fim::string(FIM_FLT_POPEN " " FIM_CNS_EX_SYSC_STRING " : pipe a command, invoking popen(): spawns a shell, invoking " FIM_CNS_EX_SYSC_STRING " and executing as fim commands the output of " FIM_CNS_EX_SYSC_STRING),this,&CommandConsole::fcmd_sys_popen)); +#ifdef FIM_PIPE_IMAGE_READ + addCommand(new Command(fim::string(FIM_FLT_PREAD),fim::string(FIM_FLT_PREAD " " FIM_CNS_EX_ARGS_STRING " : execute " FIM_CNS_EX_ARGS_STRING " as a shell command and read the output as an image file (using " FIM_FLT_POPEN ")"),this,&CommandConsole::fcmd_pread)); +#endif /* FIM_PIPE_IMAGE_READ */ + addCommand(new Command(fim::string(FIM_FLT_PREFETCH),fim::string(FIM_FLT_PREFETCH " : prefetch (read into the cache) the two nearby image files (next and previous), for a faster subsequent opening. See also the " FIM_VID_WANT_PREFETCH " variable."),&browser_,&Browser::fcmd_prefetch)); + addCommand(new Command(fim::string(FIM_FLT_PWD),fim::string(FIM_CMD_HELP_PWD ),this,&CommandConsole::fcmd_pwd)); + addCommand(new Command(fim::string(FIM_FLT_QUIT),fim::string(FIM_FLT_QUIT " [{number}] : terminate the program; if {number} is specified, use it as the program return status"),this,&CommandConsole::fcmd_quit)); +#ifdef FIM_RECORDING + addCommand(new Command(fim::string(FIM_FLT_RECORDING),fim::string( +FIM_FLT_RECORDING " 'start' : start recording the executed commands; " FIM_FLT_RECORDING " 'stop' : stop recording the executed commands; " FIM_FLT_RECORDING " 'dump' : dump in the console the record buffer; " FIM_FLT_RECORDING " 'execute' : execute the record buffer; " FIM_FLT_RECORDING " 'repeat_last' : repeat the last performed action; "),this,&CommandConsole::fcmd_recording)); +#endif /* FIM_RECORDING */ + addCommand(new Command(fim::string(FIM_FLT_REDISPLAY),fim::string(FIM_FLT_REDISPLAY " : re-display the current file contents"),&browser_,&Browser::fcmd_redisplay)); + addCommand(new Command(fim::string(FIM_FLT_RELOAD),fim::string(FIM_FLT_RELOAD" [{arg}] : load the image into memory; if {arg} is present, will force reloading, bypassing the cache (see also " FIM_FLT_LOAD ")"),&browser_,&Browser::fcmd_reload)); + addCommand(new Command(fim::string(FIM_FLT_ROTATE),fim::string(FIM_FLT_ROTATE " " FIM_CNS_EX_NUM_STRING ": rotate the image the specified amount of degrees [undocumented]" ),&browser_,&Browser::fcmd_rotate)); + addCommand(new Command(fim::string(FIM_FLT_SCALE),fim::string(FIM_CMD_HELP_SCALE),&browser_,&Browser::fcmd_scale)); + addCommand(new Command(fim::string(FIM_FLT_SCROLLDOWN),fim::string(FIM_FLT_SCROLLDOWN " : scroll down the image, going next if at bottom" ),&browser_,&Browser::fcmd_scrolldown)); + addCommand(new Command(fim::string(FIM_FLT_SCROLLFORWARD),fim::string(FIM_FLT_SCROLLFORWARD " : scroll the image as it were reading it" ),&browser_,&Browser::fcmd_scrollforward)); + addCommand(new Command(fim::string(FIM_FLT_SET),fim::string(FIM_CMD_HELP_SET),this,&CommandConsole::fcmd_set)); + addCommand(new Command(fim::string(FIM_FLT_SET_CONSOLE_MODE),fim::string(FIM_FLT_SET_CONSOLE_MODE " : set console mode"),this,&CommandConsole::fcmd_set_in_console)); + addCommand(new Command(fim::string(FIM_FLT_SET_INTERACTIVE_MODE),fim::string(FIM_FLT_SET_INTERACTIVE_MODE " : set interactive mode"),this,&CommandConsole::fcmd_set_interactive_mode)); + addCommand(new Command(fim::string(FIM_FLT_SLEEP),fim::string(FIM_FLT_SLEEP " [" FIM_CNS_EX_NUM_STRING "=1] : sleep for the specified (default 1) number of seconds"),this,&CommandConsole::fcmd_foo)); + addCommand(new Command(fim::string(FIM_FLT_STATUS),fim::string(FIM_FLT_STATUS " : set the status line to the collation of the given arguments"),this,&CommandConsole::fcmd_status)); + addCommand(new Command(fim::string(FIM_FLT_STDOUT),fim::string(FIM_FLT_STDOUT " " FIM_CNS_EX_ARGS_STRING " : writes to stdout its arguments " FIM_CNS_EX_ARGS_STRING ""),this,&CommandConsole::fcmd__stdout)); +#ifndef FIM_NO_SYSTEM + addCommand(new Command(fim::string(FIM_FLT_SYSTEM),fim::string(FIM_CMD_HELP_SYSTEM),this,&CommandConsole::fcmd_system)); +#endif /* FIM_NO_SYSTEM */ + addCommand(new Command(fim::string(FIM_FLT_VARIABLES),fim::string(FIM_FLT_VARIABLES " : display the existing variables"),this,&CommandConsole::fcmd_variables_list)); + addCommand(new Command(fim::string(FIM_FLT_UNALIAS),fim::string(FIM_FLT_UNALIAS " " FIM_CNS_EX_ID_STRING " | '-a' : delete the alias " FIM_CNS_EX_ID_STRING " or all aliases (use '-a', not -a)"),this,&CommandConsole::fcmd_unalias)); + addCommand(new Command(fim::string(FIM_FLT_UNBIND),fim::string(FIM_FLT_UNBIND " " FIM_CNS_EX_KSY_STRING " : unbind the action associated to a specified " FIM_CNS_EX_KSY_STRING FIM_CNS_RAW_KEYS_MESG),this,&CommandConsole::fcmd_unbind)); + addCommand(new Command(fim::string(FIM_FLT_WHILE),fim::string("while(expression){action;} A conditional cycle construct. May be interrupted by hitting the " FIM_KBD_ESC " or the " FIM_KBD_COLON " key"),this,&CommandConsole::fcmd_foo));/* may introduce a special "help grammar" command */ +#ifdef FIM_WINDOWS + /* this is a stub for the manual generation (actually, the FimWindow object gets built later) */ + addCommand(new Command(fim::string(FIM_FLT_WINDOW),fim::string(FIM_CMD_HELP_WINDOW),this,&CommandConsole::fcmd_foo)); +#endif /* FIM_WINDOWS */ +// addCommand(new Command(fim::string("type" ),fim::string("prints out the type of its arguments"),this,&CommandConsole::get_expr_type)); +// addCommand(new Command(fim::string(FIM_FLT_NO_IMAGE),fim::string(FIM_FLT_NO_IMAGE" : displays no image at all (BROKEN)"),&browser_,&Browser::fcmd_no_image));/* FIXME: broken */ + //addCommand(new Command(fim::string("print" ),fim::string("displays the value of a variable"),this,&CommandConsole::fcmd_foo)); + execDefaultConfiguration(); + fcmd_cd(args_t()); + setVariable(FIM_VID_VERSION,(fim_int)FIM_REVISION_NUMBER); + setVariable(FIM_VID_STEPS,FIM_CNS_STEPS_DEFAULT); + setVariable(FIM_VID_TERM, fim_getenv(FIM_CNS_TERM_VAR)); + setVariable(FIM_VID_LOAD_DEFAULT_ETC_FIMRC,(fim_int)1); + setVariable(FIM_VID_DEFAULT_ETC_FIMRC,FIM_CNS_SYS_RC_FILEPATH); + setVariable(FIM_VID_PRELOAD_CHECKS,(fim_int)1); + *prompt_=*(prompt_+1)=FIM_SYM_CHAR_NUL; + } + + fim_err_t CommandConsole::execDefaultConfiguration(void) + { + /* FIXME: #including a file not a clean practice, but it is clean regarding this file. */ + #include "defaultConfiguration.cpp" + return FIM_ERR_NO_ERROR; + } + + bool CommandConsole::is_file(fim::string nf)const + { + /* + * note: + * this function is written a little bit unsafely, + * because the file could change between calls. + * improvements are possible. + * TODO: maybe access() should be used too (it checks file permissions, too) + */ + struct stat stat_s; + + if(-1==stat(nf.c_str(),&stat_s)) + goto err; + if( S_ISDIR(stat_s.st_mode)) + goto err; + return true; +err: + /* if the file doesn't exist, return false */ + return false; + } + + fim_err_t CommandConsole::addCommand(Command *c) + { + /* + * c is added to the commands list + */ + assert(c); + int idx=findCommandIdx(c->cmd_); + + if(idx!=FIM_INVALID_IDX) + { + // here, we replace rather than add + delete commands_[idx]; + commands_[idx]=c; + } + else + commands_.push_back(c); + return FIM_ERR_NO_ERROR; + } + + fim::string CommandConsole::alias(const fim::string& a, const fim::string& c, const fim::string& d) + { + /* + * an internal alias member function + */ + std::vector args; + args.push_back(Arg(a)); + args.push_back(Arg(c)); + args.push_back(Arg(d)); + return fcmd_alias(args); + } + + fim_char_t * CommandConsole::command_generator (const fim_char_t *text,int state,int mask)const + { + /* + * This is the reason why the commands should be kept + * in a list or vector, rather than a map... :( + * + * TODO : INSTEAD OF USING commands_[], make a new vector + * TODO : the 'mask' mechanism is still a quick hack; it shall be adjusted more properly + * with completions! + * FIXME + * DANGER : this member function allocates memory + */ + args_t completions; + aliases_t::const_iterator ai; + variables_t::const_iterator vi; + static size_t list_index=0; + fim_char_t nschar='\0'; + + if(state==0) + list_index=0; + while(isdigit(*text)) + text++; //initial repeat match + /*const*/ fim::string cmd(text); + if(cmd==FIM_CNS_EMPTY_STRING) + return FIM_NULL; + if(cmd.re_match(FIM_SYM_NAMESPACE_REGEX)==true) + { + mask=4, + nschar=cmd[0], + cmd=cmd.substr(2,cmd.size()); + } + if(mask==0 || (mask&1)) + for(size_t i=0;icmd_.find(cmd)==0) + completions.push_back(commands_[i]->cmd_); + } + if(mask==0 || (mask&2)) + for( ai=aliases_.begin();ai!=aliases_.end();++ai) + { + if((ai->first).find(cmd)==0){ +// cout << ".." << ai->first << ".." << " matches " << cmd << "\n"; + completions.push_back((*ai).first);} + } + if(mask==0 || (mask&4)) + { + if(nschar==FIM_SYM_NULL_NAMESPACE_CHAR || nschar==FIM_SYM_NAMESPACE_GLOBAL_CHAR) + for( vi=variables_.begin();vi!=variables_.end();++vi) + { + if((vi->first).find(cmd)==0) + completions.push_back((*vi).first); + } +#if 1 + if(browser_.c_image()) + if(nschar==FIM_SYM_NULL_NAMESPACE_CHAR || nschar==FIM_SYM_NAMESPACE_IMAGE_CHAR) + browser_.c_image()->find_matching_list(cmd,completions,true); + if(nschar==FIM_SYM_NULL_NAMESPACE_CHAR || nschar==FIM_SYM_NAMESPACE_BROWSER_CHAR) + browser_.find_matching_list(cmd,completions,true); +#ifdef FIM_WINDOWS + if(current_window().current_viewportp()) + if(nschar==FIM_SYM_NULL_NAMESPACE_CHAR || nschar==FIM_SYM_NAMESPACE_VIEWPORT_CHAR) + current_window().current_viewportp()->find_matching_list(cmd,completions,true); + if(nschar==FIM_SYM_NULL_NAMESPACE_CHAR || nschar==FIM_SYM_NAMESPACE_WINDOW_CHAR) + current_window().find_matching_list(cmd,completions,true); +#endif +#endif + } +#ifndef FIM_COMMAND_AUTOCOMPLETION + /* THIS DIRECTIVE IS MOTIVATED BY SOME STRANGE BUG! + */ + sort(completions.begin(),completions.end()); +#endif /* FIM_COMMAND_AUTOCOMPLETION */ + +/* for(size_t i=list_index;icmd_<< "\n"; + } + +/* for(int i=list_index;icmd_.find(cmd)==0) + { + list_index++; + //std::cout << cmd << " matches with " << commands_[i]->cmd_<< "\n"; + //fim_readline will free this strings.. + return dupstr(commands_[i]->cmd_.c_str()); + } + else + ;//std::cout << cmd << " no matches with " << commands_[i]->cmd_<< "\n"; + }*/ + //TO DO : ADD VARIABLE AND ALIAS EXPANSION.. + return FIM_NULL; + } + +#define istrncpy(x,y,z) {strncpy(x,y,z-1);x[z-1]='\0';} +#define ferror(s) {/*fatal error*/FIM_FPRINTF(stderr, "%s,%d:%s(please submit this error as a bug!)\n",__FILE__,__LINE__,s);}/* temporarily, for security reason : no exceptions launched */ +//#define ferror(s) {/*fatal error*/FIM_FPRINTF(stderr, "%s,%d:%s(please submit this error as a bug!)\n",__FILE__,__LINE__,s);throw FIM_E_TRAGIC;} + + fim::string CommandConsole::getBoundAction(const fim_key_t c)const + { + /* + * returns the action assigned to key biding c + * */ + bindings_t::const_iterator bi=bindings_.find(c); + + if(bi!=bindings_.end()) + return bi->second; + else + return FIM_CNS_EMPTY_RESULT; + } + + bool CommandConsole::executeBinding(const fim_key_t c) + { + /* + * Executes the command eventually bound to c. + * Doesn't log anything. + * If the binding is inexistent, ignores silently the error and return false. + */ + bindings_t::const_iterator bi=bindings_.find(c); + fim_err_t status=FIM_ERR_NO_ERROR; +#ifdef FIM_ITERATED_COMMANDS + static fim_int it_buf=-1; /* FIXME: make this it_buf_ instead. */ + + if( c>='0' && c <='9' && (bi==bindings_.end() || bi->second==FIM_CNS_EMPTY_STRING))//a number, not bound + { + if(it_buf>0) + { + fim_int nit_buf = it_buf; + it_buf*=10; + it_buf+=c - FIM_KEY_OFFSET; + if( it_buf < nit_buf ) + it_buf = nit_buf; + } + else + it_buf=c - FIM_KEY_OFFSET; + goto ret; + } + /* FIXME 20110515 this prevents infinite recursion on iterated commands in SDL mode. this is probably a bug in the sdl input handling code and shall be solved */ + if(c==FIM_SYM_NULL_KEY) + goto ret; +#endif /* FIM_ITERATED_COMMANDS */ + + if(bi!=bindings_.end() && bi->second!=FIM_CNS_EMPTY_STRING) + { + fim::string cf=current(); + FIM_AUTOCMD_EXEC(FIM_ACM_PREINTERACTIVECOMMAND,cf); +#ifdef FIM_ITERATED_COMMANDS + if(it_buf>1) + { + fim_int mit = getIntVariable(FIM_VID_MAX_ITERATED_COMMANDS); + fim::string nc; + + if(mit>0 && it_buf > mit) + { + cout << "Command repeat parameter of " << it_buf << " exceeds the maximum allowed value of " << mit << ". You can adjust " FIM_VID_MAX_ITERATED_COMMANDS " to raise this limit.\n"; + it_buf = FIM_MIN(mit,it_buf); + } + nc=it_buf; + if(it_buf>1) + nc+="{"+getBoundAction(c)+"}"; + /* adding ; before } can cause problems as long as ;; is not supported by the parser*/ + else + nc = getBoundAction(c); + + cout << "About to execute " << nc << " .\n"; + status=execute_internal(nc.c_str(),FIM_X_HISTORY); + it_buf=-1; + } + else +#endif /* FIM_ITERATED_COMMANDS */ + status=execute_internal(getBoundAction(c).c_str(),FIM_X_NULL); + FIM_AUTOCMD_EXEC(FIM_ACM_POSTINTERACTIVECOMMAND,cf); + } + + if(status) + { + std::cerr << "error performing execute()\n"; + //show_must_go_on_=0; /* we terminate interactive execution */ + } + else + return true; +ret: + return false; + } + + fim_err_t CommandConsole::execute_internal(const fim_char_t *ss, fim_xflags_t xflags) + { + try{ + /* + * This member function executes a character string containing a script. + * The second argument specifies whether the command is added or + * not to the command history buffer. + * + * note : the pipe here opened shall be closed in the yyparse() + * call, by the YY_INPUT macro (defined by me in lex.lex) + */ + fim_bool_t add_history_=(xflags&FIM_X_HISTORY)?true:false; + /* fim_bool_t suppress_output_=(xflags&FIM_X_QUIET)?true:false; */ + fim_char_t *s=dupstr(ss);//this malloc is free + int iret=0; + int r =0; + + if(s==FIM_NULL) + { + std::cerr << "allocation problem!\n"; + //if(s==FIM_NULL){ferror("null command");return;} + //assert(s); + //this shouldn't happen + //this->quit(0); + return FIM_ERR_GENERIC; + } + if(errno) + { + //fim_perror("before pipe(fim_pipedesc)"); + //goto ret; + fim_perror(FIM_NULL);// we need to clear errno + } + //we open a pipe with the lexer/parser + r = pipe(fim_pipedesc); + if(r!=0) + { + //strerror(errno); + std::cerr << "error piping with the command interpreter ( pipe() gave "<< r<< " )\n"; + std::cerr << "the command was:\"" << ss << "\"\n"; + std::cerr << "we had : "<< aliases_.size()<< " aliases_\n"; +// std::exit(-1); +// ferror("pipe error\n"); +// cleanup(); + if(errno) + { + fim_perror("in pipe(fim_pipedesc)"); + goto ret; + } + return FIM_ERR_GENERIC; + } + //we write there our script or commands + r=write(fim_pipedesc[1],s,strlen(s)); + if(errno) + { + fim_perror("in write(fim_pipedesc[1])"); + goto ret; + } + //we are done! + if((size_t)r!=strlen(s)) + { + ferror("write error"); + cleanup(); + return FIM_ERR_GENERIC; + } + for(fim_char_t *p=s;*p;++p) + if(*p=='\n') + *p=' '; + iret=close(fim_pipedesc[1]); + if(iret || errno) + { + fim_perror("in close(fim_pipedesc[1])"); + goto ret; + } + try { iret=yyparse(); } + catch (FimException e) + { + if( e == FIM_E_TRAGIC || e == FIM_E_NO_MEM ) + this->quit( FIM_E_NO_MEM ); + else + ; /* ]:-)> */ + } + close(fim_pipedesc[0]); + if(iret!=0 || errno!=0) + { + if(getIntVariable(FIM_VID_VERBOSE_ERRORS)==1) + { + // FIXME; the pipe descriptor is used in a bad way. + std::cout << "When parsing: " << FIM_MSG_CONSOLE_LONG_LINE << s << FIM_MSG_CONSOLE_LONG_LINE << "\n"; + fim_perror("in yyparse()"); + } + else + fim_perror(FIM_NULL); + // ignoring yyparse's errno: it may originate from any command! + //goto ret; + } + +#ifdef FIM_USE_READLINE + if(add_history_) + if(nochars(s)==false) + add_history(s); +#endif /* FIM_USE_READLINE */ +ret: + fim_free(s); + + } + catch (FimException e) + { + if( e == FIM_E_TRAGIC || true ) + this->quit( FIM_E_TRAGIC ); + } + //we add to history only meaningful commands/aliases. + return FIM_ERR_NO_ERROR; + } + + fim::string CommandConsole::execute(fim::string cmd, args_t args) + { + /* + * This is the member function where the tokenized commands are executed. + * This member function executes single commands with arguments. + */ + Command *c=FIM_NULL; + /* first determine whether cmd is an alias */ + fim::string ocmd=aliasRecall(cmd); + + if(ocmd!=FIM_CNS_EMPTY_STRING) + { + //an alias should be expanded. arguments are appended. + fim::string ex; + cmd=ocmd; + ex=ocmd; + /* + * WARNING : i am not sure this is the best choice + */ + fim_sys_int r = pipe(fim_pipedesc),sl; + if(r!=0) + {ferror("pipe error\n");exit(-1);} +#ifndef FIM_ALIASES_WITHOUT_ARGUMENTS + for(size_t i=0;i0) + useconds=atoi(args[0].c_str()); + usleep(useconds); + goto ok; + } + else + if(cmd==FIM_FLT_SLEEP) + { + fim_ts_t seconds=1; + + if(args.size()>0) + seconds=atoi(args[0].c_str()); +#if 0 + sleep(seconds); +#else + /* we want an interruptible sleep. */ + //while(seconds>0 && catchLoopBreakingCommand(seconds--))sleep(1); + catchLoopBreakingCommand(seconds); +#endif + goto ok; + } + else + if(cmd==FIM_FLT_ALIAS) + { + //assignment of an alias + std::vector aargs; //Arg args :P + + for(size_t i=0;ifcmd_alias(aargs) << "\n"; + goto ok; + } + else + { + c=findCommand(cmd); + +#ifdef FIM_COMMAND_AUTOCOMPLETION + if(getIntVariable(FIM_VID_CMD_EXPANSION)==1) + if(c==FIM_NULL) + { + fim_char_t *match = this->command_generator(cmd.c_str(),0,0); + + if(match) + { + //cout << "but found :`"<execute(args); + goto ok; + } + } + return "If you see this string, please report it to the program maintainer :P\n"; +ok: + return FIM_CNS_EMPTY_RESULT; + } + + fim_int CommandConsole::catchLoopBreakingCommand(fim_ts_t seconds) + { + /* + * This member function is invoked during non interactive loops to + * provide a method for interactive loop breaking. + * + * The provided mechanism allows the user to press any key + * during the loop, and the loop will continue its execution, + * unless the pressed key is not exitBinding_. + * + * If not, and the key is bound to some action; this action + * is executed. + * + * NOTE: this could nest while loops ! + * + * returns 0 if no command was received. + */ + fim_key_t c; + + if ( exitBinding_ == 0 ) + goto err; /* any key triggers an exit */ + + c = displaydevice_->catchInteractiveCommand(seconds); + // while((c = displaydevice_.catchInteractiveCommand(seconds))!=-1) + while(c!=-1) + { + /* while characters read */ + //if( c == -1 ) return 0; /* no chars read */ + sym_keys_t::const_iterator ki; + +// if(c==sym_keys_[FIM_KBD_ESC]) return 1; /* the user hit the exitBinding_ key */ +// if(c==sym_keys_[FIM_KBD_COLON]) return 1; /* the user hit the exitBinding_ key */ +// // 20110601 need some string variables with these two keys (see while() interruption documentation) + if((ki=sym_keys_.find(FIM_KBD_ESC))!=sym_keys_.end() && c==ki->second) + goto err; + if((ki=sym_keys_.find(FIM_KBD_COLON))!=sym_keys_.end() && c==ki->second) + goto err; + if( c != exitBinding_ ) /* characters read */ + { + /* + * we give the user chance to issue commands + * and some times to realize this. + * + * is it a desirable behaviour ? + */ + executeBinding(c); + if(!show_must_go_on_) + goto err; + c = displaydevice_->catchInteractiveCommand(1); +// return 0;/* could be a command key */ + } + if(c==exitBinding_) + goto err; /* the user hit the exitBinding_ key */ + } + return 0; /* no chars read */ +err: + return 1; + } + + +#ifdef FIM_USE_GPM + static int gh(Gpm_Event *event, void *clientdata) + { + std::cout << "GPM event captured.\n"; + exit(0); + //quit(); + return 'n'; + return 0; + } +#endif /* FIM_USE_GPM */ + + fim_perr_t CommandConsole::executionCycle(void) + { + /* + * the cycle with fetches the instruction stream. + * */ +#ifdef FIM_USE_GPM + Gpm_PushRoi(0,0,1023,768,GPM_DOWN|GPM_UP|GPM_DRAG|GPM_ENTER|GPM_LEAVE,gh,FIM_NULL); +#endif /* FIM_USE_GPM */ + fim::string initial = browser_.current(); +#ifdef FIM_AUTOCMDS + + FIM_AUTOCMD_EXEC(FIM_ACM_PREEXECUTIONCYCLE,initial); + FIM_AUTOCMD_EXEC(FIM_ACM_PREEXECUTIONCYCLEARGS,initial); +#endif /* FIM_AUTOCMDS */ + *prompt_=FIM_SYM_PROMPT_NUL; + + while(show_must_go_on_) + { + cycles_++; +#if 0 + /* dead code */ + // FIXME : document this + fd_set set; + struct timeval limit; + FD_SET(0, &set); + limit.tv_sec = -1; + limit.tv_usec = 0; +#endif + +#ifdef FIM_USE_READLINE + if(ic_==1) + { + ic_=1; + fim_char_t *rl = fim_readline(FIM_KBD_COLON); + *prompt_=FIM_SYM_PROMPT_CHAR; + if(rl==FIM_NULL) + { + goto rlnull; + } + else if(*rl!=FIM_SYM_CHAR_NUL) + { + /* + * This code gets executed when the user is about to exit console mode, + * having she pressed the 'Enter' key and expecting result. + * */ + fim::string cf=current(); + FIM_AUTOCMD_EXEC(FIM_ACM_PREINTERACTIVECOMMAND,cf); +#ifdef FIM_RECORDING + if(recordMode_==Recording) + record_action(fim::string(rl)); +#endif /* FIM_RECORDING */ + //ic_=0; // we 'exit' from the console for a while (WHY ? THIS CAUSES PRINTING PROBLEMS) + execute_internal(rl,FIM_X_HISTORY); //execution of the command line with history + ic_=(ic_==-1)?0:1; //a command could change the mode ! +// this->setVariable(FIM_VID_DISPLAY_CONSOLE,1); //!! +// execute_internal("redisplay;",FIM_X_NULL); //execution of the command line with history + FIM_AUTOCMD_EXEC(FIM_ACM_POSTINTERACTIVECOMMAND,cf); +#ifdef FIM_RECORDING + memorize_last(rl); +#endif /* FIM_RECORDING */ + //p.s.:note that current() returns not necessarily the same in + //the two FIM_AUTOCMD_EXEC() calls.. + } + /* else : *rl==FIM_CNS_EMPTY_STRING : doesn't happen :) */ + + if(rl && *rl==FIM_SYM_CHAR_NUL) + { + /* happens when no command is issued and Enter key is pressed */ + ic_=0; + *(prompt_)=FIM_SYM_PROMPT_NUL; + set_status_bar(FIM_CNS_EMPTY_STRING,FIM_NULL); + } + if(rl) + fim_free(rl); + } + else +#endif /* FIM_USE_READLINE */ + { +#ifdef FIM_USE_GPM + Gpm_Event *EVENT = FIM_NULL; +#endif /* FIM_USE_GPM */ + fim_key_t c; + fim_sys_int r; + fim_char_t buf[FIM_VERBOSE_KEYS_BUFSIZE]; + + *prompt_ = FIM_SYM_PROMPT_NUL; +// fim_sys_int c=getchar(); +// fim_sys_int c=fgetc(stdin); + /* + * problems : + * I can't read Control key and + * some upper case key together. + * I am not quite sure about portability.. + * ... maybe a sample program which photograph + * the keyboard is needed!. + */ + c=0; + r=displaydevice_->get_input(&c); +#ifdef FIM_USE_GPM + if(Gpm_GetEvent(EVENT)==1) + quit(); + else + cout << "..."; +#endif /* FIM_USE_GPM */ + if(r>0) + { + if(getIntVariable(FIM_VID_VERBOSE_KEYS)==1) + { + /* + * <0x20 ? print ^ 0x40+.. + * */ + sprintf(buf,"got : 0x%x (%d)\n",c,c); + cout << buf ; + } +#ifndef FIM_USE_READLINE + if(c==(fim_key_t)getIntVariable(FIM_VID_CONSOLE_KEY) || + c == FIM_SYM_FW_SEARCH_KEY || c == FIM_SYM_BW_SEARCH_KEY ) + set_status_bar("compiled with no readline support!\n",FIM_NULL); +#else /* FIM_USE_READLINE */ + if(c==(fim_key_t)getIntVariable(FIM_VID_CONSOLE_KEY)) + { + ic_=1; + *prompt_ = FIM_SYM_PROMPT_CHAR; + } + else + if( c == FIM_SYM_FW_SEARCH_KEY || c == FIM_SYM_BW_SEARCH_KEY ) + { + /* a hack to handle vim-style regexp searches */ + fim_sys_int tmp=rl_filename_completion_desired; + rl_hook_func_t *osh=rl_startup_hook; + rl_startup_hook=rl::fim_search_rl_startup_hook; + fim_char_t *rl = FIM_NULL; + const fim_char_t *rlp = FIM_CNS_SLASH_STRING; + *prompt_=FIM_SYM_PROMPT_SLASH; + if(c == FIM_SYM_BW_SEARCH_KEY) + rlp=FIM_CNS_QU_MA_STRING, + *prompt_='?'; + rl=fim_readline(rlp); // !! + ic_=1; + rl_inhibit_completion=1; + rl_startup_hook=osh; + // no readline ? no interactive searches ! + *prompt_=FIM_SYM_PROMPT_NUL; + rl_inhibit_completion=tmp; + ic_=0; + if(rl==FIM_NULL) + { + goto rlnull; + } + /* + * if using "" instead string("") + * warning: comparison with string literal results in unspecified behaviour */ + else if(rl!=string(FIM_CNS_EMPTY_STRING)) + { + args_t args; + std::string rls(""); + + if(c == FIM_SYM_BW_SEARCH_KEY) + rls+="-"; + rls+="/"; + rls+=rl; + rls+="/"; + args.push_back(rls); + execute(FIM_FLT_GOTO,args); + } + } + else +#endif /* FIM_USE_READLINE */ + { + + if( this->executeBinding(c) ) + { +#ifdef FIM_RECORDING + if(recordMode_==Recording) + record_action(getBoundAction(c)); + memorize_last(getBoundAction(c)); +#endif /* FIM_RECORDING */ + } + } + } + else + { + //cout<< "error reading key from keyboard\n"; + /* + * This happens when console switching, too. + * ( switching out of the current! ) + * So a redraw after is not bad. + * But it should work when stepping into the console, + * not out.. + */ + } + } + continue; +#ifdef FIM_USE_READLINE +rlnull: + { + ic_=0; + *prompt_=FIM_SYM_CHAR_NUL; + *prompt_=*(prompt_+1)=FIM_SYM_CHAR_NUL; + const fim_char_t * msg = " Warning: readline failed ! Probably no stdin is available, right ? Unfortunately fim is not yet ready for this case.\n"; + cout << msg; + set_status_bar(msg,FIM_NULL); + } + /* this->quit(); */ +#endif /* FIM_USE_READLINE */ + } + FIM_AUTOCMD_EXEC(FIM_ACM_POSTEXECUTIONCYCLE,initial); + return quit(return_code_); + } + + void CommandConsole::exit(fim_perr_t i)const + { + /* + * This member function will exit the program as a whole. + * If various object destructors are set to destroy device + * contexts, it should do no harm to the console. + * (it will call statically declared object's destructors ) + */ + std::exit(i); + } + + fim_perr_t CommandConsole::quit(fim_perr_t i) + { + /* + * the member function to be called to exit from the program safely. + * it is used mainly for safe and exit after severe errors. + * TODO : get rid of it. + */ + cleanup(); + return i;/* is should be used in return */ + } + +#if FIM_WANT_FILENAME_MARK_AND_DUMP + fim::string CommandConsole::marked_files_list(void)const + { + fim::string res; + for(std::set::iterator i=marked_files_.begin();i!=marked_files_.end();++i) + res += *i, + res += "\n"; + return res; + } +#endif /* FIM_WANT_FILENAME_MARK_AND_DUMP */ + + CommandConsole::~CommandConsole(void) + { + /* + * NOTE: + * as long as this class is a singleton, we couldn't care less about memory freeing :) + */ + fim::string sof=getStringVariable(FIM_VID_SCRIPTOUT_FILE); + +#if FIM_WANT_FILENAME_MARK_AND_DUMP + if(!marked_files_.empty()) + { + std::cerr << "The following files were marked by the user :\n"; + std::cerr << "\n"; + std::cout << marked_files_list(); + } +#endif /* FIM_WANT_FILENAME_MARK_AND_DUMP */ + if(sof!=FIM_CNS_EMPTY_STRING) + { + if(is_file(sof)) + { + std::cerr << "Warning : the "<0) + { + buf[r]='\0'; + cmds+=buf; + /* if(displaydevice_->catchInteractiveCommand(0)!=-1) goto ret; */ + } + if(rp) + *rp=r; +ret: + return cmds; + } + + fim_err_t CommandConsole::executeStdFileDescriptor(FILE* fd) + { + /* + * FIX ME HORRIBLE : FILE DESCRIPTOR USED AS A FILE HANDLE.. + * + * TODO : catch exceptions + */ + fim_sys_int r; + fim_err_t errv = FIM_ERR_NO_ERROR; + /* fim_char_t buf[FIM_STREAM_BUFSIZE]; */ + fim::string cmds = CommandConsole::readStdFileDescriptor(fd,&r); + + if(r==-1) + { + errv = FIM_ERR_GENERIC; + goto ret; + } + + execute_internal(cmds.c_str(),FIM_X_QUIET); +ret: + return errv; + } + + fim_err_t CommandConsole::executeFile(const fim_char_t *s) + { + /* + * executes a file denoted by filename + * */ + execute_internal(slurp_file(s).c_str(),FIM_X_QUIET); + return FIM_ERR_NO_ERROR; + } + + fim_var_t CommandConsole::getVariableType(const fim::string &varname)const + { + /* + * returns the [internal] type of a variable + * FIXME : eradicate this cancer + * */ + variables_t::const_iterator vi=variables_.find(varname); + + if(vi!=variables_.end()) + return vi->second.getType(); + else + return FIM_ERR_NO_ERROR; + } + + bool CommandConsole::isVariable(const fim::string &varname)const + { + const fim_char_t* s=FIM_NULL; + + s = getStringVariable(varname).c_str(); + return (s && *s); + } + + fim_err_t CommandConsole::printVariable(const fim::string &varname)const + { + /* + * a variable is taken and converted to a string and printed + * + * FIXME: should escape (possibly optionally) ? + * */ + fim::cout<inConsole() )<< ( (s&&*s) ) << "\n"; + fim_bool_t sd=( ( this->inConsole() /* in the command line */ + && (s&&*s) /* actually some text to add */ + ) + || this->getIntVariable(FIM_VID_DISPLAY_CONSOLE) /* or user requested for showing console */ + ); + return sd; + } + + fim::string CommandConsole::get_aliases_list(void)const + { + /* + * returns the list of set action aliases + */ + fim::string aliases_list; + aliases_t::const_iterator ai; + + for( ai=aliases_.begin();ai!=aliases_.end();++ai) + { + aliases_list+=((*ai).first); + aliases_list+=" "; + } + return aliases_list; + } + + fim::string CommandConsole::get_commands_list(void)const + { + /* + * returns the list of registered commands + */ + fim::string commands_list; + + for(size_t i=0;icmd_); + } + return commands_list; + } + + fim::string CommandConsole::get_variables_list(void)const + { + /* + * returns the list of set variables + */ + fim::string acl,sep=" "; + variables_t::const_iterator vi; + + for( vi=variables_.begin();vi!=variables_.end();++vi) + { + acl+=((*vi).first); + acl+=" "; + } + +#ifdef FIM_NAMESPACES + acl+=browser_.get_variables_list(); + acl+=sep; + if(browser_.c_image()) + { + acl+=browser_.c_image()->get_variables_list(); + acl+=sep; + } +#endif /* FIM_NAMESPACES */ +#ifdef FIM_WINDOWS + if(window_) + { + acl+=window_->get_variables_list(); + acl+=sep; + } + if(current_viewport()) + { + acl+=current_viewport()->get_variables_list(); + acl+=sep; + } +#endif /* FIM_WINDOWS */ + return acl; + } + +#ifdef FIM_AUTOCMDS + fim::string CommandConsole::autocmds_list(const fim::string event, const fim::string pattern)const + { + /* + * as of now, lists the events for which an autocmd could be assigned. + * + * FIX ME + */ + fim::string acl; +// std::map > autocmds_; + autocmds_t::const_iterator ai; + + if(event==FIM_CNS_EMPTY_STRING && pattern==FIM_CNS_EMPTY_STRING) + //for each autocommand event registered + for( ai=autocmds_.begin();ai!=autocmds_.end();++ai ) + //for each file pattern registered, display the list.. + for( autocmds_p_t::const_iterator api=((*ai)).second.begin(); + api!=((*ai)).second.end();++api ) + //.. display the list of autocommands... + for( args_t::const_iterator aui=((*api)).second.begin(); + aui!=((*api)).second.end();++aui ) + { + acl+=FIM_FLT_AUTOCMD" \""; + acl+=(*ai).first; + acl+="\" \""; + acl+=(*api).first; + acl+="\" \""; + acl+=(*aui); + acl+="\"\n"; + } + else + if(pattern==FIM_CNS_EMPTY_STRING) + { + autocmds_t::const_iterator ai=autocmds_.find(event); + //for each autocommand event registered + //for each file pattern registered, display the list.. + if(ai!=autocmds_.end()) + for( autocmds_p_t::const_iterator api=(*ai).second.begin(); + api!=(*ai).second.end();++api ) + //.. display the list of autocommands... + for( args_t::const_iterator aui=((*api)).second.begin(); + aui!=((*api)).second.end();++aui ) + { + acl+=FIM_FLT_AUTOCMD" \""; + acl+=(*ai).first; + acl+="\" \""; + acl+=(*api).first; + acl+="\" \""; + acl+=(*aui); + acl+="\"\n"; + } + } + else + { + autocmds_t::const_iterator ai=autocmds_.find(event); + + //for each autocommand event registered + //for each file pattern registered, display the list.. + if(ai!=autocmds_.end()) + { + autocmds_p_t::const_iterator api=(*ai).second.find(pattern); + + //.. display the list of autocommands... + if(api!=(*ai).second.end()) + { + for( args_t::const_iterator aui=((*api)).second.begin(); + aui!=((*api)).second.end();++aui ) + { + acl+=FIM_FLT_AUTOCMD" \""; + acl+=(*ai).first; + acl+="\" \""; + acl+=(*api).first; + acl+="\" \""; + acl+=(*aui); + acl+="\"\n"; + } + } + } + } + + if(acl==FIM_CNS_EMPTY_STRING) + acl="no autocommands loaded\n"; + return acl; + } + + fim::string CommandConsole::autocmd_del(const fim::string event, const fim::string pattern, const fim::string action) + { + /* + */ + autocmds_t::iterator ai; + size_t n = 0; + + if(event==FIM_CNS_EMPTY_STRING && pattern==FIM_CNS_EMPTY_STRING && action == FIM_CNS_EMPTY_STRING ) + { + /* deletion of all autocmd's */ + n = autocmds_.size(); + for( ai=autocmds_.begin();ai!=autocmds_.end();++ai ) + autocmds_.erase(ai); + } + else + if(action==FIM_CNS_EMPTY_STRING && pattern==FIM_CNS_EMPTY_STRING ) + { + /* deletion of all autocmd's for given event */ + ai=autocmds_.find(event); + if(ai==autocmds_.end()) + return FIM_CNS_EMPTY_RESULT; + n = (*ai).second.size(); + for( autocmds_p_t::iterator api=((*ai)).second.begin(); + api!=((*ai)).second.end();++api ) + (*ai).second.erase(api); + } + else + if(action==FIM_CNS_EMPTY_STRING) + { + /* deletion of all autocmd's for given event and pattern */ + ai=autocmds_.find(event); + if(ai==autocmds_.end()) + return FIM_CNS_EMPTY_RESULT; + autocmds_p_t::iterator api=((*ai)).second.find(pattern); + n = (*api).second.size(); + for( args_t::iterator aui=((*api)).second.begin(); + aui!=((*api)).second.end();++aui ) + (*api).second.erase(aui); + } + if(n) + return n+" autocmd's removed\n"; + else + return "no autocmd's removed\n"; + } + + fim::string CommandConsole::autocmd_add(const fim::string &event,const fim::string &pat,const fim::string &cmd) + { + /* + * the internal autocommand add function + * + * TODO : VALID VS INVALID EVENTS? + */ + if(cmd==FIM_CNS_EMPTY_STRING) + { + cout << "can't add empty autocommand\n"; + goto ok; + } + for(size_t i=0;i'"<\n"; + for( + autocmds_stack_t::const_iterator citer=autocmds_stack.begin(); + citer!=autocmds_stack.end();++citer,++indent ) + { + for(i=0;ifirst.first << " " + << citer->first.second << " " + << citer->second << "\n"; + } + } + + fim_bool_t CommandConsole::autocmd_in_stack(const autocmds_loop_frame_t& frame)const + { + /* + * this function prevents a second autocommand triggered against + * the same file to execute + */ + //return autocmds_loop_stack.find(frame)!=autocmds_loop_stack.end(); + return find(autocmds_loop_stack.begin(),autocmds_loop_stack.end(),frame)!=autocmds_loop_stack.end(); + } +#endif /* FIM_AUTOCMDS */ + + bool CommandConsole::regexp_match(const fim_char_t*s, const fim_char_t*r, int rsic)const + { + /* + * given a string s, and a Posix regular expression r, this + * member function returns true if there is match. false otherwise. + */ + regex_t regex; //should be static!!! + const fim_size_t nmatch=1; // we are satisfied with the first match, aren't we ? + regmatch_t pmatch[nmatch]; + + /* + * we allow for the default match, in case of null regexp + */ + if(!r || !strlen(r)) + return true; + + /* fixup code for a mysterious bug + */ + if(*r=='*') + return false; + + //if(regcomp(®ex,"^ \\+$", 0 | REG_EXTENDED | REG_ICASE )==-1) + if(regcomp(®ex,r, 0 | REG_EXTENDED | (rsic==0?0:REG_ICASE) )!=0) + { + /* error calling regcomp (invalid regexp?)! (should we warn the user ?) */ + //cout << "error calling regcomp (invalid regexp?)!" << "\n"; + return false; + } + else + { +// cout << "done calling regcomp!" << "\n"; + } + //if(regexec(®ex,s+0,nmatch,pmatch,0)==0) + if(regexec(®ex,s+0,nmatch,pmatch,0)!=REG_NOMATCH) + { +// cout << "'"<< s << "' matches with '" << r << "'\n"; +/* cout << "match : " << "\n"; + cout << "\""; + for(int m=pmatch[0].rm_so;mrecursive_redisplay(); + } + catch (FimException e) + { + // well, we should to something : FIXME + std::cerr << "fatal error" << __FILE__ << ":" << __LINE__ << "\n"; + } + return needed_redisplay; +#else /* FIM_WINDOWS */ + //browser_.redisplay(); + if(cc.viewport_) + return cc.viewport_->redisplay(); + return true; +#endif /* FIM_WINDOWS */ + } + + bool CommandConsole::display(void) + { + /* + * quick and dirty display function + */ +#ifdef FIM_WINDOWS + bool needed_redisplay=false; + + try + { + if(window_ ) + needed_redisplay=window_->recursive_display(); +#if 0 + else + printf("%s : here should go image rendering code.\n",__LINE__); +#endif + } + catch (FimException e) + { + // well, we should to something : FIXME + std::cerr << "fatal error" << __FILE__ << ":" << __LINE__ << "\n"; + } + return needed_redisplay; +#else /* FIM_WINDOWS */ + browser_.redisplay(); + return true; +#endif /* FIM_WINDOWS */ + } + +#ifdef FIM_RECORDING + void CommandConsole::record_action(const fim::string &cmd) + { + /* (action,millisleeps waitingbefore) is registered */ + /* + * PROBLEM: + clock_gettime() clock() times() getrusage() time() asctime() ctime(void) + are NOT suitable + + * clock_gettime() needs librealtime, and segfaults + * clock() gives process time, with no sense + * times() gives process time + * getrusage() gives process time + * time() gives time in seconds.. + * asctime(),ctime() give time in seconds.. + * + * gettimeofday was suggested by antani, instantaneously (thx antani) + * + * NOTE: recording the start_recording command itself is not harmful, + * as it only sets a flag. + * */ + static time_t pt=0; + fim_tms_t t,d,err;//t,pt in ms; d in us + struct timeval tv; + + if(cmd==FIM_CNS_EMPTY_STRING) + { + pt=0; + return; + } + if(!pt) + { + err=gettimeofday(&tv, FIM_NULL); + pt=tv.tv_usec/1000+tv.tv_sec*1000; + } + err=gettimeofday(&tv, FIM_NULL);t=tv.tv_usec/1000+tv.tv_sec*1000; + if(err != 0) + { + /* TODO: error handling ... */ + } + d=(t-pt)*1000; + pt=t; + recorded_actions_.push_back(recorded_action_t(sanitize_action(cmd),d)); + } +#endif /* FIM_RECORDING */ + +#if FIM_WANT_FILENAME_MARK_AND_DUMP + bool CommandConsole::isMarkedFile(std::string fname)const + { + if(marked_files_.find(fname)==marked_files_.end()) + return false; + else + return true; + } + + void CommandConsole::markCurrentFile(bool mark) + { + markFile(browser_.current(), mark); + } + + fim_int CommandConsole::markFile(const fim::string & file, bool mark, bool aloud) + { + /* + * the current file will be added to the list of filenames + * which will be printed upon the program termination. + * */ + fim_int ret = 0; /* number of impacted files */ + + if(file!=FIM_STDIN_IMAGE_NAME) + { + marked_files_t::iterator mfi=marked_files_.find(file); + if(mfi==marked_files_.end()) + { + if(mark) + { + ++ret; + marked_files_.insert(file); + if(aloud) + cout<<"Marked file \""<finalize(); + load_or_save_history(false); + } + + /* + * inserts the desc text into the textual console, + * and eventually displays it + */ + void CommandConsole::status_screen(const fim_char_t *desc) + { + if(!displaydevice_) + return; + + displaydevice_->fb_status_screen_new((fim_char_t*)desc,drawOutput(desc),0); + } + + void CommandConsole::set_status_bar(fim::string desc, const fim_char_t *info) + { + set_status_bar(desc.c_str(), info); + } + + + bool CommandConsole::set_wm_caption(const fim_char_t *str) + { + bool wcs = true; +#if FIM_WANT_CAPTION_CONTROL + fim_err_t rc=FIM_ERR_NO_ERROR; + string wcss = getStringVariable(FIM_VID_WANT_CAPTION_STATUS); + + if( wcss.c_str() && *wcss.c_str() && browser_.c_image()) + { + fim::string clb = browser_.c_image()->getInfoCustom(wcss.c_str()); + + rc = displaydevice_->set_wm_caption(clb.c_str()); + wcs = false; /* window caption + status */ + } + else + if( str && *str ) + rc = displaydevice_->set_wm_caption(str); + + if(rc==FIM_ERR_UNSUPPORTED) + wcs = false; /* revert */ +#endif /* FIM_WANT_CAPTION_CONTROL */ + return wcs; + } + + void CommandConsole::set_status_bar(const fim_char_t *desc, const fim_char_t *info) + { + /* + * Set the 'status bar' of the program. + * - desc will be placed on the left corner + * - info on the right + * Pointers are meant to be freed by the caller. + */ + int chars, ilen; + fim_char_t *str = FIM_NULL; + fim::string hk=FIM_CNS_EMPTY_STRING; /* help key string */ + int hkl=0; /* help key string length */ + const int mhkl=5,eisl=9; + const fim_char_t *hp=" - Help"; + int hpl=fim_strlen(hp); + prompt_[1]=FIM_SYM_CHAR_NUL; + fim_bool_t wcs = isSetVar(FIM_VID_WANT_CAPTION_STATUS); + + if( ! displaydevice_ ) + goto ret; + + hk=this->find_key_for_bound_cmd(FIM_FLT_HELP);/* FIXME: this is SLOW, and should be replaced */ + hkl=fim_strlen(hk.c_str()); + /* FIXME: can we guarantee a bound on its length in some way ? */ + if(hkl>mhkl) + {hk=FIM_CNS_EMPTY_STRING;hkl=0;/* fix */} + else + { + if(hkl>0) + {hk+=hp;hkl=hpl;/* help message append*/} + else + {hpl=0;/* no help key ? no message, then */} + } + + chars = displaydevice_->get_chars_per_line(); + if(chars<1) + goto ret; + + str = fim_stralloc(chars+1); + if(!str) + goto ret; + + if (desc && info) + { + /* non interactive print */ + /* + * FIXME : and what if chars < 11 ? :) + * */ + ilen = fim_strlen(info); + if(chars-eisl-ilen-hkl>0) + { +#if 0 + // sprintf(str, "%s%-*.*s [ %s ] %s",prompt_, + sprintf(str, "%s%-*.*s %s %s",prompt_, + chars-eisl-ilen-hkl, chars-eisl-ilen-hkl, desc, info, hk.c_str());//here above there is the need of 14+ilen chars +#else + snprintf(str, chars-1, "%s%-*.*s %s %s",prompt_, + chars-eisl-ilen-hkl, chars-eisl-ilen-hkl, desc, info, hk.c_str());//here above there is the need of 14+ilen chars +#endif + } + else + { + if(chars>5) + { + if(chars>10) + { + snprintf(str, chars-3, "%s%s", prompt_, info); + strcat(str, "..."); + } + else + sprintf(str, "<-!->"); + } + else + { + if(chars>0) + sprintf(str, "!"); + } /* :D */ + } + } +#ifdef FIM_USE_READLINE + else + if(chars>=6+hkl && desc) /* would be a nonsense :) */ + { + /* interactive print */ + static int statusline_cursor=0; + int offset=0,coffset=0; + + statusline_cursor=rl_point; /* rl_point is readline stuff */ + ilen = fim_strlen(desc); + chars-=6+hpl+(*prompt_=='\0'?0:1); /* displayable, non-service chars */ + if(!chars) + goto done; + /* 11 is strlen(" | H - Help")*/ + offset =(statusline_cursor/(chars))*(chars); + coffset=(*prompt_!='\0')+(statusline_cursor%(chars)); + + sprintf(str, "%s%-*.*s | %s",prompt_, chars, chars, desc+offset, hk.c_str()); + str[coffset]='_'; + } +#endif /* FIM_USE_READLINE */ + +#if FIM_WANT_CAPTION_CONTROL + if(wcs) + wcs = set_wm_caption(str); + if(!wcs) +#endif /* FIM_WANT_CAPTION_CONTROL */ + displaydevice_->status_line((const fim_char_t*)str); /* one may check the return value.... */ +done: + fim_free(str); +ret: + return; + } + + fim_bool_t CommandConsole::inConsole(void)const + { +#ifdef FIM_USE_READLINE + return ic_==1; +#else /* FIM_USE_READLINE */ + return false; +#endif /* FIM_USE_READLINE */ + } + + fim_err_t CommandConsole::resize(fim_coo_t w, fim_coo_t h, fim_bool_t wsl) + { + if(!displaydevice_) + return FIM_ERR_GENERIC; + if( wsl ) + h += displaydevice_->status_line_height(); + if(FIM_ERR_NO_ERROR!=displaydevice_->resize(w,h)) + return FIM_ERR_GENERIC; + + w=displaydevice_->width(); + h=displaydevice_->height(); + +#ifdef FIM_WINDOWS + if(window_) + { + Rect nr(0,0,w,h); + cc.window_->update(nr); + } +#endif + + displaydevice_->init_console(); + + // FIXME: this is a hack + setVariable("i:" FIM_VID_FRESH,(fim_int)1);//FIXME: bad practice + browser_.fcmd_redisplay(args_t()); + + if(getGlobalIntVariable(FIM_VID_DISPLAY_BUSY)) + { + fim::string msg="resized window to "; + msg+=fim::string(w); + msg+=" x "; + msg+=fim::string(h); + cc.set_status_bar(msg.c_str(),FIM_NULL); + } + + return FIM_ERR_NO_ERROR; + } + + fim_err_t CommandConsole::display_reinit(const fim_char_t *rs) + { + + if(!displaydevice_) + goto err; + return displaydevice_->reinit(rs); +err: + return FIM_ERR_GENERIC; + } + + fim_bool_t CommandConsole::key_syms_update(void) + { + sym_keys_t::const_iterator ki; + + for( ki=sym_keys_.begin();ki!=sym_keys_.end();++ki) + key_syms_[(((*ki).second))]=((*ki).first); + return true; + } + + size_t CommandConsole::byte_size(void)const + { + size_t bs = 0; + bs += browser_.byte_size(); + /* NOTE: lots is missing here */ +#if FIM_WANT_PIC_CMTS + bs += id_.byte_size(); +#endif /* FIM_WANT_PIC_CMTS */ + return bs; + } + + fim::string CommandConsole::fcmd_variables_list(const args_t& args) + { + return get_variables_list(); + } + + fim::string CommandConsole::fcmd_commands_list(const args_t& args) + { + return get_commands_list(); + } + + fim::string CommandConsole::current()const + { + return browser_.current(); + } + + CommandConsole& CommandConsole::operator= (const CommandConsole&cc) + { + return *this;/* a disabled copy constructor */ + } + + fim_sys_int CommandConsole::get_displaydevice_input(fim_key_t * c, bool want_poll) + { + return displaydevice_->get_input(c, want_poll); + } +} + diff --git a/src/CommandConsole.h b/src/CommandConsole.h new file mode 100644 index 0000000..88e07df --- /dev/null +++ b/src/CommandConsole.h @@ -0,0 +1,398 @@ +/* $LastChangedDate: 2017-07-14 21:46:19 +0200 (Fri, 14 Jul 2017) $ */ +/* + CommandConsole.h : Fim console dispatcher header file + + (c) 2007-2016 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef FIM_COMMANDCONSOLE_H +#define FIM_COMMANDCONSOLE_H +#include "fim.h" +#include "DummyDisplayDevice.h" + +#define FIM_WANT_RAW_KEYS_BINDING 1 + +namespace fim +{ +class CommandConsole +#if FIM_WANT_BENCHMARKS + : public Benchmarkable, +#endif /* FIM_WANT_BENCHMARKS */ + public Namespace +{ +#ifndef FIM_WANT_NO_OUTPUT_CONSOLE +#ifndef FIM_KEEP_BROKEN_CONSOLE + public: + MiniConsole mc_; +#endif /* FIM_KEEP_BROKEN_CONSOLE */ +#endif /* FIM_WANT_NO_OUTPUT_CONSOLE */ + private: + FontServer fontserver_; + + fim::string postInitCommand_; + fim::string preConfigCommand_; + fim::string postExecutionCommand_; + + fim_int show_must_go_on_; + fim_int return_code_; /* new, to support the 'return' command */ + bool mangle_tcattr_; + + struct termios saved_attributes_; + fim_sys_int saved_fl_; /* file status flags for stdin */ + + public: + Browser browser_; /* the image browser_ logic */ + private: + +#ifdef FIM_WINDOWS + fim::FimWindow * window_; +#endif /* FIM_WINDOWS */ + /* + * the registered command methods and objects + */ + std::vector commands_; //command->member function + + /* + * the aliases to actions (compounds of commands) + */ + typedef std::map > aliases_t; //alias->[commands,description] + //typedef std::map aliases_t; //alias->commands + aliases_t aliases_; //alias->commands + + /* + * bindings of key codes to actions (compounds of commands) + */ + typedef std::map bindings_t; //code->commands + bindings_t bindings_; //code->commands + typedef std::map bindings_help_t; // code->help + bindings_help_t bindings_help_; //code->commands + + /* + * mapping of key name to key code + */ + sym_keys_t sym_keys_; //symbol->code + + typedef std::map key_syms_t;//code->symbol + key_syms_t key_syms_;//code->symbol + + private: + + fim_err_t load_or_save_history(bool load_or_save); + + /* + * the identifier->variable binding + */ + //typedef std::map variables_t; //id->var + //variables_t variables_; //id->var + +#if FIM_WANT_FILENAME_MARK_AND_DUMP + /* + * the buffer of marked files + */ + typedef std::set marked_files_t; // + marked_files_t marked_files_; //filenames + public: + bool isMarkedFile(std::string fname)const; + fim::string marked_files_list(void)const; + private: +#endif /* FIM_WANT_FILENAME_MARK_AND_DUMP */ + + /* + * flags + */ +#ifdef FIM_USE_READLINE + /* no readline ? no console ! */ + fim_status_t ic_; //in console if 1. not if 0. willing to exit from console mode if -1 +#endif /* FIM_USE_READLINE */ + fim_cycles_t cycles_; //fim execution cycles_ counter (quite useless) + fim_key_t exitBinding_; //The key bound to exit. If 0, the special "Any" key. + +#ifdef FIM_AUTOCMDS + /* + * the mapping structure for autocommands () + */ + typedef std::map autocmds_p_t; //pattern - commands + typedef std::map autocmds_t; //autocommand - pattern - commands + autocmds_t autocmds_; +#endif /* FIM_AUTOCMDS */ + + /* + * the last executed action (being a command line or key bounded command issued) + */ + fim::string last_action_; + +#ifdef FIM_RECORDING + enum RecordMode { Recording, Playing, Normal }; + RecordMode recordMode_; + typedef std::pair recorded_action_t; + typedef std::vector recorded_actions_t; + recorded_actions_t recorded_actions_; + + bool dont_record_last_action_; + fim::string memorize_last(const fim::string &cmd); + fim::string repeat_last(const args_t &args); + fim::string dump_record_buffer(const args_t &args); + fim::string do_dump_record_buffer(const args_t &args)const; + fim::string execute_record_buffer(const args_t &args); + fim::string start_recording(void); + fim::string fcmd_recording(const args_t &args); + fim::string stop_recording(void); + fim::string sanitize_action(const fim::string &cmd)const; + + void record_action(const fim::string &cmd); +#endif /* FIM_RECORDING */ + + public: + fim_str_t fim_stdin_; // the standard input file descriptor + private: + fim_char_t prompt_[2]; + +#ifndef FIM_WANT_NOSCRIPTING + args_t scripts_; //scripts to execute : FIX ME PRIVATE +#endif /* FIM_WANT_NOSCRIPTING */ + +#if FIM_WANT_FILENAME_MARK_AND_DUMP + public: + void markCurrentFile(bool mark = true); + fim_int markFile(const fim::string & file, bool mark = true, bool aloud = true); + private: +#endif /* FIM_WANT_FILENAME_MARK_AND_DUMP */ +#ifdef FIM_WITH_AALIB + AADevice * aad_; +#endif /* FIM_WITH_AALIB */ + DummyDisplayDevice dummydisplaydevice_; + + friend class MiniConsole; // MiniConsole uses displaydevice_ intensively. + friend class FbiStuff; // The dependency is on switch_if_needed and debug_ . + friend class Viewport; // cleaning up this is bound to cleaning up use of CommandConsole in Viewport. + DisplayDevice *displaydevice_; + public: + fim_sys_int get_displaydevice_input(fim_key_t * c, bool want_poll=false); + + fim::string execute(fim::string cmd, args_t args); + + //const fim_char_t*get_prompt(void)const{return prompt_;} + + CommandConsole(void); + private: + CommandConsole& operator= (const CommandConsole&cc); + public: + bool display(void); + bool redisplay(void); + fim_char_t * command_generator (const fim_char_t *text,int state,int mask)const; + fim_perr_t executionCycle(void); + fim_err_t init(fim::string device); + fim_bool_t inConsole(void)const; + ~CommandConsole(void); + + /* the following group is defined in Namespace.cpp */ + fim_float_t getFloatVariable(const fim::string &varname)const; + fim::string getStringVariable(const fim::string &varname)const; + fim_int getIntVariable(const fim::string & varname)const; + Var getVariable(const fim::string & varname)const; + fim_int setVariable(const fim::string& varname,fim_int value); + fim_float_t setVariable(const fim::string& varname, fim_float_t value); + fim_int setVariable(const fim::string& varname,const fim_char_t*value); + Var setVariable(const fim::string varname,const Var&value); + Namespace * rns(const fim::string varname); + const Namespace * c_rns(const fim::string varname)const; + fim::string rnid(const fim::string & varname)const; + + fim_var_t getVariableType(const fim::string &varname)const; + fim_err_t printVariable(const fim::string & varname)const; + bool push(const fim::string nf, fim_flags_t pf=FIM_FLAG_DEFAULT); + fim_err_t executeStdFileDescriptor(FILE *fd); + fim::string readStdFileDescriptor(FILE* fd, int*rp=FIM_NULL); +#ifndef FIM_WANT_NOSCRIPTING + bool push_scriptfile(const fim::string ns); + bool with_scriptfile(void)const; + fim::string fcmd_executeFile(const args_t &args); +#endif /* FIM_WANT_NOSCRIPTING */ + private: + fim::string fcmd_echo(const args_t &args); + fim::string do_echo(const args_t &args)const; + // fim::string get_expr_type(const args_t &args); + fim::string fcmd_help(const args_t &args); + fim::string fcmd_quit(const args_t &args); + fim::string fcmd__stdout(const args_t &args); + /* naming this stdout raises problems on some systems + e.g.: +# uname -a +Darwin hostname 7.9.0 Darwin Kernel Version 7.9.0: Wed Mar 30 20:11:17 PST 2005; root:xnu/xnu-517.12.7.obj~1/RELEASE +# gcc -v +Reading specs from /usr/libexec/gcc/darwin/ppc/3.3/specs +Thread model: posix +gcc version 3.3 20030304 (Apple Computer, Inc. build 1495) +*/ + fim::string fcmd_foo (const args_t &args); + fim::string fcmd_status(const args_t &args); + fim_err_t executeFile(const fim_char_t *s); + fim_err_t execute_internal(const fim_char_t *ss, fim_xflags_t xflags); + + fim_err_t addCommand(Command *c); + Command* findCommand(fim::string cmd)const; + int findCommandIdx(fim::string cmd)const; + fim::string fcmd_alias(std::vector args); + fim::string alias(const fim::string& a,const fim::string& c, const fim::string& d=""); + fim::string aliasRecall(fim::string cmd)const; + fim::string fcmd_system(const args_t& args); + fim::string fcmd_cd(const args_t& args); + fim::string fcmd_pwd(const args_t& args); + fim::string fcmd_sys_popen(const args_t& args); +#ifdef FIM_PIPE_IMAGE_READ + fim::string fcmd_pread(const args_t& args); +#endif /* FIM_PIPE_IMAGE_READ */ + public:// 20110601 + fim_err_t fpush(FILE *tfd); + private: + fim::string fcmd_set_interactive_mode(const args_t& args); + fim::string fcmd_set_in_console(const args_t& args); +#ifdef FIM_AUTOCMDS + fim::string fcmd_autocmd(const args_t& args); + fim::string autocmd_del(const fim::string event, const fim::string pattern, const fim::string action); + fim::string fcmd_autocmd_del(const args_t& args); + public:// 20110601 + fim::string autocmd_add(const fim::string &event,const fim::string &pat,const fim::string &cmd); + private: + fim::string autocmds_list(const fim::string event, const fim::string pattern)const; +#endif /* FIM_AUTOCMDS */ + typedef std::pair autocmds_loop_frame_t; + typedef std::pair autocmds_frame_t; + typedef std::vector autocmds_stack__t; + typedef std::vector autocmds_stack_t; + //typedef std::set autocmds_stack_t; + autocmds_stack__t autocmds_loop_stack; + autocmds_stack_t autocmds_stack; + fim::string fcmd_bind(const args_t& args); + fim::string getAliasesList(void)const; + fim::string dummy(std::vector args); + fim::string fcmd_variables_list(const args_t& args); + fim::string fcmd_commands_list(const args_t& args); + fim::string fcmd_set(const args_t &args); + fim::string fcmd_unalias(const args_t& args); + //fim_char_t ** tokenize_(const fim_char_t *s); + bool executeBinding(const fim_key_t c); + fim::string getBoundAction(const fim_key_t c)const; + // void execute(fim::string cmd); + fim::string fcmd_eval(const args_t &args); + void exit(fim_perr_t i)const;// FIXME: exit vs quit + fim::string unbind(fim_key_t c); + fim::string bind(fim_key_t c,fim::string binding); + public: + fim::string find_key_for_bound_cmd(fim::string binding); + fim_err_t execDefaultConfiguration(void); + private: + fim::string unbind(const fim::string& key); + fim::string fcmd_unbind(const args_t& args); + fim::string getBindingsList(void)const; + fim::string fcmd_dump_key_codes(const args_t& args); + fim::string do_dump_key_codes(const args_t& args)const; +#ifndef FIM_WANT_NO_OUTPUT_CONSOLE + fim::string fcmd_clear(const args_t& args); + fim::string scroll_up(const args_t& args); + fim::string scroll_down(const args_t& args); +#endif /* FIM_WANT_NO_OUTPUT_CONSOLE */ + fim_perr_t quit(fim_perr_t i=FIM_CNS_ERR_QUIT); + public: + fim_key_t find_keycode_for_bound_cmd(fim::string binding); + + fim_bool_t drawOutput(const fim_char_t*s=FIM_NULL)const; + bool regexp_match(const fim_char_t*s, const fim_char_t*r, int rsic)const; +#ifdef FIM_AUTOCMDS + fim::string autocmd_exec(const fim::string &event,const fim::string &fname); + fim::string pre_autocmd_add(const fim::string &cmd); + fim::string pre_autocmd_exec(void); +#endif /* FIM_AUTOCMDS */ + fim_int catchLoopBreakingCommand(fim_ts_t seconds=0); + + private: + /* fim_key_t catchInteractiveCommand(fim_ts_t seconds=0)const; */ +#ifdef FIM_AUTOCMDS + fim::string autocmd_exec(const fim::string &event,const fim::string &pat,const fim::string &fname); + void autocmd_push_stack(const autocmds_loop_frame_t& frame); + void autocmd_pop_stack(const autocmds_loop_frame_t& frame); + public: + void autocmd_trace_stack(void); + private: + fim_bool_t autocmd_in_stack(const autocmds_loop_frame_t& frame)const; +#endif /* FIM_AUTOCMDS */ + fim::string current(void)const; + + fim::string get_alias_info(const fim::string aname)const; +#ifdef FIM_WINDOWS + const FimWindow & current_window(void)const; +#endif /* FIM_WINDOWS */ + fim::string get_variables_list(void)const; + fim::string get_aliases_list(void)const; + fim::string get_commands_list(void)const; + public: + + void printHelpMessage(const fim_char_t *pn="fim")const; + void appendPostInitCommand(const fim_char_t* c); + void appendPreConfigCommand(const fim_char_t* c); + void appendPostExecutionCommand(const fim::string &c); + bool appendedPostInitCommand(void)const; + bool appendedPreConfigCommand(void)const; + + Viewport* current_viewport(void)const; +#ifdef FIM_WINDOWS + /* Viewport is managed by FimWindow */ +#else /* FIM_WINDOWS */ + Viewport* viewport_; +#endif /* FIM_WINDOWS */ + void dumpDefaultFimrc(void)const; + + void tty_raw(void); + void tty_restore(void); + void cleanup(void); + + fim::string print_commands(void)const; + + void status_screen(const fim_char_t *desc); + void set_status_bar(fim::string desc, const fim_char_t *info); + void set_status_bar(const fim_char_t *desc, const fim_char_t *info); + bool is_file(fim::string nf)const; + fim::string fcmd_do_getenv(const args_t& args); + bool isVariable(const fim::string &varname)const; + fim::string dump_reference_manual(const args_t& args); + fim::string get_reference_manual(const args_t& args); + private: + fim::string get_commands_reference(FimDocRefMode refmode=DefRefMode)const; + fim::string get_variables_reference(FimDocRefMode refmode=DefRefMode)const; + public: + bool set_wm_caption(const fim_char_t *str); + fim_err_t resize(fim_coo_t w, fim_coo_t h, fim_bool_t wsl = false); + fim_err_t display_reinit(const fim_char_t *rs); + fim::string fcmd_basename(const args_t& args); + fim::string fcmd_desc(const args_t& args); + fim_bool_t key_syms_update(void); +#if FIM_WANT_BENCHMARKS + virtual fim_int get_n_qbenchmarks(void)const; + virtual string get_bresults_string(fim_int qbi, fim_int qbtimes, fim_fms_t qbttime)const; + virtual void quickbench_init(fim_int qbi); + virtual void quickbench_finalize(fim_int qbi); + virtual void quickbench(fim_int qbi); +#endif /* FIM_WANT_BENCHMARKS */ + virtual size_t byte_size(void)const; + public: +#if FIM_WANT_PIC_CMTS + ImgDscs id_; +#endif /* FIM_WANT_PIC_CMTS */ +}; +} + +#endif /* FIM_COMMANDCONSOLE_H */ diff --git a/src/DebugConsole.cpp b/src/DebugConsole.cpp new file mode 100644 index 0000000..52042ad --- /dev/null +++ b/src/DebugConsole.cpp @@ -0,0 +1,488 @@ +/* $LastChangedDate: 2016-01-12 18:49:21 +0100 (Tue, 12 Jan 2016) $ */ +/* + DebugConsole.cpp : Fim virtual console display. + + (c) 2008-2016 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "fim.h" + +#ifndef FIM_WANT_NO_OUTPUT_CONSOLE +namespace fim +{ + + #define min(x,y) ((x)<(y)?(x):(y)) + int MiniConsole::line_length(int li) + { + if(li= 0 + * lines from min(f_,cline_) to min(l,cline_) will be dumped + * + * if f_<0 and l>=0 and f_+l<0 and -f_<=cline_, + * lines from cline_+f_ to cline_-l will be dumped + * + * FIXME : this function returns often with -1 ! + * */ + int i; + const int maxcols = cc_.displaydevice_->get_chars_per_line(); + + if(f_<0 && l>=0 && f_+l<0 && -f_<=cline_) { f_=cline_+f_; l=cline_-l; } + else + if(f_<=l && f_>=0){f_=f_>cline_?cline_:f_;l=l>cline_?cline_:l;} + else + return FIM_ERR_GENERIC;// unsupported combination + + if(maxcols<1) + { +#if FIM_WANT_OVERLY_VERBOSE_DUMB_CONSOLE + if(maxcols==0) + { + // a fixup for the dumb console + int n=1+line_[l]-line_[f_]; + fim_char_t*buf=FIM_NULL; + if(n>0 && (buf=(fim_char_t*) + fim_malloc(n))!=FIM_NULL) + { + strncpy(buf,line_[f_],n); + buf[n-1]='\0'; + cc_.displaydevice_->fs_puts(cc_.displaydevice_->f_,0,0,buf); + fim_free(buf); + } + } + else +#endif /* FIM_WANT_OVERLY_VERBOSE_DUMB_CONSOLE */ + return FIM_ERR_GENERIC; + } + + fim_char_t *buf = (fim_char_t*) fim_malloc(maxcols+1); // ! we work on a stack, don't we ?! Fortran teaches us something here. + if(!buf) + return FIM_ERR_GENERIC; + + if(*bp_){fim_free(buf);return FIM_ERR_GENERIC;}//if *bp_ then we could print garbage so we exit before damage is done + + int fh=cc_.displaydevice_->f_ ? cc_.displaydevice_->f_->sheight():1; // FIXME : this is not clean + l-=f_; l%=(rows_+1); l+=f_; + + /* FIXME : the following line_ is redundant in fb, but not in SDL + * moreover, it seems useless in AA (could be a bug) + * */ + if(fh*(l-f_+1)>=cc_.displaydevice_->height()) + goto done; + cc_.displaydevice_->clear_rect(0, cc_.displaydevice_->width()-1, 0 ,fh*(l-f_+1) ); + + // fs_puts alone won't draw on screen, but in the back plane, so unlock/flip will be necessary + cc_.displaydevice_->lock(); + + for(i=f_ ;i<=l ;++i) + { + int t = (i0)--t; + buf[maxcols]='\0'; + while(t 0 for the line_ width, + * we truncate the line_ for the interval exceeding the screen width. + * */ + buf[ maxcols ]='\0'; + cc_.displaydevice_->fs_puts(cc_.displaydevice_->f_, 0, fh*(i-f_), (const fim_char_t*)buf); + } + + /* FIXME : THE FOLLOWING IS A FIXUP FOR AA! */ + for(i=0 ;ifs_puts(cc_.displaydevice_->f_, 0, fh*((l-f_+1)+i), (const fim_char_t*)buf); + } + cc_.displaydevice_->unlock(); + + cc_.displaydevice_->flush(); +done: + fim_free(buf); + return FIM_ERR_NO_ERROR; + #undef min + } + + fim_err_t MiniConsole::add(const fim_char_t* cso_) + { + fim_char_t *s=FIM_NULL,*b=FIM_NULL; + int nc; + int nl,ol=cline_; + fim_char_t *cs=FIM_NULL;/* using co would mean provoking the compiler */ + fim_char_t*cso=(fim_char_t*)cso_;// FIXME + +#if FIM_WANT_MILDLY_VERBOSE_DUMB_CONSOLE + if(cc_.displaydevice_ && 0==cc_.displaydevice_->get_chars_per_column()) + { + // we display input as soon as it received. + if(this->getGlobalIntVariable(FIM_VID_DISPLAY_CONSOLE)) + cc_.displaydevice_->fs_puts(cc_.displaydevice_->f_,0,0,(const fim_char_t*)cso); + } +#endif /* FIM_WANT_MILDLY_VERBOSE_DUMB_CONSOLE */ + cs=dupstr(cso); + + if(!cs) + goto rerr; + nc=strlen(cs); + if(!nc) + goto rerr; + nl=lines_count(cs,lwidth_); + if(lwidth_<1) + goto rerr; + nl=lines_count(cs,lwidth_); + // we count exactly the number of new entries needed in the arrays we have + if((s=const_cast(strchr(cs,'\n')))!=FIM_NULL && s!=cs) + nl+=(ccol_+(s-cs-1))/lwidth_;// single line_ with \n or multiline + else nl+=(strlen(cs)+ccol_)/lwidth_; // single line_, with no terminators + + /* + * we check for room (please note that nl >= the effective new lines introduced , while + * nc amounts to the exact extra room needed ) + * */ + if(nc+1+(int)(bp_-buffer_)>bsize_ || nl+1+cline_>lsize_) + return FIM_ERR_BUFFER_FULL;//no room : realloc needed ; 1 is for secur1ty + scroll_=scroll_-nl<0?0:scroll_-nl; + + // we copy the whole new string in our buffer_ + strcpy(bp_,cs); + fim_free(cs); cs=FIM_NULL; + sanitize_string_from_nongraph_except_newline(bp_,0); + s=bp_-ccol_;// we will work in our buffer_ space now on + b=s; + while(*s && (s=(fim_char_t*)next_row(s,lwidth_))!=FIM_NULL && *s) + { + line_[++cline_]=s;// we keep track of each new line_ + ccol_=0; + bp_=s; + }// !s || !*s + if(!*s && s-b==lwidth_){line_[++cline_]=(bp_=s);}// we keep track of the last line_ too + + + if(ol==cline_) + { + ccol_=strlen(line_[cline_]); // we update the current (right after last) column + bp_+=strlen(bp_); // the buffer_ points to the current column + } + else + { + ccol_=strlen(bp_); // we update the current (right after last) column + bp_+=ccol_; // the buffer_ points to the current column + } + return FIM_ERR_NO_ERROR; +rerr: + fim_free(cs); + return FIM_ERR_GENERIC; + } + + fim_err_t MiniConsole::setRows(int nr) + { + /* + * We update the displayed rows_, if this is physically possible + * If nr is negative, no correctness checks will occur. + * ( useful if calling this routine with FIM_NULL displaydevice.. ) + * */ + int maxrows; + if(nr<0) + { + rows_=-nr; + return FIM_ERR_NO_ERROR; + } + maxrows = cc_.displaydevice_->get_chars_per_column(); + if(nr>0 && nr<=maxrows) + { + rows_=nr; + return FIM_ERR_NO_ERROR; + } + return FIM_ERR_GENERIC; + } + + MiniConsole::MiniConsole(CommandConsole & cc,int lw, int r) + : + buffer_(FIM_NULL), + line_(FIM_NULL), + bp_(FIM_NULL), + bsize_(0), + lsize_(0), + ccol_(0), + cline_(0), + lwidth_(0), + rows_(0), + cc_(cc), + Namespace(&cc) + { + /* + * We initialize the console + * */ + int BS=FIM_CONSOLE_BLOCKSIZE; //block size of 1k + + bsize_ = BS * FIM_CONSOLE_DEF_WIDTH; + lsize_ = BS * 8; + + lwidth_=lw<=0?FIM_CONSOLE_DEF_WIDTH:lw; + rows_=r<=0?FIM_CONSOLE_DEF_ROWS:r; + + cline_ =0; + ccol_ =0; + buffer_=(fim_char_t*) fim_calloc(bsize_,sizeof(fim_char_t )); + line_ =(fim_char_t**)fim_calloc(lsize_,sizeof(fim_char_t*)); + bp_ =buffer_; + if(!buffer_ || !line_) + { + bsize_=0; + lsize_=0; + if(buffer_) + fim_free(buffer_); + if(line_ ) + fim_free(line_); + } + else + { + + line_[cline_]=buffer_; + } + add(FIM_MSG_CONSOLE_FIRST_LINE_BANNER); + } + + fim_err_t MiniConsole::do_dump(int amount)const + { + /* + * We dump: + * the last amount of lines if amount > 0 + * all the lines if amount == 0 + * the first ones if amount < 0 + * */ + if(amount > 0) + { + // dumps the last amount of lines + amount=amount>cline_?cline_:amount; + do_dump(cline_-amount+1,cline_); + } + else + if(amount ==0) + { + // dumps all of the lines + do_dump(0,cline_); + } + else + if(amount < 0) + { + // dumps the first amount of lines + if(-amount>=cline_) + amount+=cline_; + do_dump(0,-amount); + } + return FIM_ERR_NO_ERROR; + } + + fim_err_t MiniConsole::grow_lines(int glines) + { + /* + * grow of a specified amount of lines the lines array + * + * see the doc for grow() to get more + * */ + /* TEST ME AND FINISH ME */ + if(glines< 0) + return FIM_ERR_GENERIC; + if(glines==0) + return FIM_ERR_NO_ERROR; + fim_char_t **p; + p=line_; + line_=(fim_char_t**)realloc(line_,bsize_+glines*sizeof(fim_char_t*)); + if(!line_){line_=p;return FIM_ERR_GENERIC;/* no change */} + lsize_+=glines; + return FIM_ERR_NO_ERROR; + } + + fim_err_t MiniConsole::grow_buffer(int gbuffer) + { + /* + * grow of a specified amount of lines the buffer_ array + * + * see the doc for grow() to get more + * */ + /* TEST ME AND FINISH ME */ + if(gbuffer< 0) + return FIM_ERR_GENERIC; + if(gbuffer==0) + return FIM_ERR_NO_ERROR; + fim_char_t *p;int i,d; + p=buffer_; + buffer_=(fim_char_t*)realloc(buffer_,(bsize_+gbuffer)*sizeof(fim_char_t)); + if(!buffer_){buffer_=p;return FIM_ERR_GENERIC;/* no change */} + if((d=(p-buffer_))!=0)// in the case a shift is needed + { + for(i=0;i lwidth_ || ( lines_count(buffer_, newlwidth) + 1 < lsize_ ) ) + { + // no realloc, no risk + fim::string buf=buffer_; + if(((int)buf.size())==((int)(bp_-buffer_))) + { + ccol_=0;cline_=0;lwidth_=newlwidth;*line_=buffer_;bp_=buffer_; + // the easy way + add(buf.c_str());// by adding a very big chunk of text, we make sure it gets formatted. + return FIM_ERR_NO_ERROR; + } + // if some error happened in buf string initialization, we return -1 + return FIM_ERR_GENERIC; + } + return FIM_ERR_GENERIC; + } + + fim_err_t MiniConsole::dump(void) + { + /* + * We dump on screen the textual console contents. + * We care about user set variables. + * */ + fim_int co=getGlobalIntVariable(FIM_VID_CONSOLE_LINE_OFFSET); + fim_int lw=getGlobalIntVariable(FIM_VID_CONSOLE_LINE_WIDTH ); + fim_int ls=getGlobalIntVariable(FIM_VID_CONSOLE_ROWS ); + setGlobalVariable(FIM_VID_CONSOLE_BUFFER_TOTAL,(fim_int)bsize_); + setGlobalVariable(FIM_VID_CONSOLE_BUFFER_FREE, (fim_int)(bsize_-(bp_-buffer_))); + setGlobalVariable(FIM_VID_CONSOLE_BUFFER_USED, (fim_int)(bp_-buffer_)); + setGlobalVariable(FIM_VID_CONSOLE_BUFFER_LINES,(fim_int)cline_); + // we eventually update internal variables now + setRows(ls); + if( lw > 0 && lw!=lwidth_ ) + reformat(lw); + if(co>=0) + { + scroll_=scroll_%(rows_+1); + if(scroll_>0) + return do_dump((cline_-rows_+1-co)>=0?(cline_-(rows_-scroll_)+1-co):0,cline_-co); + else + return do_dump((cline_-rows_+1-co)>=0?(cline_-rows_+1-co):0,cline_-co); + } + else + return do_dump(-co-1,cline_); + return FIM_ERR_GENERIC; + } + + fim_err_t MiniConsole::do_dump(void)const + { + /* + * We dump on screen the textual console contents. + * */ + return do_dump((cline_-rows_+1)>=0?(cline_-rows_+1):0,cline_); + } + + fim_err_t MiniConsole::clear(void) + { + scroll_=rows_; + return FIM_ERR_NO_ERROR; + } + + fim_err_t MiniConsole::scroll_down(void) + { + scroll_=scroll_<1?0:--scroll_; + return FIM_ERR_NO_ERROR; + } + + fim_err_t MiniConsole::scroll_up(void) + { + scroll_=scroll_ +#include "fim.h" +#include "Var.h" +#include "Namespace.h" + +#ifndef FIM_WANT_NO_OUTPUT_CONSOLE +namespace fim +{ + class FimConsole + { + public: + //virtual void add(string s)=0; + // virtual int do_dump(int f, int l)const; + }; + + class MiniConsole +#ifdef FIM_NAMESPACES + :public Namespace +#endif /* FIM_NAMESPACES */ + { + fim_char_t *buffer_; // the raw console buffer + fim_char_t **line_; // the (displayed) line_ pointers array + + fim_char_t *bp_; // pointer to the top of the buffer + + int bsize_; // the buffer size + int lsize_; // the lines array size + + int ccol_; // the currently pointed column + int cline_; // the line_ on the top of the buffer + + int lwidth_; + int rows_; + int scroll_; + + public: + CommandConsole & cc_; // temporarily + + MiniConsole(CommandConsole & cc,int lw=48, int r=12); /* FIXME: shall get rid of numerical constants! */ + virtual ~MiniConsole(void){} + fim_err_t dump(void); // non const due to user variables reaction + fim_err_t grow(void); + fim_err_t setRows(int nr); + fim_err_t add(const fim_char_t * cso); + fim_err_t add(const fim_byte_t* cso); + fim_err_t reformat(int newlsize); + fim_err_t do_dump(int amount)const; + fim_err_t clear(void); + fim_err_t scroll_down(void); + fim_err_t scroll_up(void); + virtual size_t byte_size(void)const; + + private: + MiniConsole& operator= (const MiniConsole&mc); + MiniConsole(const MiniConsole &mc) : + Namespace(mc), + buffer_(FIM_NULL), + line_(FIM_NULL), + bp_(FIM_NULL), + bsize_(0), + lsize_(0), + ccol_(0), + cline_(0), + lwidth_(0), + rows_(0), + scroll_(0), + cc_(mc.cc_) + {/* this constructor should not be used */} + + int line_length(int li); + fim_err_t do_dump(int f, int l)const; + fim_err_t do_dump(void)const; + + fim_err_t grow_lines(int glines); + fim_err_t grow_buffer(int gbuffer); + fim_err_t grow(int glines, int gbuffer); + }; +} +#endif /* FIM_WANT_NO_OUTPUT_CONSOLE */ + +#endif /* FIM_CONSOLE_H */ + diff --git a/src/DisplayDevice.cpp b/src/DisplayDevice.cpp new file mode 100644 index 0000000..e6bc651 --- /dev/null +++ b/src/DisplayDevice.cpp @@ -0,0 +1,288 @@ +/* $LastChangedDate: 2016-01-12 18:49:21 +0100 (Tue, 12 Jan 2016) $ */ +/* + DisplayDevice.cpp : virtual device Fim driver file + + (c) 2008-2016 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "fim.h" +#include "DisplayDevice.h" + +#ifndef FIM_WANT_NO_OUTPUT_CONSOLE + DisplayDevice::DisplayDevice(MiniConsole & mc):fontname_(FIM_NULL) + ,mc_(mc) +#else /* FIM_WANT_NO_OUTPUT_CONSOLE */ + DisplayDevice::DisplayDevice():fontname_(FIM_NULL) +#endif /* FIM_WANT_NO_OUTPUT_CONSOLE */ + ,f_(FIM_NULL) + ,debug_(false) + ,redraw_(FIM_REDRAW_UNNECESSARY) + ,finalized_(false) + { + const fim_char_t *line; + + if (FIM_NULL != (line = fim_getenv(FIM_ENV_FBFONT))) + fontname_ = line; + } + + fim_sys_int DisplayDevice::get_input(fim_key_t * c, bool want_poll) + { + fim_sys_int r=0; + *c=0; + /* + * It is sad to place this functionality here, but often the input subsystem + * is tightly bound to the output device. + * FIXME : before, it accepted unsigned int + * */ +#ifdef FIM_SWITCH_FIXUP + /* + * this way the console switches the right way : + * the following code taken live from the original fbi.c + */ + + /* + * patch: the following read blocks the program even when switching console + */ + //r=read(fim_stdin_,&c,1); if(c==0x1b){read(0,&c,3);c=(0x1b)+(c<<8);} + /* + * so the next coded shoul circumvent this behaviour! + */ + { + fd_set set; + fim_sys_int fdmax; + struct timeval limit; + fim_sys_int timeout=1,rc,paused=0; + + FD_ZERO(&set); + FD_SET(cc.fim_stdin_, &set); + fdmax = 1; +#ifdef FBI_HAVE_LIBLIRC + /* + * expansion code :) + */ + if (-1 != lirc) + { + FD_SET(lirc,&set); + fdmax = lirc+1; + } +#endif /* FBI_HAVE_LIBLIRC */ + limit.tv_sec = timeout; + limit.tv_usec = 0; + rc = select(fdmax, &set, FIM_NULL, FIM_NULL, + (0 != timeout && !paused) ? &limit : FIM_NULL); + if(handle_console_switch()) /* this may have side effects, though */ + { + r=0; /* warning : originally a 'continue' in a loop ! */ + goto ret; + + } + + if (FD_ISSET(cc.fim_stdin_,&set)) + rc = read(cc.fim_stdin_, c, 4); + r=rc; + *c=int2msbf(*c); + } +#else /* FIM_SWITCH_FIXUP */ + /* + * this way the console switches the wrong way + */ + r=read(fim_stdin_,&c,4); //up to four chars should suffice +#endif /* FIM_SWITCH_FIXUP */ + //std::cout << (fim_int)*c<<"\n"; +ret: return r; + } + + fim_key_t DisplayDevice::catchInteractiveCommand(fim_ts_t seconds)const + { + /* + * + * THIS DOES NOT WORK, BECAUSE IT IS A BLOCKING READ. + * MAKE THIS READ UNBLOCKING AND UNCOMMENT. <- ? + * + * FIX ME + * + * NOTE : this call should 'steal' circa 1/10 of second.. + */ + fd_set set; + size_t rc=0; + fim_key_t c=-1,r;/* -1 means 'no character pressed */ + struct termios tattr, sattr; + + //we set the terminal in raw mode. + if (! isatty(cc.fim_stdin_)) + { + sleep(seconds); + goto ret; + } + + FD_SET(0, &set); + //fcntl(0,F_GETFL,&saved_fl); + tcgetattr (0, &sattr); + //fcntl(0,F_SETFL,O_BLOCK); + memcpy(&tattr,&sattr,sizeof(struct termios)); + tattr.c_lflag &= ~(ICANON|ECHO); + tattr.c_cc[VMIN] = 0; + tattr.c_cc[VTIME] = 1 * (seconds==0?1:(seconds*10)%256); + tcsetattr (0, TCSAFLUSH, &tattr); + //r=read(fim_stdin_,&c,4); + // FIXME : read(.,.,3) is NOT portable. DANGER + r=read(cc.fim_stdin_,&c,1); if(r>0&&c==0x1b){rc=read(0,&c,3);c=(0x1b)+(c<<8);/* we should do something with rc now */} + //we restore the previous console attributes + tcsetattr (0, TCSAFLUSH, &sattr); + if( r<=0 ) + c=-1; +ret: return c; /* we return the read key */ + } + +#ifndef FIM_KEEP_BROKEN_CONSOLE +void DisplayDevice::fb_status_screen_new(const fim_char_t *msg, fim_bool_t draw, fim_flags_t flags)//experimental +{ +#ifndef FIM_WANT_NO_OUTPUT_CONSOLE + fim_err_t r=FIM_ERR_NO_ERROR; + + if(flags==0x03) + { + /* clear screen sequence */ + mc_.clear(); + goto ret; + } + + if( flags==0x01 ) { mc_.scroll_down(); goto ret; } + if( flags==0x02 ) { mc_.scroll_up(); goto ret; } + + r=mc_.add(msg); + if(r==FIM_ERR_BUFFER_FULL) + { + r=mc_.grow(); + if(r==FIM_ERR_GENERIC) + goto ret; + r=mc_.add(msg); + if(r==FIM_ERR_GENERIC) + goto ret; + } + + if(!draw )//CONVENTION! + goto ret; + + //fb_memset(fb_mem ,0,fb_fix.line_length * (fb_var.yres/2)*(fs_bpp)); + this->lock(); +#if 1 + // FIXME: this is temporary + { + fim_int ls=cc.getIntVariable(FIM_VID_CONSOLE_ROWS); + fim_coo_t fh=f_?f_->sheight():1; + ls=FIM_MIN(ls,height()/fh); + clear_rect(0, width()-1, 0,fh*ls); + } +#else + clear_rect(0, width()-1, 0,ls); +#endif + this->unlock(); + mc_.dump(); +#endif /* FIM_WANT_NO_OUTPUT_CONSOLE */ +ret: + return; +} +#endif /* FIM_KEEP_BROKEN_CONSOLE */ + +fim_err_t DisplayDevice::console_control(fim_cc_t arg)//experimental +{ + if(arg==0x01) + fb_status_screen_new(FIM_NULL,false,arg); + if(arg==0x02) + fb_status_screen_new(FIM_NULL,false,arg); + if(arg==0x03) + fb_status_screen_new(FIM_NULL,false,arg); + return FIM_ERR_NO_ERROR; +} + +fim_err_t DisplayDevice::init_console(void) +{ +#ifndef FIM_WANT_NO_OUTPUT_CONSOLE + if(f_) + { + mc_.setRows ((height()/f_->sheight())/2); + mc_.reformat( width() /f_->swidth() ); + } + else + { + mc_.setRows ( height() ); + mc_.reformat( width() ); + } +#endif /* FIM_WANT_NO_OUTPUT_CONSOLE */ + return FIM_ERR_NO_ERROR; +} + +DisplayDevice::~DisplayDevice(void) +{ +} + +#if FIM_WANT_BENCHMARKS +fim_int DisplayDevice::get_n_qbenchmarks(void)const +{ + return 1; +} + +string DisplayDevice::get_bresults_string(fim_int qbi, fim_int qbtimes, fim_fms_t qbttime)const +{ + string msg=FIM_CNS_EMPTY_STRING; + + switch(qbi) + { + case 0: + msg+="fim check"; + msg+=" : "; + msg+=string((float)(((fim_fms_t)qbtimes)/((qbttime)*1.e-3))); + msg+=" clears/s\n"; + } + return msg; +} + +void DisplayDevice::quickbench_init(fim_int qbi) +{ + switch(qbi) + { + case 0: + string msg="fim check"; + std::cout << msg << " : " << "please be patient\n"; + break; + } +} + +void DisplayDevice::quickbench_finalize(fim_int qbi) +{ +} + +void DisplayDevice::quickbench(fim_int qbi) +{ + /* + a quick draw benchmark and sanity check. + currently performs only the clear function. + */ + switch(qbi) + { + case 0: + clear_rect(0, width()-1, 0,height()/2); + break; + } +} +#endif /* FIM_WANT_BENCHMARKS */ + + fim_err_t DisplayDevice::resize(fim_coo_t w, fim_coo_t h){return FIM_ERR_NO_ERROR;} + fim_err_t DisplayDevice::reinit(const fim_char_t *rs){return FIM_ERR_NO_ERROR;} + fim_err_t DisplayDevice::set_wm_caption(const fim_char_t *msg){return FIM_ERR_UNSUPPORTED;} + diff --git a/src/DisplayDevice.h b/src/DisplayDevice.h new file mode 100644 index 0000000..2f46cfc --- /dev/null +++ b/src/DisplayDevice.h @@ -0,0 +1,109 @@ +/* $LastChangedDate: 2015-12-13 19:48:22 +0100 (Sun, 13 Dec 2015) $ */ +/* + DisplayDevice.h : virtual device Fim driver header file + + (c) 2008-2015 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +#ifndef FIM_DISPLAY_DEVICE_H +#define FIM_DISPLAY_DEVICE_H + +#include "DebugConsole.h" + +class DisplayDevice +#if FIM_WANT_BENCHMARKS +: public Benchmarkable +#endif /* FIM_WANT_BENCHMARKS */ +{ + protected: + fim_bool_t finalized_; +#ifndef FIM_WANT_NO_OUTPUT_CONSOLE +#ifndef FIM_KEEP_BROKEN_CONSOLE + public: + MiniConsole & mc_; +#endif /* FIM_KEEP_BROKEN_CONSOLE */ +#endif /* FIM_WANT_NO_OUTPUT_CONSOLE */ + /* + * The generalization of a Fim output device. + */ + public: + struct fs_font *f_; + const fim_char_t* fontname_; + fim_bool_t debug_;// really, only for making happy fbdev + public: +#ifndef FIM_WANT_NO_OUTPUT_CONSOLE + DisplayDevice(MiniConsole &mc_); +#else /* FIM_WANT_NO_OUTPUT_CONSOLE */ + DisplayDevice(void); +#endif /* FIM_WANT_NO_OUTPUT_CONSOLE */ + virtual fim_err_t initialize(sym_keys_t &sym_keys)=0; + virtual void finalize(void)=0; + + virtual fim_err_t display( + void *ida_image_img, // source image structure + fim_coo_t iroff,fim_coo_t icoff, // row and column offset of the first input pixel + fim_coo_t irows,fim_coo_t icols,// rows and columns in the input image + fim_coo_t icskip, // input columns to skip for each line + fim_coo_t oroff,fim_coo_t ocoff,// row and column offset of the first output pixel + fim_coo_t orows,fim_coo_t ocols,// rows and columns to draw in output buffer + fim_coo_t ocskip,// output columns to skip for each line + fim_flags_t flags// some flags + )=0; + + virtual ~DisplayDevice(void); + + virtual void flush(void){}; + virtual void lock(void){} + virtual void unlock(void){} + virtual int get_chars_per_line(void)=0; + virtual int get_chars_per_column(void)=0; + virtual fim_coo_t width(void)=0; + virtual fim_bpp_t get_bpp(void)=0; + virtual fim_coo_t height(void)=0; + virtual fim_coo_t status_line_height(void)const=0; + /* virtual fim_coo_t font_width(void)const{return 1;} */ + virtual fim_err_t status_line(const fim_char_t *msg)=0; + fim_err_t console_control(fim_cc_t code); + virtual fim_bool_t handle_console_switch(void)=0; + virtual fim_err_t clear_rect(fim_coo_t x1, fim_coo_t x2, fim_coo_t y1,fim_coo_t y2)=0; + virtual fim_err_t fill_rect(fim_coo_t x1, fim_coo_t x2, fim_coo_t y1,fim_coo_t y2, fim_color_t color)=0; + virtual fim_sys_int get_input(fim_key_t * c, bool want_poll=false); + virtual fim_key_t catchInteractiveCommand(fim_ts_t seconds)const; + virtual fim_err_t init_console(void); + virtual void switch_if_needed(void){}// really, only for making happy fbdev + virtual void cleanup(void){}// really, only for making happy fbdev + protected: + fim_redraw_t redraw_; /* expected to be FIM_REDRAW_UNNECESSARY after each display() */ + public: + fim_bool_t need_redraw(void)const{ return ( redraw_ != FIM_REDRAW_UNNECESSARY ); } + virtual fim_err_t fs_puts(struct fs_font *f, fim_coo_t x, fim_coo_t y, const fim_char_t *str)=0; + void fb_status_screen_new(const fim_char_t *msg, fim_bool_t draw, fim_flags_t flags);//experimental +#if FIM_WANT_BENCHMARKS + virtual fim_int get_n_qbenchmarks(void)const; + virtual string get_bresults_string(fim_int qbi, fim_int qbtimes, fim_fms_t qbttime)const; + virtual void quickbench_init(fim_int qbi); + virtual void quickbench_finalize(fim_int qbi); + virtual void quickbench(fim_int qbi); +#endif /* FIM_WANT_BENCHMARKS */ + private: + virtual void console_switch(fim_bool_t is_busy){}// really, only for making happy fbdev + public: + virtual fim_err_t resize(fim_coo_t w, fim_coo_t h); + virtual fim_err_t reinit(const fim_char_t *rs); + virtual fim_err_t set_wm_caption(const fim_char_t *msg); +}; + +#endif /* FIM_DISPLAY_DEVICE_H */ diff --git a/src/DummyDisplayDevice.h b/src/DummyDisplayDevice.h new file mode 100644 index 0000000..0645efe --- /dev/null +++ b/src/DummyDisplayDevice.h @@ -0,0 +1,68 @@ +/* $LastChangedDate: 2015-11-08 18:26:06 +0100 (Sun, 08 Nov 2015) $ */ +/* + DummyDisplayDevice.h : virtual device Fim driver header file + + (c) 2008-2015 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +#ifndef FIM_DUMMYDISPLAY_DEVICE_H +#define FIM_DUMMYDISPLAY_DEVICE_H + + +class DummyDisplayDevice:public DisplayDevice +{ + /* + * The generalization of a Fim output device. + */ + public: + virtual fim_err_t initialize(sym_keys_t &sym_keys){return FIM_ERR_NO_ERROR;} + virtual void finalize(void){} + + virtual fim_err_t display( + void *ida_image_img, // source image structure + fim_coo_t iroff,fim_coo_t icoff, // row and column offset of the first input pixel + fim_coo_t irows,fim_coo_t icols,// rows and columns in the input image + fim_coo_t icskip, // input columns to skip for each line + fim_coo_t oroff,fim_coo_t ocoff,// row and column offset of the first output pixel + fim_coo_t orows,fim_coo_t ocols,// rows and columns to draw in output buffer + fim_coo_t ocskip,// output columns to skip for each line + fim_flags_t flags// some flags + ){return FIM_ERR_NO_ERROR;} + +#ifndef FIM_WANT_NO_OUTPUT_CONSOLE + DummyDisplayDevice(MiniConsole & mc_):DisplayDevice(mc_){} +#else + DummyDisplayDevice(void){} +#endif /* FIM_WANT_NO_OUTPUT_CONSOLE */ + virtual ~DummyDisplayDevice(void){} + + virtual int get_chars_per_line(void){return 0;/* this is a special value */} + virtual int get_chars_per_column(void){return 0;/* */} + virtual fim_coo_t width(void){return 1;/* 0 would be so cruel */} + virtual fim_coo_t height(void){return 1;/* 0 would be so cruel */} + virtual fim_err_t status_line(const fim_char_t *msg){return FIM_ERR_NO_ERROR;} + virtual fim_err_t console_control(fim_cc_t code){return FIM_ERR_NO_ERROR;} + virtual fim_bool_t handle_console_switch(void){return false;} + virtual fim_err_t clear_rect(fim_coo_t x1, fim_coo_t x2, fim_coo_t y1,fim_coo_t y2){return FIM_ERR_NO_ERROR;} + virtual fim_err_t fill_rect(fim_coo_t x1, fim_coo_t x2, fim_coo_t y1,fim_coo_t y2, fim_color_t color){ return FIM_ERR_NO_ERROR; } + fim_err_t fs_puts(struct fs_font *f, fim_coo_t x, fim_coo_t y, const fim_char_t *str){return FIM_ERR_NO_ERROR;} + virtual fim_bpp_t get_bpp(void){return 0;} + virtual fim_coo_t status_line_height(void)const{return 0;} + + private: +}; + +#endif /* FIM_DUMMYDISPLAY_DEVICE_H */ diff --git a/src/FbiStuff.cpp b/src/FbiStuff.cpp new file mode 100644 index 0000000..a1bf1b7 --- /dev/null +++ b/src/FbiStuff.cpp @@ -0,0 +1,2465 @@ +/* $LastChangedDate: 2017-07-10 12:40:42 +0200 (Mon, 10 Jul 2017) $ */ +/* + FbiStuff.cpp : Misc fbi functions, modified for fim + + (c) 2008-2017 Michele Martone + (c) 1998-2006 Gerd Knorr + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +/* + * This file comes from fbi, and will undergo severe reorganization. + * */ + + +#include "fim.h" +#include "fim_plugin.h" +#include "common.h" + +#include /* fdopen, tmpfile */ +#include /* execlp (popen is dangerous) */ +#include /* mkstemp */ +#include +#include /* waitpid */ +#include +#include /* va_start, va_end, ... */ +#if FIM_WITH_ARCHIVE +#include +#include +//extern "C" { const char * archive_entry_pathname(struct archive_entry *); } +#endif /* FIM_WITH_ARCHIVE */ + +#define FIM_HAVE_FULL_PROBING_LOADER 0 +#ifdef HAVE_FMEMOPEN +//#define FIM_SHALL_BUFFER_STDIN (HAVE_FMEMOPEN && FIM_READ_STDIN_IMAGE) /* FIXME: new */ +#define FIM_SHALL_BUFFER_STDIN 0 /* FIXME: before activating this, we shall harmonize other buffering methods first (e.g.: cc.fpush(), which is backed up by a temporary file) */ +#else /* HAVE_FMEMOPEN */ +#define FIM_SHALL_BUFFER_STDIN 0 +#endif /* HAVE_FMEMOPEN */ + +#define FIM_WANTS_SLOW_RESIZE 1 +#define FIM_WVMM 0 /* want verbose mip maps (for FIM_WANT_EXPERIMENTAL_MIPMAPS) */ + +#define FIM_FBISTUFF_INSPECT 0 +#if FIM_FBISTUFF_INSPECT +#define FIM_PR(X) printf("FBISTUFF:%c:%20s\n",X,__func__); +#else /* FIM_FBISTUFF_INSPECT */ +#define FIM_PR(X) +#endif /* FIM_FBISTUFF_INSPECT */ + +namespace fim +{ + +extern CommandConsole cc; + + +/* ----------------------------------------------------------------------- */ +#if FIM_WANT_EXPERIMENTAL_MIPMAPS +static fim_err_t mipmap_compute(const fim_coo_t w, const fim_coo_t h, const int hw, const int hh, const fim_byte_t *FIM_RSTRCT src, fim_byte_t * FIM_RSTRCT dst) +{ + fim_err_t errval = FIM_ERR_GENERIC; + /* we compute a quarter of an image, half-sided */ + + if(hw<1||hh<1) + { + goto err; + } +#if 0 + /* 'internal' version, unfinished */ + for(int r=0;ri.width, h = src->i.height; /* the original */ + mm.nmm=0; + mm.mmoffs[mm.nmm]=0; + if(FIM_WVMM) std::cout << 3*src->i.width*src->i.height<< " bytes are needed for the original image\n"; + for(d=2;w>=d && h>=d && mm.nmm<=FIM_MAX_MIPMAPS ;d*=2) + { + mm.mmw[mm.nmm]=w/d; + mm.mmh[mm.nmm]=h/d; + mm.mmsize[mm.nmm]=(w/d)*(h/d)*3; + mm.mmb+=mm.mmsize[mm.nmm]; + mm.mmoffs[mm.nmm+1]=mm.mmb; + ++mm.nmm; + } + if(FIM_WVMM) std::cout << mm.nmm << " mipmaps are possible\n"; + if(FIM_WVMM) std::cout << mm.mmb << " bytes are needed for the mipmaps\n"; + if(mm.nmm<1) + { + goto err; + } + mm.mdp=(fim_byte_t*)fim_calloc(1,mm.mmb); + if(!mm.mdp) + { + goto err; + } + + if(mm.nmm) + mipmap_compute(w,h,w/2,h/2,src->data,mm.mdp+mm.mmoffs[0]); + for(mmidx=1,d=2;mmidxdata + line * src->i.width * 3; + memcpy(dst,scanline,src->i.width * 3); + if (line < rect->y1 || line >= rect->y2) + return; + dst += 3*rect->x1; + scanline += 3*rect->x1; + for (i = rect->x1; i < rect->x2; i++) { + g = (scanline[0]*30 + scanline[1]*59+scanline[2]*11)/100; + dst[0] = g; + dst[1] = g; + dst[2] = g; + scanline += 3; + dst += 3; + } +} + +/* ----------------------------------------------------------------------- */ + +struct op_3x3_handle { + struct op_3x3_parm filter; + int *linebuf; +}; + +static void* +op_3x3_init(const struct ida_image *src, struct ida_rect *rect, + struct ida_image_info *i, void *parm) +{ + struct op_3x3_parm *args = (struct op_3x3_parm*)parm; + struct op_3x3_handle *h; + + h = (struct op_3x3_handle*)fim_malloc(sizeof(*h)); + if(!h)goto oops; + memcpy(&h->filter,args,sizeof(*args)); + h->linebuf = (int*)fim_malloc(sizeof(int)*3*(src->i.width)); + if(!h->linebuf)goto oops; + + *i = src->i; + return h; +oops: + if(h && h->linebuf)fim_free(h->linebuf); + if(h)fim_free(h); + return FIM_NULL; +} + +static int inline +op_3x3_calc_pixel(struct op_3x3_parm *p, fim_byte_t *s1, + fim_byte_t *s2, fim_byte_t *s3) +{ + int val = 0; + + val += p->f1[0] * s1[0]; + val += p->f1[1] * s1[3]; + val += p->f1[2] * s1[6]; + val += p->f2[0] * s2[0]; + val += p->f2[1] * s2[3]; + val += p->f2[2] * s2[6]; + val += p->f3[0] * s3[0]; + val += p->f3[1] * s3[3]; + val += p->f3[2] * s3[6]; + if (p->mul && p->div) + val = val * p->mul / p->div; + val += p->add; + return val; +} + +static void +op_3x3_calc_line(const struct ida_image *src, struct ida_rect *rect, + int *dst, unsigned int line, struct op_3x3_parm *p) +{ + fim_byte_t b1[9],b2[9],b3[9]; + fim_byte_t *s1,*s2,*s3; + unsigned int i,left,right; + + s1 = src->data + (line-1) * src->i.width * 3; + s2 = src->data + line * src->i.width * 3; + s3 = src->data + (line+1) * src->i.width * 3; + if (0 == line) + s1 = src->data + line * src->i.width * 3; + if (src->i.height-1 == line) + s3 = src->data + line * src->i.width * 3; + + left = rect->x1; + right = rect->x2; + if (0 == left) { + /* left border special case: dup first col */ + memcpy(b1,s1,3); + memcpy(b2,s2,3); + memcpy(b3,s3,3); + memcpy(b1+3,s1,6); + memcpy(b2+3,s2,6); + memcpy(b3+3,s3,6); + dst[0] = op_3x3_calc_pixel(p,b1,b2,b3); + dst[1] = op_3x3_calc_pixel(p,b1+1,b2+1,b3+1); + dst[2] = op_3x3_calc_pixel(p,b1+2,b2+2,b3+2); + left++; + } + if (src->i.width == right) { + /* right border */ + memcpy(b1,s1+src->i.width*3-6,6); + memcpy(b2,s2+src->i.width*3-6,6); + memcpy(b3,s3+src->i.width*3-6,6); + memcpy(b1+3,s1+src->i.width*3-3,3); + memcpy(b2+3,s2+src->i.width*3-3,3); + memcpy(b3+3,s3+src->i.width*3-3,3); + dst[src->i.width*3-3] = op_3x3_calc_pixel(p,b1,b2,b3); + dst[src->i.width*3-2] = op_3x3_calc_pixel(p,b1+1,b2+1,b3+1); + dst[src->i.width*3-1] = op_3x3_calc_pixel(p,b1+2,b2+2,b3+2); + right--; + } + + dst += 3*left; + s1 += 3*(left-1); + s2 += 3*(left-1); + s3 += 3*(left-1); + for (i = left; i < right; i++) { + dst[0] = op_3x3_calc_pixel(p,s1++,s2++,s3++); + dst[1] = op_3x3_calc_pixel(p,s1++,s2++,s3++); + dst[2] = op_3x3_calc_pixel(p,s1++,s2++,s3++); + dst += 3; + } +} + +static void +op_3x3_clip_line(fim_byte_t *dst, int *src, int left, int right) +{ + int i,val; + + src += left*3; + dst += left*3; + for (i = left*3; i < right*3; i++) { + val = *(src++); + if (val < 0) + val = 0; + if (val > 255) + val = 255; + *(dst++) = val; + } +} + +static void +op_3x3_work(const struct ida_image *src, struct ida_rect *rect, + fim_byte_t *dst, int line, void *data) +{ + struct op_3x3_handle *h = (struct op_3x3_handle *)data; + fim_byte_t *scanline; + + scanline = (fim_byte_t*) src->data + line * src->i.width * 3; + memcpy(dst,scanline,src->i.width * 3); + if (line < rect->y1 || line >= rect->y2) + return; + + op_3x3_calc_line(src,rect,h->linebuf,line,&h->filter); + op_3x3_clip_line(dst,h->linebuf,rect->x1,rect->x2); +} + +static void +op_3x3_free(void *data) +{ + struct op_3x3_handle *h = (struct op_3x3_handle *)data; + + fim_free(h->linebuf); + fim_free(h); +} + +/* ----------------------------------------------------------------------- */ + +struct op_sharpe_handle { + int factor; + int *linebuf; +}; + +static void* +op_sharpe_init(const struct ida_image *src, struct ida_rect *rect, + struct ida_image_info *i, void *parm) +{ + struct op_sharpe_parm *args = (struct op_sharpe_parm *)parm; + struct op_sharpe_handle *h; + + h = (struct op_sharpe_handle *)fim_calloc(1,sizeof(*h)); + if(!h)goto oops; + h->factor = args->factor; + h->linebuf = (int *)fim_malloc(sizeof(int)*3*(src->i.width)); + if(!h->linebuf)goto oops; + + *i = src->i; + return h; +oops: + if(h && h->linebuf)fim_free(h->linebuf); + if(h)fim_free(h); + return FIM_NULL; +} + +static void +op_sharpe_work(const struct ida_image *src, struct ida_rect *rect, + fim_byte_t *dst, int line, void *data) +{ + static struct op_3x3_parm laplace = { +/* f1: { 1, 1, 1 }, + f2: { 1, -8, 1 }, + f3: { 1, 1, 1 },*/ + { 1, 1, 1 }, + { 1, -8, 1 }, + { 1, 1, 1 }, + 0,0,0 + }; + struct op_sharpe_handle *h = (struct op_sharpe_handle *)data; + fim_byte_t *scanline; + int i; + + scanline = src->data + line * src->i.width * 3; + memcpy(dst,scanline,src->i.width * 3); + if (line < rect->y1 || line >= rect->y2) + return; + + op_3x3_calc_line(src,rect,h->linebuf,line,&laplace); + for (i = rect->x1*3; i < rect->x2*3; i++) + h->linebuf[i] = scanline[i] - h->linebuf[i] * h->factor / 256; + op_3x3_clip_line(dst,h->linebuf,rect->x1,rect->x2); +} + +static void +op_sharpe_free(void *data) +{ + struct op_sharpe_handle *h = (struct op_sharpe_handle *)data; + + fim_free(h->linebuf); + fim_free(h); +} + +/* ----------------------------------------------------------------------- */ + +struct op_resize_state { + float xscale,yscale,inleft; + float *rowbuf; + unsigned int width,height,srcrow; +}; + +static void* +op_resize_init(const struct ida_image *src, struct ida_rect *rect, + struct ida_image_info *i, void *parm) +{ + struct op_resize_parm *args = (struct op_resize_parm *)parm; + struct op_resize_state *h; + + h = (struct op_resize_state *)fim_calloc(1,sizeof(*h)); + if(!h) + goto oops; + h->width = args->width; + h->height = args->height; + h->xscale = (float)args->width/src->i.width; + h->yscale = (float)args->height/src->i.height; + h->rowbuf = (float*)fim_malloc(src->i.width * 3 * sizeof(float)); + if(!h->rowbuf) + goto oops; + h->srcrow = 0; + h->inleft = 1; + + *i = src->i; + i->width = args->width; + i->height = args->height; + i->dpi = args->dpi; + return h; + oops: + if(h) + fim_free(h); + return FIM_NULL; +} + +#define FIM_HAS_MISC_FBI_OPS 1 +#ifdef FIM_HAS_MISC_FBI_OPS +void op_resize_work_row_expand(struct ida_image *src, struct ida_rect *rect, fim_byte_t *dst, int line, void *data) +{ + struct op_resize_state *h = (struct op_resize_state *)data; +//#ifndef FIM_WANTS_SLOW_RESIZE /*uncommenting this triggers failure */ + int sr=h->srcrow;if(sr<0)sr=-sr;//who knows +//#endif /* FIM_WANTS_SLOW_RESIZE */ + fim_byte_t* srcline=src->data+src->i.width*3*(sr); + const int Mdx=h->width; + register int sx=0,dx; + + /* + * this gives a ~ 50% gain + * */ + float d0f=0.0,d1f=0.0; + int d0i=0,d1i=0; + + dx=0; + if(src->i.width) for (sx=0;sx<(int)src->i.width-1;++sx ) + { + d1f+=h->xscale; + d1i=(unsigned int)d1f; + + sx*=3; + for (dx=d0i;dx<(int)d1i;++dx )//d1i < Mdx + { + dst[3*dx+0] = srcline[ sx ]; + dst[3*dx+1] = srcline[ sx+1]; + dst[3*dx+2] = srcline[ sx+2] ; + } + sx/=3; + + d0f=d1f; + d0i=(unsigned int)d0f; + } + { + // contour fix + sx*=3; + for (dx=d0i;dxheight-1)for (dx=0;dxdata+src->i.width*3*(sr); + const int Mdx=h->width; + register int sx,dx; + /* + * interleaved loop unrolling .. + * this gives a ~ 50% gain + * */ + float d0f=0.0,d1f=0.0; + int d0i=0,d1i=0; + dx=0; + sx=0; + if(src->i.width) + for ( ;sx<(int)src->i.width-1-4;sx+=4) + { + d1f+=h->xscale; + d1i=(unsigned int)d1f; + + sx*=3; + for (dx=d0i;dxxscale; + d1i=(unsigned int)d1f; + + sx+=3; + for (dx=d0i;dxxscale; + d1i=(unsigned int)d1f; + + sx+=3; + for (dx=d0i;dxxscale; + d1i=(unsigned int)d1f; + + sx+=3; + for (dx=d0i;dxi.width ;++sx) + { + d1f+=h->xscale; + d1i=(unsigned int)d1f; + // contour fix + for (dx=d0i;dxheight-1)for (dx=0;dxdata+src->i.width*3*(sr); + const int Mdx=h->width; + register int sx,dx; + + /* + * this gives a ~ 70% gain + * */ + float d0f=0.0,d1f=0.0; + int d0i=0,d1i=0; + + sx=0; + dx=0; + if(src->i.width) for ( ;sx<(int)src->i.width;++sx ) + { + d1f+=h->xscale; + d1i=(unsigned int)d1f; + + register fim_byte_t r,g,b; + r=srcline[ 3*sx+ 0]; + g=srcline[ 3*sx+ 1]; + b=srcline[ 3*sx+ 2]; + + for (dx=d0i;dxi.width-1; + for (dx=d0i;dxheight-1)for (dx=0;dxdata+src->i.width*3*(sr); + const int Mdx=h->width; + register int sx,dx; + + /* + * this gives a ~ 60% gain + * */ + float d0f=0.0,d1f=0.0; + int d0i=0,d1i=0; + + sx=0; + dx=0; + if(src->i.width) for ( ;sx<(int)src->i.width-1;++sx ) + { + d1f+=h->xscale; + d1i=(unsigned int)d1f; + + register fim_byte_t r,g,b; + r=srcline[ 3*sx+ 0]; + g=srcline[ 3*sx+ 1]; + b=srcline[ 3*sx+ 2]; + + for (dx=d0i;FIM_LIKELY(dxheight-1)for (dx=0;dxrowbuf; + +#ifndef FIM_WANTS_SLOW_RESIZE + int sr=h->srcrow; + if(sr<0) + sr=-sr;//who knows +#endif /* FIM_WANTS_SLOW_RESIZE */ + + /* scale y */ + fim_bzero(rowbuf, src->i.width * 3 * sizeof(float)); + outleft = 1/h->yscale; + while (outleft > 0 && h->srcrow < src->i.height) { + if (outleft < h->inleft) { + weight = outleft * h->yscale; + h->inleft -= outleft; + outleft = 0; + } else { + weight = h->inleft * h->yscale; + outleft -= h->inleft; + h->inleft = 0; + } +#if 0 + if (cc.displaydevice_->debug_) + FIM_FBI_PRINTF("y: %6.2f%%: %d/%d => %d/%d\n", + weight*100,h->srcrow,src->height,line,h->height); +#endif + csrcline = src->data + h->srcrow * src->i.width * 3; + for (i = 0; i < src->i.width * 3; i++) + rowbuf[i] += (float)csrcline[i] * weight; + if (0 == h->inleft) { + h->inleft = 1; + h->srcrow++; + } + } + +#ifndef FIM_WANTS_SLOW_RESIZE + /* + * a little tweaked resize : the following loop takes the most of cpu resources in a typical fim run! + */ + /* scale x */ + left = 1.0f; + fsrcline = h->rowbuf; + const float c_outleft = 1.0f/h->xscale; + // cout << "c_outleft : " << c_outleft << "\n"; + // cout << "h->width : " << (int)h->width << "\n"; + const unsigned int Mdx=h->width,msx=src->i.width; + if(h->xscale>1.0)//here we handle the case of magnification + { +#ifdef FIM_WANTS_SLOW_RESIZE + fim_byte_t*FIM_RSTRCT srcline=src->data+src->i.width*3*(sr); +#endif /* FIM_WANTS_SLOW_RESIZE */ + +#ifndef FIM_WANTS_SLOW_RESIZE + if(h->xscale>2.0) + { + if(h->xscale>4.0) + op_resize_work_unrolled4_row_expand( src, rect, dst, line, data, sr); + else + op_resize_work_unrolled2_row_expand( src, rect, dst, line, data, sr); + } + else + op_resize_work_row_expand_i_unrolled( src, rect, dst, line, data, sr); +// op_resize_work_row_expand( src, rect, dst, line, data); + +#else /* FIM_WANTS_SLOW_RESIZE */ + float fsx=0.0; + for (sx=0,dx=0; dxi.width;// % is essential + dst[0] = srcline[3*sx]; + dst[1] = srcline[3*sx+1]; + dst[2] = srcline[3*sx+2] ; + dst += 3; + #else + fsx+=c_outleft; + sx=((unsigned int)fsx)%src->i.width;// % is (maybe) essential + dst[0] = (fim_byte_t) fsrcline[3*sx]; + dst[1] = (fim_byte_t) fsrcline[3*sx+1]; + dst[2] = (fim_byte_t) fsrcline[3*sx+2] ; + dst += 3; + #endif + } +#endif /* FIM_WANTS_SLOW_RESIZE */ + } +#define ZEROF 0.0f + else // image minification + for (sx = 0, dx = 0; dx < Mdx; dx++) { + d0 = d1 = d2 = ZEROF; + outleft = c_outleft; + while (outleft > ZEROF && sx < msx) { + if (outleft < left) { + weight = outleft * h->xscale; + left -= outleft; + outleft = ZEROF; + } else { + weight = left * h->xscale; + outleft -= left; + left = ZEROF; + } + d0 += fsrcline[3*sx] * weight; + d1 += fsrcline[3*sx+1] * weight; + d2 += fsrcline[3*sx+2] * weight; + + if (ZEROF == left) { + left = 1.0f; + sx++; + } + } + dst[0] = (fim_byte_t)d0; + dst[1] = (fim_byte_t)d1; + dst[2] = (fim_byte_t)d2; + dst += 3; + } + return ; +#else + /* the original, slow cycle */ + /* scale x */ + left = 1; + fsrcline = h->rowbuf; + for (sx = 0, dx = 0; dx < h->width; dx++) { + d0 = d1 = d2 = 0; + outleft = 1/h->xscale; + while (outleft > 0 && dx < h->width && sx < src->i.width) { + if (outleft < left) { + weight = outleft * h->xscale; + left -= outleft; + outleft = 0; + } else { + weight = left * h->xscale; + outleft -= left; + left = 0; + } +#if 0 + if (cc.displaydevice_->debug_) + FIM_FBI_PRINTF(" x: %6.2f%%: %d/%d => %d/%d\n", + weight*100,sx,src->width,dx,h->width); +#endif + d0 += fsrcline[3*sx+0] * weight; + d1 += fsrcline[3*sx+1] * weight; + d2 += fsrcline[3*sx+2] * weight; + if (0 == left) { + left = 1; + sx++; + } + } + dst[0] = (fim_byte_t)d0; + dst[1] = (fim_byte_t)d1; + dst[2] = (fim_byte_t)d2; + dst += 3; + } +#endif /* FIM_WANTS_SLOW_RESIZE */ +} + +static void +op_resize_done(void *data) +{ + struct op_resize_state *h = (struct op_resize_state *)data; + + fim_free(h->rowbuf); + fim_free(h); +} + +/* ----------------------------------------------------------------------- */ + +struct op_rotate_state { + float angle,sina,cosa; + struct ida_rect calc; + int cx,cy; +}; + +static void* +op_rotate_init(const struct ida_image *src, struct ida_rect *rect, + struct ida_image_info *i, void *parm) +{ + struct op_rotate_parm *args = (struct op_rotate_parm *)parm; + struct op_rotate_state *h; + float diag; + + h = (struct op_rotate_state *)fim_malloc(sizeof(*h)); + if(!h)return FIM_NULL; + /* dez's : FIXME : FIM_NULL check missing */ + h->angle = args->angle * 2 * M_PI / 360; + h->sina = sin(h->angle); + h->cosa = cos(h->angle); + /* dez's : cX means source center's X */ + h->cx = (rect->x2 - rect->x1) / 2 + rect->x1; + h->cy = (rect->y2 - rect->y1) / 2 + rect->y1; + + /* the area we have to process (worst case: 45°) */ + diag = sqrt((rect->x2 - rect->x1)*(rect->x2 - rect->x1) + + (rect->y2 - rect->y1)*(rect->y2 - rect->y1))/2; + /* dez's : diag is a half diagonal */ + /* dez's : calc is the source input rectangle bounded + * by source image valid coordinates ... */ + h->calc.x1 = (int)(h->cx - diag); + h->calc.x2 = (int)(h->cx + diag); + h->calc.y1 = (int)(h->cy - diag); + h->calc.y2 = (int)(h->cy + diag); + if (h->calc.x1 < 0) + h->calc.x1 = 0; + if (h->calc.x2 > (int)src->i.width) + h->calc.x2 = (int)src->i.width; + if (h->calc.y1 < 0) + h->calc.y1 = 0; + if (h->calc.y2 > (int)src->i.height) + h->calc.y2 = (int)src->i.height; + + *i = src->i; + /* TODO : it would be nice to expand and contract + * the whole canvas just to fit the rotated image in ! + * */ + return h; +} + +static inline +fim_byte_t* op_rotate_getpixel(const struct ida_image *src, struct ida_rect *rect, + int sx, int sy, int dx, int dy) +{ + static fim_byte_t black[] = { 0, 0, 0}; +#if 0 + int xdiff = rect->x2 - rect->x1; + int ydiff = rect->y2 - rect->y1; +#endif + if (sx < rect->x1 || sx >= rect->x2 || + sy < rect->y1 || sy >= rect->y2) { +#if 0 + /* experimental : textured rotation (i.e.: with wrapping) */ + while(sx < rect->x1)sx+=xdiff; + while(sx >= rect->x2)sx-=xdiff; + while(sy < rect->y1)sy+=ydiff; + while(sy >= rect->y2)sy-=ydiff; + return src->data + sy * src->i.width * 3 + sx * 3; +#else + /* original */ + if (dx < rect->x1 || dx >= rect->x2 || + dy < rect->y1 || dy >= rect->y2) + /* dez's : FIXME : i can't understand what this code stands for ! */ + return src->data + dy * src->i.width * 3 + dx * 3; + return black; +#endif + } + return src->data + sy * src->i.width * 3 + sx * 3; +} + +static void +op_rotate_work(const struct ida_image *src, struct ida_rect *rect, + fim_byte_t *dst, int y, void *data) +{ + struct op_rotate_state *h = (struct op_rotate_state *) data; + fim_byte_t *pix; + float fx,fy,w; + int x,sx,sy; + + pix = src->data + y * src->i.width * 3; + /* + * useless (dez) + * memcpy(dst,pix,src->i.width * 3); + */ + if (y < h->calc.y1 || y >= h->calc.y2) + return; +/* + fx = h->cosa * (0 - h->cx) - h->sina * (y - h->cy) + h->cx; + sx = (int)fx; + sx *= 0; + dst += 3*(h->calc.x1+sx);*/ + fim_bzero(dst, (h->calc.x2-h->calc.x1) * 3); + for (x = h->calc.x1; x < h->calc.x2; x++, dst+=3) { + fx = h->cosa * (x - h->cx) - h->sina * (y - h->cy) + h->cx; + fy = h->sina * (x - h->cx) + h->cosa * (y - h->cy) + h->cy; + sx = (int)fx; + sy = (int)fy; + if (fx < 0) + sx--; + if (fy < 0) + sy--; + fx -= sx; + fy -= sy; + + pix = op_rotate_getpixel(src,rect,sx,sy,x,y); + w = (1-fx) * (1-fy); + dst[0] += (fim_byte_t)(pix[0] * w); + dst[1] += (fim_byte_t)(pix[1] * w); + dst[2] += (fim_byte_t)(pix[2] * w); + pix = op_rotate_getpixel(src,rect,sx+1,sy,x,y); + w = fx * (1-fy); + dst[0] += (fim_byte_t)(pix[0] * w); + dst[1] += (fim_byte_t)(pix[1] * w); + dst[2] += (fim_byte_t)(pix[2] * w); + pix = op_rotate_getpixel(src,rect,sx,sy+1,x,y); + w = (1-fx) * fy; + dst[0] += (fim_byte_t)(pix[0] * w); + dst[1] += (fim_byte_t)(pix[1] * w); + dst[2] += (fim_byte_t)(pix[2] * w); + pix = op_rotate_getpixel(src,rect,sx+1,sy+1,x,y); + w = fx * fy; + dst[0] += (fim_byte_t)(pix[0] * w); + dst[1] += (fim_byte_t)(pix[1] * w); + dst[2] += (fim_byte_t)(pix[2] * w); + } +} + +static void +op_rotate_done(void *data) +{ + struct op_rotate_state *h = (struct op_rotate_state *)data; + + fim_free(h); +} + +/* ----------------------------------------------------------------------- */ +void op_none_done(void *data) {} +static fim_byte_t op_none_data; +void* op_none_init(const struct ida_image *src, struct ida_rect *sel, + struct ida_image_info *i, void *parm) +{ + *i = src->i; + return &op_none_data; +} +/* ----------------------------------------------------------------------- */ + +struct ida_op desc_grayscale = { + /*name:*/ "grayscale", + /*init:*/ op_none_init, + /*work:*/ op_grayscale, + /*done:*/ op_none_done, +}; +struct ida_op desc_3x3 = { + /*name:*/ "3x3", + /*init:*/ op_3x3_init, + /*work:*/ op_3x3_work, + /*done:*/ op_3x3_free, +}; +struct ida_op desc_sharpe = { + /*name:*/ "sharpe", + /*init:*/ op_sharpe_init, + /*work:*/ op_sharpe_work, + /*done:*/ op_sharpe_free, +}; +struct ida_op desc_resize = { + /*name:*/ "resize", + /*init:*/ op_resize_init, + /*work:*/ op_resize_work, + /*done:*/ op_resize_done, +}; +struct ida_op desc_rotate = { + /*name:*/ "rotate", + /*init:*/ op_rotate_init, + /*work:*/ op_rotate_work, + /*done:*/ op_rotate_done, +}; + +// end filter.c +// + + + +// op.c + +#include +#include +#include + +/* ----------------------------------------------------------------------- */ +/* functions */ + +static fim_byte_t op_none_data_; + +static void +op_flip_vert_(const struct ida_image *src, struct ida_rect *rect, + fim_byte_t *dst, int line, void *data) +{ + fim_byte_t *scanline; + + scanline = (fim_byte_t*)src->data + (src->i.height - line - 1) * src->i.width * 3; + memcpy(dst,scanline,src->i.width*3); +} + +static void +op_flip_horz_(const struct ida_image *src, struct ida_rect *rect, + fim_byte_t *dst, int line, void *data) +{ + fim_byte_t *scanline; + unsigned int i; + + scanline = (fim_byte_t*)src->data + (line+1) * src->i.width * 3; + for (i = 0; i < src->i.width; i++) { + scanline -= 3; + dst[0] = scanline[0]; + dst[1] = scanline[1]; + dst[2] = scanline[2]; + dst += 3; + } +} + +static void* +op_rotate_init_(const struct ida_image *src, struct ida_rect *rect, + struct ida_image_info *i, void *parm) +{ + *i = src->i; + i->height = src->i.width; + i->width = src->i.height; + i->dpi = src->i.dpi; + return &op_none_data_; +} + +static void +op_rotate_cw_(const struct ida_image *src, struct ida_rect *rect, + fim_byte_t *dst, int line, void *data) +{ + fim_byte_t *pix; + unsigned int i; + + pix = (fim_byte_t*) src->data + src->i.width * src->i.height * 3 + line * 3; + for (i = 0; i < src->i.height; i++) { + pix -= src->i.width * 3; + dst[0] = pix[0]; + dst[1] = pix[1]; + dst[2] = pix[2]; + dst += 3; + } +} + +static void +op_rotate_ccw_(const struct ida_image *src, struct ida_rect *rect, + fim_byte_t *dst, int line, void *data) +{ + fim_byte_t *pix; + unsigned int i; + + pix = (fim_byte_t*) src->data + (src->i.width-line-1) * 3; + for (i = 0; i < src->i.height; i++) { + dst[0] = pix[0]; + dst[1] = pix[1]; + dst[2] = pix[2]; + pix += src->i.width * 3; + dst += 3; + } +} + +static void +op_invert_(const struct ida_image *src, struct ida_rect *rect, + fim_byte_t *dst, int line, void *data) +{ + fim_byte_t *scanline; + int i; + + scanline = src->data + line * src->i.width * 3; + memcpy(dst,scanline,src->i.width * 3); + if (line < rect->y1 || line >= rect->y2) + return; + dst += 3*rect->x1; + scanline += 3*rect->x1; + for (i = rect->x1; i < rect->x2; i++) { + dst[0] = 255-scanline[0]; + dst[1] = 255-scanline[1]; + dst[2] = 255-scanline[2]; + scanline += 3; + dst += 3; + } +} + +static void* +op_crop_init_(const struct ida_image *src, struct ida_rect *rect, + struct ida_image_info *i, void *parm) +{ + if (rect->x2 - rect->x1 == (int)src->i.width && + rect->y2 - rect->y1 == (int)src->i.height) + return FIM_NULL; + *i = src->i; + i->width = rect->x2 - rect->x1; + i->height = rect->y2 - rect->y1; + return &op_none_data_; +} + +static void +op_crop_work_(const struct ida_image *src, struct ida_rect *rect, + fim_byte_t *dst, int line, void *data) +{ + fim_byte_t *scanline; + int i; + + scanline = src->data + (line+rect->y1) * src->i.width * 3 + rect->x1 * 3; + for (i = rect->x1; i < rect->x2; i++) { + dst[0] = scanline[0]; + dst[1] = scanline[1]; + dst[2] = scanline[2]; + scanline += 3; + dst += 3; + } +} + +static void* +op_autocrop_init_(const struct ida_image *src, struct ida_rect *unused, + struct ida_image_info *i, void *parm) +{ +#ifdef FIM_USE_DESIGNATED_INITIALIZERS + static struct op_3x3_parm filter = { + /*f1:*/ { -1, -1, -1 }, + /*f2:*/ { -1, 8, -1 }, + /*f3:*/ { -1, -1, -1 }, + }; +#else + /* I have no quick fix for this ! (m.m.) + * However, designated initializers are a a C99 construct + * and are usually tolerated by g++. + * */ + static struct op_3x3_parm filter = { + /*f1:*/ { -1, -1, -1 }, + /*f2:*/ { -1, 8, -1 }, + /*f3:*/ { -1, -1, -1 }, + }; +#endif /* FIM_USE_DESIGNATED_INITIALIZERS */ + struct ida_rect rect; + struct ida_image img; + int x,y,limit; + fim_byte_t *line; + void *data; + + /* detect edges */ + rect.x1 = 0; + rect.x2 = src->i.width; + rect.y1 = 0; + rect.y2 = src->i.height; + data = desc_3x3.init(src, &rect, &img.i, &filter); + + img.data = (fim_byte_t*)fim_pm_alloc(img.i.width, img.i.height); + if(!img.data)return FIM_NULL; + + for (y = 0; y < (int)img.i.height; y++) + desc_3x3.work(src, &rect, img.data+3*img.i.width*y, y, data); + desc_3x3.done(data); + limit = 64; + + /* y border */ + for (y = 0; y < (int)img.i.height; y++) { + line = img.data + img.i.width*y*3; + for (x = 0; x < (int)img.i.width; x++) + if (line[3*x+0] > limit || + line[3*x+1] > limit || + line[3*x+2] > limit) + break; + if (x != (int)img.i.width) + break; + } + rect.y1 = y; + for (y = (int)img.i.height-1; y > rect.y1; y--) { + line = img.data + img.i.width*y*3; + for (x = 0; x < (int)img.i.width; x++) + if (line[3*x+0] > limit || + line[3*x+1] > limit || + line[3*x+2] > limit) + break; + if (x != (int)img.i.width) + break; + } + rect.y2 = y+1; + + /* x border */ + for (x = 0; x < (int)img.i.width; x++) { + for (y = 0; y < (int)img.i.height; y++) { + line = img.data + (img.i.width*y+x) * 3; + if (line[0] > limit || + line[1] > limit || + line[2] > limit) + break; + } + if (y != (int)img.i.height) + break; + } + rect.x1 = x; + for (x = (int)img.i.width-1; x > rect.x1; x--) { + for (y = 0; y < (int)img.i.height; y++) { + line = img.data + (img.i.width*y+x) * 3; + if (line[0] > limit || + line[1] > limit || + line[2] > limit) + break; + } + if (y != (int)img.i.height) + break; + } + rect.x2 = x+1; + + fim_free(img.data); +#if 0 /* Disabled 20151213 */ + if (cc.displaydevice_->debug_) + FIM_FBI_PRINTF("y: %d-%d/%d -- x: %d-%d/%d\n", + rect.y1, rect.y2, img.i.height, + rect.x1, rect.x2, img.i.width); +#endif + + if (0 == rect.x2 - rect.x1 || 0 == rect.y2 - rect.y1) + return FIM_NULL; + + *unused = rect; + *i = src->i; + i->width = rect.x2 - rect.x1; + i->height = rect.y2 - rect.y1; + return &op_none_data_; +} + +/* ----------------------------------------------------------------------- */ +void op_free_done(void *data) { fim_free(data); } + +/* ----------------------------------------------------------------------- */ + +struct ida_op desc_flip_vert = { + /*name:*/ "flip-vert", + /*init:*/ op_none_init, + /*work:*/ op_flip_vert_, + /*done:*/ op_none_done, +}; +struct ida_op desc_flip_horz = { + /*name:*/ "flip-horz", + /*init:*/ op_none_init, + /*work:*/ op_flip_horz_, + /*done:*/ op_none_done, +}; +struct ida_op desc_rotate_cw = { + /*name:*/ "rotate-cw", + /*init:*/ op_rotate_init_, + /*work:*/ op_rotate_cw_, + /*done:*/ op_none_done, +}; +struct ida_op desc_rotate_ccw = { + /*name:*/ "rotate-ccw", + /*init:*/ op_rotate_init_, + /*work:*/ op_rotate_ccw_, + /*done:*/ op_none_done, +}; +struct ida_op desc_invert = { + /*name:*/ "invert", + /*init:*/ op_none_init, + /*work:*/ op_invert_, + /*done:*/ op_none_done, +}; +struct ida_op desc_crop = { + /*name:*/ "crop", + /*init:*/ op_crop_init_, + /*work:*/ op_crop_work_, + /*done:*/ op_none_done, +}; +struct ida_op desc_autocrop = { + /*name:*/ "autocrop", + /*init:*/ op_autocrop_init_, + /*work:*/ op_crop_work_, + /*done:*/ op_none_done, +}; + +// end op.c + + + + + + + +#include +#include +#include +#include + +#ifdef USE_X11 +# include "viewer.h" +#endif /* USE_X11 */ + +/* ---------------------------------------------------------------------- */ +/* load */ + + +#ifdef HAVE_LIBGRAPHICSMAGICK + extern struct ida_loader magick_loader ; +#endif /* HAVE_LIBGRAPHICSMAGICK */ + +#ifdef FIM_WITH_LIBPNG + extern struct ida_loader png_loader ; +#endif /* FIM_WITH_LIBPNG */ + +extern struct ida_loader ppm_loader ; +extern struct ida_loader pgm_loader ; +#if FIM_WANT_TEXT_RENDERING +extern struct ida_loader text_loader ; +#endif /* FIM_WANT_TEXT_RENDERING */ +#if FIM_WANT_RAW_BITS_RENDERING +extern struct ida_loader bit24_loader ; +extern struct ida_loader bit1_loader ; +#endif /* FIM_WANT_RAW_BITS_RENDERING */ +#if FIM_WITH_UFRAW +extern struct ida_loader nef_loader ; +#endif /* FIM_WITH_UFRAW */ + +// 20080108 WARNING +// 20080801 removed the loader functions from this file, as init_rd was not __init : did I break something ? +//static void __init init_rd(void) +/*static void init_rd(void) +{ + fim_load_register(&ppm_loader); + fim_load_register(&pgm_loader); +}*/ + +#ifdef USE_X11 +/* ---------------------------------------------------------------------- */ +/* save */ + +static int +ppm_write(FILE *fp, struct ida_image *img) +{ + fprintf(fp,"P6\n" + "# written by ida " VERSION "\n" + "# http://bytesex.org/ida/\n" + "%d %d\n255\n", + img->i.width,img->i.height); + fwrite(img->data, img->i.height, 3*img->i.width, fp); + return 0; +} + +static struct ida_writer ppm_writer = { + /* label:*/ "PPM", + /* ext:*/ { "ppm", FIM_NULL}, + /* write:*/ ppm_write, + /* FIXME : still missing some struct members */ +}; + +// 20080108 WARNING +//static void __init init_wr(void) +static void init_wr(void) +{ + fim_write_register(&ppm_writer); +} +#endif /* USE_X11 */ + + + + +/*static void free_image(struct ida_image *img)*/ +void FbiStuff::free_image(struct ida_image *img) +{ + if (img) { + if (img->data) + fim_free(img->data); + fim_free(img); + } +} + +FILE* FbiStuff::fim_execlp(const fim_char_t *cmd, ...) +{ + /* new */ + va_list ap; + int rc; + FILE *fp=FIM_NULL; + int p[2]; + #define FIM_SUBPROCESS_MAXARGV 128 + fim_char_t * argv[FIM_SUBPROCESS_MAXARGV],*s; /* FIXME */ + int argc=0; + if(0!=pipe(p)) + goto err; + + switch(pid_t pid = fork()) + { + case -1: + fim_perror("fork"); + close(p[0]); + close(p[1]); + goto err; // FIXME + case 0:/* child */ + dup2(p[1],1/*stdout*/); + close(p[0]); + close(p[1]); + va_start(ap,cmd); + while(FIM_NULL!=(s=va_arg(ap,fim_char_t*)) && argcbl) + { + goto err; + } + + if(base_offset) + { + if(fim_fseek(fp,base_offset,SEEK_SET)!=0) + goto err; + goff=base_offset; + } + else + goff+=ftell(fp); + + while((rb=fim_fread(buf+boff,1,bl-boff,fp))>0) + { + if(memmem(buf,rb+boff,byte_stream,sl)) + return goff+(((fim_char_t*)memmem(buf,rb+boff,byte_stream,sl))-buf); + if(rb+boffdebug_) + FIM_FBI_PRINTF("open %s: %s\n",filename,strerror(errno)); + return FIM_NULL; + } + } else fp=fd; + +#if FIM_WITH_ARCHIVE + if( regexp_match(filename,re.c_str(),1) ) + { + struct archive *a = FIM_NULL; + struct archive_entry *entry = FIM_NULL; + int r,pi; + size_t bs = 10240; + re = cc.getGlobalStringVariable(FIM_VID_PUSHDIR_RE); + + if( re == FIM_CNS_EMPTY_STRING ) + re = FIM_CNS_PUSHDIR_RE; + + if( fim_getenv("PAGE") ) + page = fim_atoi( fim_getenv("PAGE") ); + + a = archive_read_new(); + if (a == FIM_NULL) + goto noa; + archive_read_support_format_all(a); + archive_read_support_filter_all(a); + r = archive_read_open_filename(a, filename, bs); // filename=FIM_NULL for stdin + if (r != ARCHIVE_OK) + { + printf("Problems opening archive %s\n",filename); + goto noa; + } + + for (pi=0;;) + { + const char * pn = FIM_NULL; + r = archive_read_next_header(a, &entry); + if (r == ARCHIVE_EOF) + { + npages = pi ; + if(vl) + printf("ARCHIVE_EOF reached after %d files.\n",(int)npages); + break; + } + if (r != ARCHIVE_OK) + { + printf("Problems reading header of %s\n",filename); + break; + } + pn = archive_entry_pathname(entry); + + if( pn && regexp_match(pn,re.c_str(),1) && strlen(pn)>0 && pn[strlen(pn)-1] != FIM_CNS_DIRSEP_CHAR ) /* skip directories */ + { + //std::cout << re << " " << pi << " " << pn << " " << page << ".\n"; // FIXME + if(pi == page) + { + static int fap[2]; + if(vl) + printf("Opening page %d of %s, subfile %s\n",(int)page,filename,pn); + //archive_read_data_into_fd(a,1); + if(0) + { + const void *buff = FIM_NULL; + int64_t offset = 0; + size_t tsize = 0, size = 0; + + if( 0 != pipe2(fap,O_NONBLOCK) ) + //if( 0 != pipe(fap) ) + goto noa; + printf("Pipe to %s\n",pn); + + tsize = 0, size = 0; + for (;;) { + r = archive_read_data_block(a, &buff, &size, &offset); + if (r == ARCHIVE_EOF) + break; + if (r != ARCHIVE_OK) + break; + write(fap[1],buff,size); + tsize += size; + // ... + } + printf("piped %zd bytes\n",(size_t)tsize); + close(fap[1]); + fp = fdopen(fap[0],"r"); + fd = FIM_NULL; + fp = fim_fread_tmpfile(fp); // FIXME: a pipe saturates quickly (at 64 k on recent Linux...) + close(fap[0]); + } + else + { + FILE *tfd=FIM_NULL; + if( ( tfd=tmpfile() )!=FIM_NULL ) + { + int tfp = fileno(tfd); + r = archive_read_data_into_fd(a,tfp); + rewind(tfd); + fd = FIM_NULL; + fp = tfd; + } + else + { + std::cout << "Problem opening embedded file!\n"; // FIXME + archive_read_data_skip(a); + } + } + filename = FIM_STDIN_IMAGE_NAME; + } + else + { + //archive_read_data_skip(a); + if(vl)printf("SKIPPING MATCHING [%d/%d] %s in %s\n",(int)pi,(int)page,pn,filename); + } + ++pi; + } + else + { + if(vl)printf("SKIPPING NON MATCHING [%d/%d] %s in %s\n",(int)pi,(int)page,pn,filename); + //archive_read_data_skip(a); + } + } +ena: + archive_read_close(a); + archive_read_free(a); +noa: 1; + } +#endif /* FIM_WITH_ARCHIVE */ + //size_t read_offset=cc.getIntVariable("g:" FIM_VID_OPEN_OFFSET); + read_offset=cc.getIntVariable(FIM_VID_OPEN_OFFSET);/* warning : user could supply negative values */ + read_offset_u = read_offset + cc.getIntVariable(FIM_VID_OPEN_OFFSET_RETRY);/* warning : this can lead to negative values */ + read_offset_u = FIM_MAX(read_offset,read_offset_u); +with_offset: + if(read_offset>0) + fim_fseek(fp,read_offset,SEEK_SET); +#ifdef FIM_WANT_SEEK_MAGIC + /* FIXME : EXPERIMENTAL */ + string sm; + sm = cc.getStringVariable(FIM_VID_SEEK_MAGIC); + /* + the user should be able to specify a magic string like: + sm="\xFF\xD8\xFF\xE0"; + */ + if(sm!=FIM_CNS_EMPTY_STRING) + { + int sl = strlen(sm.c_str()); + if(vl>0)FIM_VERB_PRINTF("probing file signature (long %d) \"%s\"..\n",sl,sm.c_str()); + read_offset = find_byte_stream(fp, sm.c_str(), read_offset); + if(read_offset>0) + { + read_offset_u=read_offset+sl; + if(vl>0)FIM_VERB_PRINTF("..found at %lld:%lld\n",(long long int)read_offset,(long long int)read_offset_u); + fim_fseek(fp,read_offset,SEEK_SET); + cc.setVariable(FIM_VID_SEEK_MAGIC,""); + } + } +#endif /* FIM_WANT_SEEK_MAGIC */ + fim_bzero(blk,sizeof(blk)); + if((fr=fim_fread(blk,1,sizeof(blk),fp))<0) + { + /* should we care about the error code ? */ + return FIM_NULL; /* new */ + } + if(fr < sizeof(blk)) // FIXME: shall compare to min(sizeof(blk),filesize) + { + if(fr == 0) + { + std::cout << "Reading an empty file ?\n"; + // FIXME: need to handle this case. + //goto ret; + } + else + { + // std::cout << "Read only " << fr << " bytes for block probing!\n"; + // FIXME: tolerating and going further, for now (it might be a tiny file). + // goto ret; + } + } + fim_rewind(fp); + if(read_offset>0) + fim_fseek(fp,read_offset,SEEK_SET); + +#if FIM_WITH_UFRAW + if (FIM_NULL == loader && filename && is_file_nonempty(filename) ) /* FIXME: this is a hack */ + if(regexp_match(filename,".*NEF$") || regexp_match(filename,".*nef$")) + { + loader = &nef_loader; + goto found_a_loader; + } +#endif /* FIM_WITH_UFRAW */ + +#if FIM_ALLOW_LOADER_STRING_SPECIFICATION + { + fim::string ls=cc.getStringVariable(FIM_VID_FILE_LOADER); + want_retry=(cc.getIntVariable(FIM_VID_RETRY_LOADER_PROBE)); + if(ls!=FIM_CNS_EMPTY_STRING) + if(FIM_NULL==loader)/* we could have forced one */ + { + if(vl)FIM_VERB_PRINTF("using user specified loader string: %s\n",ls.c_str()); + list_for_each(item,&loaders) { + loader = list_entry(item, struct ida_loader, list); + if(vl)FIM_VERB_PRINTF("loader %s\n",loader->name); + if (!strcmp(loader->name,ls.c_str())) + goto found_a_loader; + } + if(vl)FIM_VERB_PRINTF("user specified loader string: %s is invalid!\n",ls.c_str()); + } + loader = FIM_NULL; + } +#endif /* FIM_ALLOW_LOADER_STRING_SPECIFICATION */ + +#if FIM_WANT_TEXT_RENDERING + { + fim_int bd=cc.getIntVariable(FIM_VID_TEXT_DISPLAY); + if(bd==1) + { + loader = &text_loader; + goto found_a_loader; + } + } +#endif +#if FIM_WANT_RAW_BITS_RENDERING + { + fim_int bd=cc.getIntVariable(FIM_VID_BINARY_DISPLAY); + if(bd!=0) + { + if(bd==1) + loader = &bit1_loader; + else + { + if(bd==24) + loader = &bit24_loader; + else + ;// FIXME: need some error reporting + } + } + } +#endif /* FIM_WANT_RAW_BITS_RENDERING */ +probe_loader: + /* pick loader */ +#ifdef FIM_SKIP_KNOWN_FILETYPES + if (FIM_NULL == loader && (*blk==0x42) && (*(fim_byte_t*)(blk+1)==0x5a)) + { + cc.set_status_bar("skipping 'bz2'...", "*"); + goto shall_skip_header; + } +/* gz is another ! */ +/* if (FIM_NULL == loader && (*blk==0x30) && (*(fim_byte_t*)(blk+1)==0x30)) + { + cc.set_status_bar("skipping 'gz'...", "*"); + return FIM_NULL; + }*/ +#ifndef HAVE_LIBPOPPLER + if (FIM_NULL == loader && (*blk==0x25) && (*(fim_byte_t*)(blk+1)==0x50 ) + && FIM_NULL == loader && (*(fim_byte_t*)(blk+2)==0x44) && (*(fim_byte_t*)(blk+3)==0x46)) + { + cc.set_status_bar("skipping 'pdf' (use fimgs for this)...", "*"); + goto shall_skip_header; + } +#endif /* HAVE_LIBPOPPLER */ +#ifndef HAVE_LIBSPECTRE + if (FIM_NULL == loader && (*blk==0x25) && (*(fim_byte_t*)(blk+1)==0x21 ) + && FIM_NULL == loader && (*(fim_byte_t*)(blk+2)==0x50) && (*(fim_byte_t*)(blk+3)==0x53)) + { + cc.set_status_bar("skipping 'ps' (use fimgs for this)...", "*"); + goto shall_skip_header; + } +#endif /* HAVE_LIBSPECTRE */ +#endif /* FIM_SKIP_KNOWN_FILETYPES */ + /* TODO: should sort loaders by mlen, descendingly */ + if(FIM_NULL==loader)/* we could have forced one */ + list_for_each(item,&loaders) + { + loader = list_entry(item, struct ida_loader, list); + if(loader->mlen < 1) + continue; + if (FIM_NULL == loader->magic) + break; + if (0 == memcmp(blk+loader->moff,loader->magic,loader->mlen)) + break; + loader = FIM_NULL; + } + if(loader!=FIM_NULL) + { + if(vl)FIM_VERB_PRINTF("found loader %s by magic number\n",loader->name); + goto found_a_loader; + } + +#if !FIM_HAVE_FULL_PROBING_LOADER +#ifdef HAVE_LIBGRAPHICSMAGICK + /* FIXME: with this scheme, this is the only 0-mlen loader allowed */ + if (FIM_NULL == loader +#if 1 + && filename && is_file_nonempty(filename) /* FIXME: need an appropriate error/warning printout in this case */ +#endif /* */ + ) + loader = &magick_loader; + else + ; +#endif /* HAVE_LIBGRAPHICSMAGICK */ +#else /* FIM_HAVE_FULL_PROBING_LOADER */ + /* Incomplete: the problem is related to the descriptor: after the first probe, + * the file descriptor may not be available anymore, in case of standard input, + * unless some more advanced solution is found. + * */ + if(FIM_NULL==loader) + if(rozlsl) + list_for_each(item,&loaders) + { + loader = list_entry(item, struct ida_loader, list); + if(loader->mlen > 0) + continue; + loader = FIM_NULL; + } +#endif /* FIM_HAVE_FULL_PROBING_LOADER */ + + if((loader==FIM_NULL) && (cc.getIntVariable(FIM_VID_NO_EXTERNAL_LOADERS)==1)) + goto head_not_found; + if( (loader==FIM_NULL) && read_offset > 0 ) + { + if(vl>1)FIM_VERB_PRINTF("skipping external loading programs ..\n"); + goto head_not_found; + } + if( (loader==FIM_NULL) && read_offset > 0 ) + { + if(vl>1)FIM_VERB_PRINTF("skipping external loading programs ..\n"); + goto head_not_found; + } + +#ifdef FIM_WITH_LIBPNG +#ifdef FIM_TRY_DIA + if (FIM_NULL == loader && (*blk==0x1f) && (*(fim_byte_t*)(blk+1)==0x8b))// i am not sure if this is the FULL signature! + { + cc.set_status_bar(FIM_MSG_WAIT_PIPING" '" FIM_EPR_DIA "'...", "*"); + /* + * dez's + * */ + /* a gimp xcf file was found, and we try to use xcftopnm */ + cc.set_status_bar(FIM_MSG_WAIT_PIPING" '" FIM_EPR_DIA "'...", "*"); + if(FIM_NULL!=(fp=fim_execlp(FIM_EPR_DIA,FIM_EPR_DIA,filename,"-e",FIM_TMP_FILENAME ".png",FIM_NULL))&& 0==fim_fclose (fp)) + { + if (FIM_NULL == (fp = fim_fopen(FIM_TMP_FILENAME".png","r"))) + /* this could happen in case dia was removed from the system */ + goto shall_skip_header; + else + { + unlink(FIM_TMP_FILENAME".png"); + loader = &png_loader; + } + } + } +#endif /* FIM_TRY_DIA */ +#endif /* FIM_WITH_LIBPNG */ +#ifdef FIM_TRY_XFIG + if (FIM_NULL == loader && (0 == memcmp(blk,"#FIG",4))) + { + cc.set_status_bar(FIM_MSG_WAIT_PIPING" '" FIM_EPR_FIG2DEV "'...", "*"); + /* + * dez's + * */ + /* a xfig file was found, and we try to use fig2dev */ + if(FIM_NULL==(fp=fim_execlp(FIM_EPR_FIG2DEV,FIM_EPR_FIG2DEV,"-L","ppm",filename,FIM_NULL))) + goto shall_skip_header; + loader = &ppm_loader; + } +#endif /* FIM_TRY_XFIG */ +#ifdef FIM_TRY_XCFTOPNM + if (FIM_NULL == loader && (0 == memcmp(blk,"gimp xcf file",13))) + { + cc.set_status_bar(FIM_MSG_WAIT_PIPING" '" FIM_EPR_XCFTOPNM "'...", "*"); + /* + * dez's + * */ + /* a gimp xcf file was found, and we try to use xcftopnm */ + if(FIM_NULL==(fp=fim_execlp(FIM_EPR_XCFTOPNM,FIM_EPR_XCFTOPNM,filename,FIM_NULL))) + goto shall_skip_header; + loader = &ppm_loader; + } +#endif /* FIM_TRY_XCFTOPNM */ +//#if 0 +#ifdef FIM_TRY_INKSCAPE +#ifdef FIM_WITH_LIBPNG + if (FIM_NULL == loader && (0 == memcmp(blk,"name); + /* load image */ + img = (struct ida_image*)fim_calloc(1,sizeof(*img));/* calloc, not malloc: we want zeros */ + if(!img)goto errl; + +#ifdef FIM_EXPERIMENTAL_ROTATION + /* + * warning : there is a new field in ida_image_info (fim_extra_flags) + * which gets cleared to 0 (default) in this way. + * */ +#endif /* FIM_EXPERIMENTAL_ROTATION */ + // cc.set_status_bar("loading...", "*"); +#if FIM_EXPERIMENTAL_IMG_NMSPC + img->i.nsp = nsp; +#endif /* FIM_EXPERIMENTAL_IMG_NMSPC */ + data = loader->init(fp,filename,page,&img->i,0); +#ifdef FIM_READ_STDIN_IMAGE + if(strcmp(filename,FIM_STDIN_IMAGE_NAME)==0) { close(0); if(dup(2)){/* FIXME : should we report this ?*/}/* if the image is loaded from stdin, we close its stream */} +#endif /* FIM_READ_STDIN_IMAGE */ + if (FIM_NULL == data) { + if(vl)FIM_VERB_PRINTF("loader failed\n"); + if(cc.displaydevice_->debug_) + FIM_FBI_PRINTF("loading %s [%s] FAILED\n",filename,loader->name); + free_image(img); + img=FIM_NULL; + if(want_retry) + { + want_retry=0; + loader=FIM_NULL; + if(vl)FIM_VERB_PRINTF("retrying with probing..\n"); + goto probe_loader; + } + goto shall_skip_header; + } + img->data = (fim_byte_t*)fim_pm_alloc(img->i.width, img->i.height); + if(!img->data)goto errl; +#ifndef FIM_IS_SLOWER_THAN_FBI + for (y = 0; y < img->i.height; y++) { + loader->read(img->data + img->i.width * 3 * y, y, data); + } +#else /* FIM_IS_SLOWER_THAN_FBI */ + for (y = 0; y < img->i.height; y++) { + cc.displaydevice_->switch_if_needed(); + loader->read(img->data + img->i.width * 3 * y, y, data); + } +#endif /* FIM_IS_SLOWER_THAN_FBI */ + +#ifndef FIM_IS_SLOWER_THAN_FBI + /* + * this patch aligns the pixel bytes in the order they should + * be dumped to the video memory, resulting in much faster image + * drawing in fim than in fbi ! + * */ + rgb2bgr(img->data,img->i.width,y); +#endif /* FIM_IS_SLOWER_THAN_FBI */ + loader->done(data); +#if FIM_WITH_ARCHIVE + if(npages) + img->i.npages = npages; /* FIXME: temporarily here */ +#endif /* FIM_WITH_ARCHIVE */ +#if FIM_WANT_REMEMBER_LAST_FILE_LOADER + if(img && loader) + { + if(nsp) + nsp->setVariable(FIM_VID_FILE_LOADER,loader->name); + cc.setVariable(FIM_VID_LAST_FILE_LOADER,loader->name); + } +#endif /* FIM_WANT_REMEMBER_LAST_FILE_LOADER */ +#if FIM_WANT_EXPERIMENTAL_PLUGINS + if(img) + fim_post_read_plugins_exec(img,filename); +#endif /* FIM_WANT_EXPERIMENTAL_PLUGINS */ + goto ret; + +shall_skip_header: +head_not_found: /* no appropriate loader found for this image */ + img=FIM_NULL; + if( read_offset_u > read_offset ) + { + read_offset++; + if(vl)FIM_VERB_PRINTF("file seek range adjusted to: %lld:%lld\n",(long long int)read_offset,(long long int)read_offset_u); + goto with_offset; + } +errl: + if(img && img->data)fim_free(img->data); + if(img )fim_free(img); +#if FIM_SHALL_BUFFER_STDIN + if(sbuf)fim_free(sbuf); +#endif /* FIM_SHALL_BUFFER_STDIN */ +ret: + if( read_offset > 0 && nsp ) + nsp->setVariable(FIM_VID_OPEN_OFFSET,(fim_int)read_offset); /* FIXME */ + FIM_PR('.'); + return img; +} + +/*all dez's + * + * rotate the image 90 degrees (M_PI/2) at a time + * */ +struct ida_image* +FbiStuff::rotate_image90(struct ida_image *src, unsigned int rotation) +{ + /* 0: CCW, 1: CW */ + struct op_resize_parm p; + struct ida_rect rect; + struct ida_image *dest; + void *data; + unsigned int y; + struct ida_op *desc_p; + + dest =(ida_image*) fim_malloc(sizeof(*dest)); + /* dez: */ if(!dest)goto err; + fim_bzero(dest,sizeof(*dest)); + fim_bzero(&rect,sizeof(rect)); + fim_bzero(&p,sizeof(p)); + + p.width = src->i.width; + p.height = src->i.height; + p.dpi = src->i.dpi; + if (0 == p.width) + p.width = 1; + if (0 == p.height) + p.height = 1; + + rotation%=2; + if(rotation==0){desc_p=&desc_rotate_ccw;} + else {desc_p=&desc_rotate_cw ;} + + data = desc_p->init(src,&rect,&dest->i,&p); + dest->data = (fim_byte_t*)fim_pm_alloc(dest->i.width, dest->i.height); + /* dez: */ if(!(dest->data)){fim_free(dest);dest=FIM_NULL;goto err;} + for (y = 0; y < dest->i.height; y++) { + cc.displaydevice_->switch_if_needed(); + desc_p->work(src,&rect, + dest->data + 3 * dest->i.width * y, + y, data); + } + desc_p->done(data); +err: + return dest; +} + +struct ida_image* +FbiStuff::rotate_image(struct ida_image *src, float angle) +{ + /* + * dez's: + * this whole code was written for a fixed canvas rotation, + * not allowing any canvas adaptation at all ... urgh + * */ + struct op_rotate_parm p; + /* dez's 20080831 */ + struct ida_rect rect; + struct ida_image *dest; + void *data; + unsigned int y; + + dest = (ida_image*)fim_malloc(sizeof(*dest)); + /* dez: */ if(!dest)goto err; + fim_bzero(dest,sizeof(*dest)); + fim_bzero(&rect,sizeof(rect)); + fim_bzero(&p,sizeof(p)); + + /* source rectangle */ + rect.x1=0; + rect.x2=src->i.width; + rect.y1=0; + rect.y2=src->i.height; + +#ifdef FIM_EXPERIMENTAL_ROTATION + if(! src->i.fim_extra_flags) + { + /* + * this is code for a preliminary 'canvas' enlargement prior to image rotation. + * experimental code. + * + * WARNING : this code seems buggy! (it is a horrible hack) + * */ + int diagonal = (int) ceilf( sqrtf( (float)( src->i.width * src->i.width + src->i.height * src->i.height) ) + 1.0f ); + int n_extra = (diagonal - src->i.height )/2; + int s_extra = (diagonal - src->i.height - n_extra ); + int w_extra = (diagonal - src->i.width )/2; + int e_extra = (diagonal - src->i.width - w_extra ); + /* we allocate a new, larger canvas */ + fim_byte_t * larger_data = (fim_byte_t*)fim_calloc(diagonal * diagonal * 3,1); + if(larger_data) + { + for(y = n_extra; y < (unsigned int) diagonal - s_extra; ++y ) + memcpy(larger_data + (y * diagonal + w_extra )*3 , src->data + (y-n_extra) * src->i.width * 3 , src->i.width*3); + src->i.width = diagonal; + src->i.height = diagonal; + /* source rectangle fix */ + rect.x1+=w_extra; + rect.x2+=e_extra; + rect.y1+=n_extra; + rect.y2+=s_extra; + fim_free(src->data); + src->data=larger_data; + src->i.fim_extra_flags=1; /* to avoid this operation to repeat on square images or already rotated images */ + } + /* on allocation failure (e.g.: a very long and thin image) we cannot do more. + * uh, maybe we could tell the user about the allocation failure..*/ + else + cc.set_status_bar( "rescaling failed (insufficient memory?!)", "*"); + } +#endif /* FIM_EXPERIMENTAL_ROTATION */ + + p.angle = (int) angle; + data = desc_rotate.init(src,&rect,&dest->i,&p); + dest->data = (fim_byte_t*)fim_pm_alloc(dest->i.width, dest->i.height, true); + /* dez: */ if(!(dest->data)){fim_free(dest);dest=FIM_NULL;goto err;} + for (y = 0; y < dest->i.height; y++) { + cc.displaydevice_->switch_if_needed(); + desc_rotate.work(src,&rect, + dest->data + 3 * dest->i.width * y, + y, data); + } + + + desc_rotate.done(data); + + + //std::cout << "diagonal : " << diagonal << "\n"; + // std::cout << "src->i.width : " << src->i.width << "\n"; +err: + return dest; +} + + +#define FIM_OPTIMIZATION_20120129 1 + +struct ida_image* +FbiStuff::scale_image(const struct ida_image *src, /*const fim_mipmap_t *mmp,*/ float scale, float ascale +#if FIM_WANT_EXPERIMENTAL_MIPMAPS + , const fim_mipmap_t * mmp +#endif /* FIM_WANT_EXPERIMENTAL_MIPMAPS */ + ) +{ + struct op_resize_parm p; + struct ida_rect rect; + struct ida_image *dest=FIM_NULL; + void *data=FIM_NULL; + unsigned int y; +#if FIM_WANT_EXPERIMENTAL_MIPMAPS + int mmi=-1; + struct ida_image msrc; +#endif /* FIM_WANT_EXPERIMENTAL_MIPMAPS */ + /* dez: */ if(ascale<=0.0||ascale>=100.0) + ascale=1.0; + + dest = (ida_image*)fim_malloc(sizeof(*dest)); + /* dez: */ if(!dest) + goto err; + fim_bzero(dest,sizeof(*dest)); + fim_bzero(&rect,sizeof(rect)); + fim_bzero(&p,sizeof(p)); + +// p.width = (int)(src->i.width * scale * ascale); +// p.height = (int)(src->i.height * scale); + // ceil() : new + p.width = (int)ceilf((float)src->i.width * scale * ascale); + p.height = (int)ceilf((float)src->i.height * scale); + p.dpi = (int)(src->i.dpi); + if (0 == p.width) + p.width = 1; + if (0 == p.height) + p.height = 1; + +#if FIM_WANT_EXPERIMENTAL_MIPMAPS + if(mmp && ascale == 1.0 && scale < 1.0) + { + msrc=*src; + + for(mmi=0;mminmm && mmp->mmw[mmi]>=p.width && mmp->mmh[mmi]>=p.height ;++mmi) + { + msrc.i.width = mmp->mmw[mmi]; + msrc.i.height = mmp->mmh[mmi]; + msrc.data = mmp->mdp + mmp->mmoffs[mmi]; + } + if(mmi>0) + { + src=&msrc; + mmi--; + if(FIM_WVMM) std::cout << "for scale " << scale << std::endl; + if(FIM_WVMM) std::cout << "using mipmap " << mmi << " / " << mmp->nmm << std::endl; + if(FIM_WVMM) std::cout << mmp->mmw[mmi] << " x " << mmp->mmh[mmi] << "" << std::endl; + if(FIM_WVMM) std::cout << p.width << " x " << p.height << " -> " << std::endl; + } + else + { + if(FIM_WVMM) std::cout << "for scale " << scale << std::endl; + if(FIM_WVMM) std::cout << "not using mipmap " << std::endl; + } + } +#endif /* FIM_WANT_EXPERIMENTAL_MIPMAPS */ + + data = desc_resize.init(src,&rect,&dest->i,&p); + if(data==FIM_NULL) + { + fim_free(dest); + goto err; + } + dest->data = (fim_byte_t*)fim_pm_alloc(dest->i.width, dest->i.height); + if(!(dest->data)) + { + fim_free(data); + fim_free(dest); + goto err; + } + +#if FIM_WANT_EXPERIMENTAL_MIPMAPS + if(mmi>=0 && msrc.i.width == dest->i.width && msrc.i.height == dest->i.height ) + { + memcpy(dest->data,src->data,3 * dest->i.width * dest->i.height); /* a special case */ + goto done; + } +#endif /* FIM_WANT_EXPERIMENTAL_MIPMAPS */ + +#if FIM_OPTIMIZATION_20120129 + if(ascale==scale && ascale==1.0) + memcpy(dest->data,src->data,3 * dest->i.width * dest->i.height); /* a special case */ + else +#endif /* FIM_OPTIMIZATION_20120129 */ + for (y = 0; y < dest->i.height; y++) { + cc.displaydevice_->switch_if_needed(); + desc_resize.work(src,&rect, + dest->data + 3 * dest->i.width * y, + y, data); + } +done: + desc_resize.done(data); +err: + return dest; +} + +struct ida_image * fbi_image_clone(const struct ida_image *img) +{ + /* note that to fulfill free_image(), the descriptor and data couldn't be allocated together + * */ + struct ida_image *nimg=FIM_NULL; + + if(!img || !img->data) + goto err; + int n; + if(!(nimg=(ida_image*)fim_calloc(1,sizeof(struct ida_image)))) + goto err; + + memcpy(nimg,img,sizeof(struct ida_image)); + /*note .. no checks .. :P */ + n = img->i.width * img->i.height * 3; + + nimg->data = (fim_byte_t*)fim_malloc( n ); + if(!(nimg->data)) + { + fim_free(nimg); + nimg = FIM_NULL; + goto err; + } + memcpy(nimg->data, img->data,n); +err: + return nimg; +} + + int FbiStuff::fim_filereading_debug(void) + { + return cc.displaydevice_ ? + cc.displaydevice_->debug_: + 0; + } +} diff --git a/src/FbiStuff.h b/src/FbiStuff.h new file mode 100644 index 0000000..0509334 --- /dev/null +++ b/src/FbiStuff.h @@ -0,0 +1,109 @@ +/* $LastChangedDate: 2015-12-19 01:58:26 +0100 (Sat, 19 Dec 2015) $ */ +/* + FbiStuff.h : Misc fbi functionality routines, modified for fim + + (c) 2008-2015 Michele Martone + (c) 1998-2006 Gerd Knorr + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +/* + * This file comes from fbi, and will undergo severe reorganization. + * */ + +#ifndef FIM_FBI_STUFF_H +#define FIM_FBI_STUFF_H + +#include "fim.h" + +#include "FramebufferDevice.h" +#include "FbiStuffLoader.h" +#include "FontServer.h" + +#ifdef USE_X11 +# include +#endif /* USE_X11 */ +#include //FILE +#include //free() +#include //free() +#include //memset,strerror,.. + +// WARNING : THIS IS PURE REDUNDANCE ! +/* +struct list_head { + struct list_head *next, *prev; +};*/ + +extern struct list_head loaders; + + +namespace fim +{ + +class FbiStuff{ +public: +static void free_image(struct ida_image *img); +static FILE* fim_execlp(const fim_char_t *arg, ...);/* new */ +static struct ida_image* read_image(const fim_char_t *filename, FILE* fd, fim_int page=0, Namespace *nsp=FIM_NULL); +#if FIM_WANT_EXPERIMENTAL_MIPMAPS +static fim_err_t fim_mipmaps_compute(const struct ida_image *src, fim_mipmap_t * mmp); +#endif /* FIM_WANT_EXPERIMENTAL_MIPMAPS */ +static struct ida_image* rotate_image90(struct ida_image *src, unsigned int rotation); +static struct ida_image* rotate_image(struct ida_image *src, float angle); +static struct ida_image* scale_image(const struct ida_image *src, float scale, float ascale +#if FIM_WANT_EXPERIMENTAL_MIPMAPS + , const fim_mipmap_t * mmp=FIM_NULL +#endif /* FIM_WANT_EXPERIMENTAL_MIPMAPS */ + ); +static int fim_filereading_debug(void); +}; + +// filter.h + +struct op_3x3_parm { + int f1[3]; + int f2[3]; + int f3[3]; + int mul,div,add; +}; + +struct op_sharpe_parm { + int factor; +}; + +struct op_resize_parm { + int width; + int height; + int dpi; +}; + +struct op_rotate_parm { + int angle; +}; + + +//int new_image; +// end filter.h + +/* + * dez's function, on the way to windowing Fim! + * */ +struct ida_image * fbi_image_clone(const struct ida_image *img); + +} + +#endif /* FIM_FBI_STUFF_H */ + + diff --git a/src/FbiStuffBit1.cpp b/src/FbiStuffBit1.cpp new file mode 100644 index 0000000..a7219b5 --- /dev/null +++ b/src/FbiStuffBit1.cpp @@ -0,0 +1,162 @@ +/* $LastChangedDate: 2015-12-29 15:04:30 +0100 (Tue, 29 Dec 2015) $ */ +/* + FbiStuffBit1.cpp : fbi functions for reading ELF files as they were raw 1 bit per pixel pixelmaps + + (c) 2007-2015 Michele Martone + based on code (c) 1998-2006 Gerd Knorr + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +/* + * this is basically toy code, so enjoy! + * */ + + +#include "fim.h" + +#if FIM_WANT_RAW_BITS_RENDERING + +#include +#include +#include +#include +#ifdef HAVE_ENDIAN_H +# include +#endif /* HAVE_ENDIAN_H */ + +namespace fim +{ + +extern CommandConsole cc; + +/* ---------------------------------------------------------------------- */ + +typedef unsigned int uint32; +typedef unsigned short uint16; + +/* ---------------------------------------------------------------------- */ +/* load */ + +struct bit1_state { + FILE *fp; + uint32 w; + uint32 h; + long flen; /* for ftell() */ +}; + +static void* +bit1_init(FILE *fp, const fim_char_t *filename, unsigned int page, + struct ida_image_info *i, int thumbnail) +{ + struct bit1_state *h=FIM_NULL; + fim_int prw=cc.getIntVariable(FIM_VID_PREFERRED_RENDERING_WIDTH); + prw=prw<1?FIM_BITRENDERING_DEF_WIDTH:prw; + + h = (struct bit1_state *)fim_calloc(1,sizeof(*h)); + if(!h)goto oops; + h->fp = fp; + if(fseek(fp,0,SEEK_END)!=0) goto oops; + if((h->flen=ftell(fp))==-1)goto oops; + i->width = h->w = prw; // must be congruent to 8 + i->height = h->h = FIM_INT_FRAC(8*h->flen,h->w); // should pad + if(8*h->flen < h->w) + { + i->width = h->w = h->flen*8; + i->height = h->h = 1; + } + i->npages = 1; + return h; + oops: + if(h)fim_free(h); + return FIM_NULL; +} + +static void +bit1_read(fim_byte_t *dst, unsigned int line, void *data) +{ + struct bit1_state *h = (struct bit1_state *) data; + unsigned int ll,y,x = 0; + + y = line ; + if(y==h->h-1) + { + ll = h->flen - h->w * (h->h-1) / 8; + } + else + ll = h->w / 8; + + fseek(h->fp,0 + y * ll,SEEK_SET); + + for (x = 0; x < h->w; x+=8) + { + fim_byte_t c = fgetc(h->fp); + *(dst++) = (c & 1 << 0)?255:0; + *(dst++) = (c & 1 << 0)?255:0; + *(dst++) = (c & 1 << 0)?255:0; + *(dst++) = (c & 1 << 1)?255:0; + *(dst++) = (c & 1 << 1)?255:0; + *(dst++) = (c & 1 << 1)?255:0; + *(dst++) = (c & 1 << 2)?255:0; + *(dst++) = (c & 1 << 2)?255:0; + *(dst++) = (c & 1 << 2)?255:0; + *(dst++) = (c & 1 << 3)?255:0; + *(dst++) = (c & 1 << 3)?255:0; + *(dst++) = (c & 1 << 3)?255:0; + *(dst++) = (c & 1 << 4)?255:0; + *(dst++) = (c & 1 << 4)?255:0; + *(dst++) = (c & 1 << 4)?255:0; + *(dst++) = (c & 1 << 5)?255:0; + *(dst++) = (c & 1 << 5)?255:0; + *(dst++) = (c & 1 << 5)?255:0; + *(dst++) = (c & 1 << 6)?255:0; + *(dst++) = (c & 1 << 6)?255:0; + *(dst++) = (c & 1 << 6)?255:0; + *(dst++) = (c & 1 << 7)?255:0; + *(dst++) = (c & 1 << 7)?255:0; + *(dst++) = (c & 1 << 7)?255:0; + } +// if(y==h->h-1) fim_bzero(dst,h->w*8-8*x); +} + +static void +bit1_done(void *data) +{ + struct bit1_state *h = (struct bit1_state *) data; + + fclose(h->fp); + fim_free(h); +} + +struct ida_loader bit1_loader = { +/* + * 0000000: 7f45 4c46 0101 0100 0000 0000 0000 0000 .ELF............ + */ + /*magic:*/ "ELF", + /*moff:*/ 1, + /*mlen:*/ 3, + /*name:*/ "Bit1", + /*init:*/ bit1_init, + /*read:*/ bit1_read, + /*done:*/ bit1_done, +}; + +static void __init init_rd(void) +{ + fim_load_register(&bit1_loader); +} + + +} +#endif /* FIM_WANT_RAW_BITS_RENDERING */ diff --git a/src/FbiStuffBit24.cpp b/src/FbiStuffBit24.cpp new file mode 100644 index 0000000..08fe9c1 --- /dev/null +++ b/src/FbiStuffBit24.cpp @@ -0,0 +1,141 @@ +/* $LastChangedDate: 2015-12-29 15:04:30 +0100 (Tue, 29 Dec 2015) $ */ +/* + FbiStuffBit24.cpp : fbi functions for reading ELF files as they were raw 24 bit per pixel pixelmaps + + (c) 2007-2015 Michele Martone + based on code (c) 1998-2006 Gerd Knorr + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +/* + * this is basically toy code, so enjoy! + * */ + + +#include "fim.h" + +#if FIM_WANT_RAW_BITS_RENDERING + +#include +#include +#include +#include +#ifdef HAVE_ENDIAN_H +# include +#endif /* HAVE_ENDIAN_H */ + +namespace fim +{ + +extern CommandConsole cc; + +/* ---------------------------------------------------------------------- */ + +typedef unsigned int uint32; +typedef unsigned short uint16; + +/* ---------------------------------------------------------------------- */ +/* load */ + +struct bit24_state { + FILE *fp; + uint32 w; + uint32 h; + long flen; /* for ftell() */ +}; + +static void* +bit24_init(FILE *fp, const fim_char_t *filename, unsigned int page, + struct ida_image_info *i, int thumbnail) +{ + struct bit24_state *h=FIM_NULL; + fim_int prw=cc.getIntVariable(FIM_VID_PREFERRED_RENDERING_WIDTH); + prw=prw<1?FIM_BITRENDERING_DEF_WIDTH:prw; + + h = (struct bit24_state *)fim_calloc(1,sizeof(*h)); + if(!h) + goto oops; + h->fp = fp; + if(fseek(fp,0,SEEK_END)!=0) goto oops; + if((h->flen=ftell(fp))==-1)goto oops; + i->width = h->w = prw; + i->height = h->h = FIM_INT_FRAC(h->flen,h->w*3); // should pad + if(h->flen < h->w*3) + { + i->width = h->w = h->flen/3; + i->height = h->h = 1; + } + i->npages = 1; + return h; + oops: + if(h)fim_free(h); + return FIM_NULL; +} + +static void +bit24_read(fim_byte_t *dst, unsigned int line, void *data) +{ + struct bit24_state *h = (struct bit24_state *) data; + unsigned int ll,y,x = 0; + + y = line ; + if(y==h->h-1) + ll = h->flen - h->w*3 * (h->h-1); + else + { + ll = h->w * 3; + } + + fseek(h->fp,0 + y * ll,SEEK_SET); + + for (x = 0; x < h->w; x++) + { + *(dst++) = fgetc(h->fp); + *(dst++) = fgetc(h->fp); + *(dst++) = fgetc(h->fp); + } +// if(y==h->h-1) fim_bzero(dst,h->w*3-3*x); +} + +static void +bit24_done(void *data) +{ + struct bit24_state *h = (struct bit24_state *) data; + + fclose(h->fp); + fim_free(h); +} + +struct ida_loader bit24_loader = { +/* + * 0000000: 7f45 4c46 0101 0100 0000 0000 0000 0000 .ELF............ + */ + /*magic:*/ "ELF", + /*moff:*/ 1, + /*mlen:*/ 3, + /*name:*/ "Bit24", + /*init:*/ bit24_init, + /*read:*/ bit24_read, + /*done:*/ bit24_done, +}; + +static void __init init_rd(void) +{ + fim_load_register(&bit24_loader); +} + + +} +#endif /* FIM_WANT_RAW_BITS_RENDERING */ diff --git a/src/FbiStuffBmp.cpp b/src/FbiStuffBmp.cpp new file mode 100644 index 0000000..f061c66 --- /dev/null +++ b/src/FbiStuffBmp.cpp @@ -0,0 +1,260 @@ +/* $LastChangedDate: 2015-12-19 01:44:41 +0100 (Sat, 19 Dec 2015) $ */ +/* + FbiStuffBmp.cpp : fbi functions for BMP files, modified for fim + + (c) 2008-2015 Michele Martone + (c) 1998-2006 Gerd Knorr + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +/* + * This file comes from fbi, and will undergo severe reorganization. + * */ + +#include "fim.h" + +#if FIM_WITH_BMP + +#include +#include +#include +#include +#ifdef HAVE_ENDIAN_H +# include +#endif /* HAVE_ENDIAN_H */ + +//#include "loader.h" + +namespace fim +{ + + +/* ---------------------------------------------------------------------- */ + +typedef unsigned int uint32; +typedef unsigned short uint16; + +/* bitmap files are little endian */ +#if BYTE_ORDER == LITTLE_ENDIAN +# define le16_to_cpu(x) (x) +# define le32_to_cpu(x) (x) +#elif BYTE_ORDER == BIG_ENDIAN +# define le16_to_cpu(x) (((x>>8) & 0x00ff) |\ + ((x<<8) & 0xff00)) +# define le32_to_cpu(x) (((x>>24) & 0x000000ff) |\ + ((x>>8) & 0x0000ff00) |\ + ((x<<8) & 0x00ff0000) |\ + ((x<<24) & 0xff000000)) +#else /* BYTE_ORDER == LITTLE_ENDIAN */ +# error "Oops: unknown byte order" +#endif /* BYTE_ORDER == LITTLE_ENDIAN */ + +/* ---------------------------------------------------------------------- */ +/* load */ + +struct bmp_hdr { + uint32 foobar; + + uint32 size; /* == BitMapInfoHeader */ + uint32 width; + uint32 height; + uint16 planes; + uint16 bit_cnt; + fim_char_t compression[4]; + uint32 image_size; + uint32 xpels_meter; + uint32 ypels_meter; + uint32 num_colors; /* used colors */ + uint32 imp_colors; /* important colors */ + /* may be more for some codecs */ +}; + +struct bmp_cmap { + fim_byte_t blue; + fim_byte_t green; + fim_byte_t red; + fim_byte_t unused; +}; + +struct bmp_state { + struct bmp_hdr hdr; + struct bmp_cmap cmap[256]; + FILE *fp; +}; + +static void* +bmp_init(FILE *fp, const fim_char_t *filename, unsigned int page, + struct ida_image_info *i, int thumbnail) +{ + struct bmp_state *h; + int fr; + + h = (struct bmp_state *)fim_calloc(1,sizeof(*h)); + if(!h)goto oops; + + h->fp = fp; + + fim_fseek(fp,10,SEEK_SET); + fr=fim_fread(&h->hdr,sizeof(struct bmp_hdr),1,fp); + if(!fr)goto oops; + +#if BYTE_ORDER == BIG_ENDIAN + h->hdr.foobar = le32_to_cpu(h->hdr.foobar); + h->hdr.size = le32_to_cpu(h->hdr.size); + h->hdr.width = le32_to_cpu(h->hdr.width); + h->hdr.height = le32_to_cpu(h->hdr.height); + + h->hdr.planes = le16_to_cpu(h->hdr.planes); + h->hdr.bit_cnt = le16_to_cpu(h->hdr.bit_cnt); + + h->hdr.image_size = le32_to_cpu(h->hdr.image_size); + h->hdr.xpels_meter = le32_to_cpu(h->hdr.xpels_meter); + h->hdr.ypels_meter = le32_to_cpu(h->hdr.ypels_meter); + h->hdr.num_colors = le32_to_cpu(h->hdr.num_colors); + h->hdr.imp_colors = le32_to_cpu(h->hdr.imp_colors); +#endif /* BYTE_ORDER == BIG_ENDIAN */ + + if (FbiStuff::fim_filereading_debug()) + FIM_FBI_PRINTF("bmp: hdr=%d size=%dx%d planes=%d" + " bits=%d size=%d res=%dx%d colors=%d/%d | %d\n", + h->hdr.size,h->hdr.width,h->hdr.height, + h->hdr.planes,h->hdr.bit_cnt,h->hdr.image_size, + h->hdr.xpels_meter,h->hdr.ypels_meter, + h->hdr.num_colors,h->hdr.imp_colors,h->hdr.foobar); + if (h->hdr.bit_cnt != 1 && + h->hdr.bit_cnt != 4 && + h->hdr.bit_cnt != 8 && + h->hdr.bit_cnt != 24) { + if(FbiStuff::fim_filereading_debug()) + FIM_FBI_PRINTF("bmp: can't handle depth [%d]\n",h->hdr.bit_cnt); + goto oops; + } + if (h->hdr.compression[0] || h->hdr.compression[1] || + h->hdr.compression[2] || h->hdr.compression[3]) { + if(FbiStuff::fim_filereading_debug()) + FIM_FBI_PRINTF("bmp: can't handle compressed bitmaps [%c%c%c%c]\n", + h->hdr.compression[0], + h->hdr.compression[1], + h->hdr.compression[2], + h->hdr.compression[3]); + goto oops; + } + + if (0 == h->hdr.num_colors && h->hdr.bit_cnt <= 8) + h->hdr.num_colors = (1 << h->hdr.bit_cnt); + if (h->hdr.num_colors > 256) + h->hdr.num_colors = 256; + if (h->hdr.num_colors) { + fim_fseek(fp,14+h->hdr.size,SEEK_SET); + fr=fim_fread(&h->cmap,sizeof(struct bmp_cmap),h->hdr.num_colors,fp); + if(!fr)goto oops; + } + + i->width = h->hdr.width; + i->height = h->hdr.height; + if (h->hdr.xpels_meter) + i->dpi = res_m_to_inch(h->hdr.xpels_meter); + i->npages = 1; + return h; + + oops: + if(h)fim_free(h); + return FIM_NULL; +} + +static void +bmp_read(fim_byte_t *dst, unsigned int line, void *data) +{ + struct bmp_state *h = (struct bmp_state *) data; + unsigned int ll,y,x,pixel,byte = 0; + + ll = (((h->hdr.width * h->hdr.bit_cnt + 31) & ~0x1f) >> 3); + y = h->hdr.height - line - 1; + fim_fseek(h->fp,h->hdr.foobar + y * ll,SEEK_SET); + + switch (h->hdr.bit_cnt) { + case 1: + for (x = 0; x < h->hdr.width; x++) { + if (0 == (x & 0x07)) + byte = fim_fgetc(h->fp); + pixel = byte & (0x80 >> (x & 0x07)) ? 1 : 0; + *(dst++) = h->cmap[pixel].red; + *(dst++) = h->cmap[pixel].green; + *(dst++) = h->cmap[pixel].blue; + } + break; + case 4: + for (x = 0; x < h->hdr.width; x++) { + if (x & 1) { + pixel = byte & 0xf; + } else { + byte = fim_fgetc(h->fp); + pixel = byte >> 4; + } + *(dst++) = h->cmap[pixel].red; + *(dst++) = h->cmap[pixel].green; + *(dst++) = h->cmap[pixel].blue; + } + break; + case 8: + for (x = 0; x < h->hdr.width; x++) { + pixel = fim_fgetc(h->fp); + *(dst++) = h->cmap[pixel].red; + *(dst++) = h->cmap[pixel].green; + *(dst++) = h->cmap[pixel].blue; + } + break; + case 24: + for (x = 0; x < h->hdr.width; x++) { + dst[2] = fim_fgetc(h->fp); + dst[1] = fim_fgetc(h->fp); + dst[0] = fim_fgetc(h->fp); + dst += 3; + } + break; + default: + fim_memset(dst,128,h->hdr.width*3); + break; + } +} + +static void +bmp_done(void *data) +{ + struct bmp_state *h = (struct bmp_state *) data; + + fim_fclose(h->fp); + fim_free(h); +} + +static struct ida_loader bmp_loader = { + /*magic:*/ "BM", + /*moff:*/ 0, + /*mlen:*/ 2, + /*name:*/ "bmp", + /*init:*/ bmp_init, + /*read:*/ bmp_read, + /*done:*/ bmp_done, +}; + +static void __init init_rd(void) +{ + fim_load_register(&bmp_loader); +} + + +} +#endif /* FIM_WITH_BMP */ + diff --git a/src/FbiStuffDjvu.cpp b/src/FbiStuffDjvu.cpp new file mode 100644 index 0000000..d35401e --- /dev/null +++ b/src/FbiStuffDjvu.cpp @@ -0,0 +1,221 @@ +/* $LastChangedDate: 2015-12-19 01:44:41 +0100 (Sat, 19 Dec 2015) $ */ +/* + FbiStuffDjvu.cpp : fim functions for decoding DJVU files + + (c) 2008-2015 Michele Martone + based on code (c) 1998-2006 Gerd Knorr + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/* + * this code should be fairly correct, although unfinished + * */ + +#include +#include +#include + +#include "FbiStuff.h" +#include "FbiStuffLoader.h" + +#ifdef HAVE_LIBDJVU + +extern "C" +{ +#include +} + +/* */ + +namespace fim +{ +typedef char fim_libdjvu_char; +extern CommandConsole cc; +/* ---------------------------------------------------------------------- */ +/* load */ + +struct djvu_state_t { + DDJVUAPI ddjvu_context_t * dc; + DDJVUAPI ddjvu_document_t * dd; + ddjvu_page_t *dp; + ddjvu_page_rotation_t rotation; + ddjvu_rect_t rrect; + ddjvu_rect_t prect; + ddjvu_format_t * pf; + int row_stride; /* physical row width in output buffer */ + + fim_byte_t * first_row_dst; +}; + +/* ---------------------------------------------------------------------- */ +/* djvu loader */ + + /* straight out from the DJVU API doc : */ + void handle_ddjvu_messages(ddjvu_context_t *ctx, int wait) + { + const ddjvu_message_t *msg; + if (wait) + ddjvu_message_wait(ctx); + while ((msg = ddjvu_message_peek(ctx))) + { + switch(msg->m_any.tag) + { + case DDJVU_ERROR: /*....*/ ; break; + case DDJVU_INFO: /*....*/ ; break; + case DDJVU_NEWSTREAM: /*....*/ ; break; + // .... + default: break; + } + ddjvu_message_pop(ctx); + } + } + +static void* +djvu_init(FILE *fp, const fim_char_t *filename, unsigned int page, + struct ida_image_info *i, int thumbnail) +{ + struct djvu_state_t * ds=FIM_NULL; + // static unsigned int masks[4] = { 0xff0000, 0xff00, 0xff, 0xff000000 }; + fim_int prd=cc.getIntVariable(FIM_VID_PREFERRED_RENDERING_DPI); + prd=prd<1?FIM_RENDERING_DPI:prd; + + if(filename==std::string(FIM_STDIN_IMAGE_NAME)) + { + std::cerr<<"sorry, stdin multipage file reading is not supported\n"; + goto ret; + } /* a drivers' problem */ + + if(fp) fclose(fp); + + ds = (struct djvu_state_t*)fim_calloc(1,sizeof(struct djvu_state_t)); + if(!ds) return FIM_NULL; + ds->first_row_dst = FIM_NULL; + + ds->dc = ddjvu_context_create("fim"); + if(!ds->dc)goto err; + ds->dd = ddjvu_document_create_by_filename(ds->dc, filename, 0); + if(!ds->dd)goto err; + + handle_ddjvu_messages(ds->dc,0x1/*0x0*/); + i->npages = ddjvu_document_get_pagenum(ds->dd); + if(page>=i->npages || page<0)goto err; + ds->dp = ddjvu_page_create_by_pageno (ds->dd, page);/* pages, from 0 */ + if(!ds->dp) goto err; + while (!ddjvu_page_decoding_done (ds->dp)){1;/* we just kill time (FIXME : inefficient) */} + + ds->prect.w = ddjvu_page_get_width (ds->dp) ; + ds->prect.h = ddjvu_page_get_height (ds->dp) ; +#if 1 + ddjvu_pageinfo_t pi; + ddjvu_document_get_pageinfo(ds->dd,page,&pi); + ds->prect.w = ((fim_scale_t) (ds->prect.w))* (((fim_scale_t)prd)/((fim_scale_t)pi.dpi)); + ds->prect.h = ((fim_scale_t) (ds->prect.h))* (((fim_scale_t)prd)/((fim_scale_t)pi.dpi)); + pi.dpi=prd; +#endif + + if(ds->prect.w<1)goto err; + if(ds->prect.h<1)goto err; + + ds->rotation = DDJVU_ROTATE_0; + ddjvu_page_set_rotation (ds->dp, ds->rotation); + + ds->prect.x = 0; + ds->prect.y = 0; + + ds->rrect = ds->prect; + + ds->row_stride=ds->prect.w * 3; + + i->width = ds->prect.w; + i->height = ds->prect.h; + i->dpi = pi.dpi; + +// ds->pf = ddjvu_format_create (DDJVU_FORMAT_RGBMASK32, 4, masks); + ds->pf = ddjvu_format_create (DDJVU_FORMAT_RGB24, 0, 0); + ddjvu_format_set_row_order (ds->pf, 1); + if(!ds->pf) goto err; + + return ds; +err: + if(ds->dp)ddjvu_page_release(ds->dp); + if(ds->dd)ddjvu_document_release(ds->dd); + if(ds->dc)ddjvu_context_release(ds->dc); + if(ds->pf)ddjvu_format_release(ds->pf); +ret: + return FIM_NULL; +} + +static void +djvu_read(fim_byte_t *dst, unsigned int line, void *data) +{ + struct djvu_state_t *ds = (struct djvu_state_t*)data; + + if(!ds)return; + + if(ds->first_row_dst == FIM_NULL) + ds->first_row_dst = dst; + else return; + + int rs=ddjvu_page_render (ds->dp, DDJVU_RENDER_COLOR, + & (ds->prect), + & (ds->rrect), + ds->pf, + ds->row_stride, + (fim_libdjvu_char*)dst); + if(rs) + ;/* FIXME: missing error handling */ + return ; +} + +static void +djvu_done(void *data) +{ + struct djvu_state_t *ds = (struct djvu_state_t*)data; + + if(ds->dp)ddjvu_page_release(ds->dp); + if(ds->dd)ddjvu_document_release(ds->dd); + if(ds->dc)ddjvu_context_release(ds->dc); + if(ds->pf)ddjvu_format_release(ds->pf); + + fim_free(ds); +} + +/* +0000000: 4154 2654 464f 524d 0070 ca79 444a 564d AT&TFORM.p.yDJVM +0000010: 4449 524d 0000 1465 8102 b900 0014 7e00 DIRM...e......~. +*/ +static struct ida_loader djvu_loader = { + +/* magic: "DJV", + moff: 12, + mlen: 3,*/ + + /*magic:*/ "AT&TFORM",// FI/*XME :*/ are sure this is enough ? + /*moff:*/ 0, + /*mlen:*/ 8, + /*name:*/ "libdjvu", + /*init:*/ djvu_init, + /*read:*/ djvu_read, + /*done:*/ djvu_done, +}; + +static void __init init_rd(void) +{ + fim_load_register(&djvu_loader); +} + +} +#endif // ifdef HAVE_LIBDJVU diff --git a/src/FbiStuffFbtools.cpp b/src/FbiStuffFbtools.cpp new file mode 100644 index 0000000..d3ab67f --- /dev/null +++ b/src/FbiStuffFbtools.cpp @@ -0,0 +1,90 @@ +/* $LastChangedDate: 2013-07-04 21:56:00 +0200 (Thu, 04 Jul 2013) $ */ +/* + FbiStuffFbtools.cpp : fbi functions from fbtools.c, modified for fim + + (c) 2008-2013 Michele Martone + (c) 1998-2006 Gerd Knorr + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +/* + * This file comes from fbi, and will undergo severe reorganization. + * */ +#include +#include +#include +#include +#include +#include +#include // sigaction, ... +#include +#ifdef HAVE_SYS_USER_H +#include /* this should be a safer replacement */ +#endif /* HAVE_SYS_USER_H */ + +#include "FbiStuffFbtools.h" +#include "FramebufferDevice.h" + +namespace fim +{ + + + + +/* -------------------------------------------------------------------- */ +/* handle fatal errors */ + +//static jmp_buf fb_fatal_cleanup; /* old, broken */ +static sigjmp_buf fb_fatal_cleanup; /* posix */ + +static void +fb_catch_exit_signal(int signal) +{ + siglongjmp(fb_fatal_cleanup,signal); +} + +void fb_catch_exit_signals(void) +{ + struct sigaction act,old; + int termsig; + + fim_bzero(&act,sizeof(act)); + act.sa_handler = fb_catch_exit_signal; + sigemptyset(&act.sa_mask); + sigaction(SIGINT, &act,&old); + sigaction(SIGQUIT,&act,&old); + sigaction(SIGTERM,&act,&old); + + sigaction(SIGABRT,&act,&old); + sigaction(SIGTSTP,&act,&old); + + sigaction(SIGBUS, &act,&old); + sigaction(SIGILL, &act,&old); + sigaction(SIGSEGV,&act,&old); + + if (0 == (termsig = sigsetjmp(fb_fatal_cleanup,0))) + return; + + /* console cleanup should happen here */ + cc.cleanup(); +#ifdef HAVE_SYS_SIGLIST + FIM_FBI_PRINTF("Oops: %s\n",sys_siglist[termsig]); +#endif /* HAVE_SYS_SIGLIST */ + std::exit(FIM_PERR_OOPS); +} + + + +} diff --git a/src/FbiStuffFbtools.h b/src/FbiStuffFbtools.h new file mode 100644 index 0000000..af8e476 --- /dev/null +++ b/src/FbiStuffFbtools.h @@ -0,0 +1,42 @@ +/* $LastChangedDate: 2013-07-04 23:07:07 +0200 (Thu, 04 Jul 2013) $ */ +/* + FbiStuffFbtools.h : fbi functions from fbtools.c, modified for fim + + (c) 2008-2013 Michele Martone + (c) 1998-2006 Gerd Knorr + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +/* + * This file comes from fbi, and will undergo severe reorganization. + * */ + +#include "fim.h" +#include "FramebufferDevice.h" + +#ifndef FIM_FBISTUFFFBTOOLS_H +#define FIM_FBISTUFFFBTOOLS_H +namespace fim +{ + + +/* info about videomode - yes I know, quick & dirty... */ +/* init + cleanup */ +int fb_probe(void); +void fb_catch_exit_signals(void); +void svga_dither_palette(int r, int g, int b); + +} +#endif /* FIM_FBISTUFFFBTOOLS_H */ diff --git a/src/FbiStuffGif.cpp b/src/FbiStuffGif.cpp new file mode 100644 index 0000000..7e83af9 --- /dev/null +++ b/src/FbiStuffGif.cpp @@ -0,0 +1,314 @@ +/* $LastChangedDate: 2017-04-09 16:11:19 +0200 (Sun, 09 Apr 2017) $ */ +/* + FbiStuffGif.cpp : fbi functions for GIF files, modified for fim + + (c) 2008-2017 Michele Martone + (c) 1998-2006 Gerd Knorr + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +/* + * This file comes from fbi, and will undergo severe reorganization. + * */ + +#include +#include +#include +#include + +//#include "loader.h" +#include "FbiStuff.h" +#include "FbiStuffLoader.h" + +#if defined(GIFLIB_MAJOR) && (GIFLIB_MAJOR >= 5) +#define FIM_GIFLIB_STATE_HAS_ERRCODE 1 +#else +#define FIM_GIFLIB_STATE_HAS_ERRCODE 0 +#endif + +#if defined(GIFLIB_MAJOR) && ((GIFLIB_MAJOR> 4) || ((GIFLIB_MAJOR==4) && defined(GIFLIB_MINOR) && (GIFLIB_MINOR>=2))) +#define FIM_GIFLIB_RETIRED_PrintGifError 1 +#else +#define FIM_GIFLIB_RETIRED_PrintGifError 0 +#endif + +#if defined(GIFLIB_MAJOR) && ((GIFLIB_MAJOR> 5) || ((GIFLIB_MAJOR==5) && defined(GIFLIB_MINOR) && (GIFLIB_MINOR>=1))) +#define FIM_DGifCloseFile_ARG ,FIM_NULL +#else +#define FIM_DGifCloseFile_ARG +#endif + +namespace fim +{ +struct gif_state { + FILE *infile; + GifFileType *gif; + GifPixelType *row; + GifPixelType *il; + int w,h; + int ErrorCode; /* used by newer versions (e.g.: >= 5) of library */ +}; + +#if FIM_GIFLIB_RETIRED_PrintGifError +void +FimPrintGifError(struct gif_state * gs) { +#if defined(GIFLIB_MAJOR) && (GIFLIB_MAJOR==4) && defined(GIFLIB_MINOR) && (GIFLIB_MINOR>=2) + int ErrorCode = GifError();// introduced in 4.2, removed in 5.0 +#else + int ErrorCode = gs->gif->Error; +#endif + /* On the basis of giflib-5.0.5/util/qprintf.c suggestion, after retirement of PrintGifError */ + const char *Err = FIM_NULL; + + if(ErrorCode == 0) + return; + +#if ( defined(GIFLIB_MAJOR) && (GIFLIB_MAJOR >= 5) ) + Err = GifErrorString(ErrorCode);// Introduced in 4.2; argument from 5.0.0. +#else + Err = GifErrorString();// introduced in 4.2 +#endif + + if (Err != FIM_NULL) + fprintf(stderr, "GIF-LIB error: %s.\n", Err); + else + fprintf(stderr, "GIF-LIB undefined error %d.\n", ErrorCode); +} +#else + /* Version 4.2 retired the PrintGifError function. */ +#define FimPrintGifError(GS) PrintGifError +#endif /* FIM_GIFLIB_RETIRED_PrintGifError */ + +static GifRecordType +gif_fileread(struct gif_state *h) +{ + GifRecordType RecordType; + GifByteType *Extension = FIM_NULL; + int ExtCode = 0, rc = 0; + const fim_char_t *type = FIM_NULL; + + for (;;) { + if (GIF_ERROR == DGifGetRecordType(h->gif,&RecordType)) { + if (FbiStuff::fim_filereading_debug()) + FIM_FBI_PRINTF("gif: DGifGetRecordType failed\n"); + FimPrintGifError(h); + return (GifRecordType)-1; + } + switch (RecordType) { + case IMAGE_DESC_RECORD_TYPE: + if (FbiStuff::fim_filereading_debug()) + FIM_FBI_PRINTF("gif: IMAGE_DESC_RECORD_TYPE found\n"); + return RecordType; + case EXTENSION_RECORD_TYPE: + if (FbiStuff::fim_filereading_debug()) + FIM_FBI_PRINTF("gif: EXTENSION_RECORD_TYPE found\n"); + for (rc = DGifGetExtension(h->gif,&ExtCode,&Extension); + FIM_NULL != Extension; + rc = DGifGetExtensionNext(h->gif,&Extension)) { + if (rc == GIF_ERROR) { + if (FbiStuff::fim_filereading_debug()) + FIM_FBI_PRINTF("gif: DGifGetExtension failed\n"); + FimPrintGifError(h); + return (GifRecordType)-1; + } + if (FbiStuff::fim_filereading_debug()) { + switch (ExtCode) { + case COMMENT_EXT_FUNC_CODE: type="comment"; break; + case GRAPHICS_EXT_FUNC_CODE: type="graphics"; break; + case PLAINTEXT_EXT_FUNC_CODE: type="plaintext"; break; + case APPLICATION_EXT_FUNC_CODE: type="appl"; break; + default: type="???"; break; + } + FIM_FBI_PRINTF("gif: extcode=0x%x [%s]\n",ExtCode,type); + } + } + break; + case TERMINATE_RECORD_TYPE: + if (FbiStuff::fim_filereading_debug()) + FIM_FBI_PRINTF("gif: TERMINATE_RECORD_TYPE found\n"); + return RecordType; + default: + if (FbiStuff::fim_filereading_debug()) + FIM_FBI_PRINTF("gif: unknown record type [%d]\n",RecordType); + return (GifRecordType)-1; + } + } +} + +#if 0 +static void +gif_skipimage(struct gif_state *h) +{ + fim_byte_t *line; + int i; + + if (FbiStuff::fim_filereading_debug()) + FIM_FBI_PRINTF("gif: skipping image record ...\n"); + DGifGetImageDesc(h->gif); + line = fim_malloc(h->gif->SWidth); + for (i = 0; i < h->gif->SHeight; i++) + DGifGetLine(h->gif, line, h->gif->SWidth); + fim_free(line); +} +#endif + +static void* +gif_init(FILE *fp, const fim_char_t *filename, unsigned int page, + struct ida_image_info *info, int thumbnail) +{ + struct gif_state *h = FIM_NULL; + GifRecordType RecordType; + int i, image = 0; + + h = (gif_state*)fim_calloc(1,sizeof(*h)); + if(!h)goto oops; + + h->infile = fp; +#if FIM_GIFLIB_STATE_HAS_ERRCODE + h->gif = DGifOpenFileHandle(fileno(fp),&h->ErrorCode); /* TODO: shall make use of h->ErrorCode */ +#else + h->gif = DGifOpenFileHandle(fileno(fp)); +#endif + if(!h->gif)goto oops; /* opening gifs from stdin seems to cause DGifOpenFileHandle=FIM_NULL */ + h->row = (GifPixelType*)fim_malloc(h->gif->SWidth * sizeof(GifPixelType)); + if(!h->row)goto oops; + + while (0 == image) { + RecordType = gif_fileread(h); + switch (RecordType) { + case IMAGE_DESC_RECORD_TYPE: + if (GIF_ERROR == DGifGetImageDesc(h->gif)) { + if (FbiStuff::fim_filereading_debug()) + FIM_FBI_PRINTF("gif: DGifGetImageDesc failed\n"); + FimPrintGifError(h); + } + if (FIM_NULL == h->gif->SColorMap && + FIM_NULL == h->gif->Image.ColorMap) { + if (FbiStuff::fim_filereading_debug()) + FIM_FBI_PRINTF("gif: oops: no colormap found\n"); + goto oops; + } +#if 0 + info->width = h->w = h->gif->SWidth; + info->height = h->h = h->gif->SHeight; +#else + info->width = h->w = h->gif->Image.Width; + info->height = h->h = h->gif->Image.Height; +#endif + info->npages = 1; + image = 1; + if (FbiStuff::fim_filereading_debug()) + FIM_FBI_PRINTF("gif: reading image record ...\n"); + if (h->gif->Image.Interlace) { + if (FbiStuff::fim_filereading_debug()) + FIM_FBI_PRINTF("gif: interlaced\n"); + { + h->il = (GifPixelType*)fim_malloc(h->w * h->h * sizeof(GifPixelType)); + if(!h->il)goto oops; + } + for (i = 0; i < h->h; i += 8) + DGifGetLine(h->gif, h->il + h->w*i,h->w); + for (i = 4; i < h->gif->SHeight; i += 8) + DGifGetLine(h->gif, h->il + h->w*i,h->w); + for (i = 2; i < h->gif->SHeight; i += 4) + DGifGetLine(h->gif, h->il + h->w*i,h->w); + } + break; + case TERMINATE_RECORD_TYPE: + default: + goto oops; + } + } + if (0 == info->width || 0 == info->height) + goto oops; + + if (FbiStuff::fim_filereading_debug()) + FIM_FBI_PRINTF("gif: s=%dx%d i=%dx%d\n", + h->gif->SWidth,h->gif->SHeight, + h->gif->Image.Width,h->gif->Image.Height); + return h; + + oops: + if (FbiStuff::fim_filereading_debug()) + FIM_FBI_PRINTF("gif: fatal error, aborting\n"); + if(h->gif) + { + DGifCloseFile(h->gif FIM_DGifCloseFile_ARG); + fim_free(h->gif); + } + fclose(h->infile); + if(h && h->il )fim_free(h->il ); + if(h && h->row)fim_free(h->row); + if(h)fim_free(h); + return FIM_NULL; +} + +static void +gif_read(fim_byte_t *dst, unsigned int line, void *data) +{ + struct gif_state *h = (struct gif_state *) data; + GifColorType *cmap; + int x; + + if (h->gif->Image.Interlace) { + if (line % 2) { + DGifGetLine(h->gif, h->row, h->w); + } else { + memcpy(h->row, h->il + h->w * line, h->w); + } + } else { + DGifGetLine(h->gif, h->row, h->w); + } + cmap = h->gif->Image.ColorMap ? + h->gif->Image.ColorMap->Colors : h->gif->SColorMap->Colors; + for (x = 0; x < h->w; x++) { + dst[0] = cmap[h->row[x]].Red; + dst[1] = cmap[h->row[x]].Green; + dst[2] = cmap[h->row[x]].Blue; + dst += 3; + } +} + +static void +gif_done(void *data) +{ + struct gif_state *h = (struct gif_state *) data; + + if (FbiStuff::fim_filereading_debug()) + FIM_FBI_PRINTF("gif: done, cleaning up\n"); + DGifCloseFile(h->gif FIM_DGifCloseFile_ARG); + fclose(h->infile); + if (h->il) + fim_free(h->il); + fim_free(h->row); + fim_free(h); +} + +static struct ida_loader gif_loader = { + /*magic:*/ "GIF", + /*moff:*/ 0, + /*mlen:*/ 3, + /*name:*/ "libungif", + /*init:*/ gif_init, + /*read:*/ gif_read, + /*done:*/ gif_done, +}; + +static void __init init_rd(void) +{ + fim_load_register(&gif_loader); +} + +} diff --git a/src/FbiStuffJasPer.cpp b/src/FbiStuffJasPer.cpp new file mode 100644 index 0000000..8e47691 --- /dev/null +++ b/src/FbiStuffJasPer.cpp @@ -0,0 +1,297 @@ +/* $LastChangedDate: 2015-12-19 01:44:41 +0100 (Sat, 19 Dec 2015) $ */ +/* + FbiStuffXyz.cpp : An example file for reading new file types with hypothetical library libjp2. + + (c) 2014-2015 Michele Martone + based on code (c) 1998-2006 Gerd Knorr + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "fim.h" + +#if FIM_WITH_LIBJASPER +/* Experimental, preliminar, unfinished support for JPEG-2K (JPEG-2000) files loading. + * Error handling and performance shall be dealt with... + * + * A few references: + * http://www.ece.uvic.ca/~frodo/jasper + * http://www.jpeg.org/jpeg2000/index.html + * https://tools.ietf.org/html/rfc3745 + */ + +#include +#include +#include +#include +#ifdef HAVE_ENDIAN_H +# include +#endif /* HAVE_ENDIAN_H */ +#include + +namespace fim +{ + +extern CommandConsole cc; + +typedef unsigned char fim_byte_t ; + +#define JP2_ERR -1 +#define JP2_OK 0 + +#define jp2_vctocc(i, co, cs) \ + (( (i) - (co)) / (cs)) + +static int jp2_image_render(jas_image_t *image, int vw, int vh, fim_byte_t *vdata) +{ + /* Derived from jas_image_render in the jasper-1.900.1/src/appl/jiv.c example. */ + int i; + int j; + int k; + int x; + int y; + int v[3]; + fim_byte_t *vdatap; + int cmptlut[3]; + int width; + int height; + int hs; + int vs; + int tlx; + int tly; + const int sc = 256; + + if ((cmptlut[0] = jas_image_getcmptbytype(image, + JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_R))) < 0 || + (cmptlut[1] = jas_image_getcmptbytype(image, + JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_G))) < 0 || + (cmptlut[2] = jas_image_getcmptbytype(image, + JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_B))) < 0) + goto error; + + width = jas_image_cmptwidth(image, cmptlut[0]); + height = jas_image_cmptheight(image, cmptlut[0]); + tlx = jas_image_cmpttlx(image, cmptlut[0]); + tly = jas_image_cmpttly(image, cmptlut[0]); + vs = jas_image_cmptvstep(image, cmptlut[0]); + hs = jas_image_cmpthstep(image, cmptlut[0]); + for (i = 1; i < 3; ++i) { + if (jas_image_cmptwidth(image, cmptlut[i]) != width || + jas_image_cmptheight(image, cmptlut[i]) != height) + goto error; + } + + for (i = 0; i < vh; ++i) { + vdatap = &vdata[( i) * (3 * vw)]; + for (j = 0; j < vw; ++j) { + x = jp2_vctocc(j, tlx, hs); + y = jp2_vctocc(i, tly, vs); + for (k = 0; k < 3; ++k) { + v[k] = jas_image_readcmptsample(image, cmptlut[k], x, y); + v[k] <<= 16 - jas_image_cmptprec(image, cmptlut[k]); + if (v[k] < 0) { + v[k] = 0; + } else if (v[k] > 65535) { + v[k] = 65535; + } + } + v[0]/=sc; + v[1]/=sc; + v[2]/=sc; + *vdatap++ = v[0]; + *vdatap++ = v[1]; + *vdatap++ = v[2]; + } + } + return JP2_OK; +error: + return JP2_ERR; +} + +struct jp2_state { + FILE *fp; + int w; /* image width: 1... */ + int h; /* image height: 1... */ + size_t flen; /* file length */ + fim_byte_t*rgb; /* pixels, from upper left to lower right, line by line */ + int bytes_per_line; /* rgb has bytes_per_line bytes per line */ + jas_stream_t *in; + jas_image_t *image; + jas_cmprof_t *outprof; +}; + +static void* +jp2_init(FILE *fp, const fim_char_t *filename, unsigned int page, struct ida_image_info *i, int thumbnail) +{ + /* it is safe to ignore filename, page, thumbnail */ + struct jp2_state *h = FIM_NULL; + fim_err_t errval = FIM_ERR_GENERIC; + long fo = 0; + + h = (struct jp2_state *)fim_calloc(1,sizeof(*h)); + + if(!h) + goto oops; + + h->fp = fp; + + if(fseek(h->fp,0,SEEK_END)!=0) + goto oops; + + fo = ftell(h->fp); + h->flen = fo; /* FIXME: evil conversion */ + if( fo == -1 ) + goto oops; + + if (jas_init()) + { + goto oops; + } + +/* +see also: +jas_stream_t *jas_stream_fopen(const char *filename, const char *mode); +jas_stream_t *jas_stream_memopen(char *buf, int bufsize); +jas_stream_t *jas_stream_fdopen(int fd, const char *mode); +jas_stream_t *jas_stream_freopen(const char *path, const char *mode, FILE *fp); +*/ + + if(filename) + { + if (!(h->in = jas_stream_fopen(filename, "rb"))) + { + fprintf(stderr, "error: cannot open file %s\n", filename); + goto oops; + } + } + else + goto oops; + + if (!(h->image = jas_image_decode(h->in, -1, 0))) + { + fprintf(stderr, "error: cannot load image data\n"); + goto oops; + } +#if 0 + if (!(h->outprof = jas_cmprof_createfromclrspc(JAS_CLRSPC_SRGB))) + { + goto oops; + } + jas_image_t *altimage; + if (!(altimage = jas_image_chclrspc(h->image, outprof, JAS_CMXFORM_INTENT_PER))) + goto oops;*/ + fprintf(stderr, "num of components %d\n", jas_image_numcmpts(h->image)); + fprintf(stderr, "dimensions %d %d\n", jas_image_width(h->image), jas_image_height(h->image)); +#endif + + i->width = jas_image_width(h->image); + i->height = jas_image_height(h->image); + i->npages = 1; + + h->rgb = (fim_byte_t*) fim_calloc( i->width * i->height * 3 , sizeof(fim_byte_t)); + + if(!h->rgb) + { + std::cout << "Failed fim_calloc!\n"; + goto oops; + } + + if( JP2_OK != jp2_image_render(h->image, i->width, i->height, h->rgb) ) + { + goto oops; + } + + h->w = i->width; + h->h = i->height; + h->bytes_per_line = i->width * 3; + + if(!h->rgb) + { + std::cout << "Failed fim_malloc!\n"; + goto oops; + } + + jas_stream_close(h->in); + + errval = FIM_ERR_NO_ERROR; + if(errval != FIM_ERR_NO_ERROR) + { + std::cout << "Failed jp2_load_image_fp!\n"; + goto oops; + } + + jas_cleanup(); + + return h; +oops: + if(h) + { + if(h->in) + jas_stream_close(h->in); + if(h->rgb) + fim_free(h->rgb); + fim_free(h); + } + jas_cleanup(); + return FIM_NULL; +} + +static void +jp2_read(fim_byte_t *dst, unsigned int line, void *data) +{ + /* this gets called every line. can be left empty if useless. */ + struct jp2_state *h = (struct jp2_state *) data; + int c; + + for (c=0;cw;++c) + { + dst[c*3+0] = h->rgb[h->bytes_per_line*line+c*3+0]; + dst[c*3+1] = h->rgb[h->bytes_per_line*line+c*3+1]; + dst[c*3+2] = h->rgb[h->bytes_per_line*line+c*3+2]; + } +} + +static void +jp2_done(void *data) +{ + struct jp2_state *h = (struct jp2_state *) data; + + fclose(h->fp); + fim_free(h->rgb); + fim_free(h); +} + +struct ida_loader jp2_loader = { +/* + * 12 chars, of which 3 heading zeros + * 0000000: 0000 000c 6a50 2020 0d0a 870a ....jP .... + * (https://www.iana.org/assignments/media-types/image/jp2) + */ + /*magic:*/ "\x0c\x6a\x50\x20\x20\x0d\x0a\x87\x0a", + /*moff:*/ 3, + /*mlen:*/ 9, + /*name:*/ "jp2", + /*init:*/ jp2_init, + /*read:*/ jp2_read, + /*done:*/ jp2_done, +}; + +static void __init init_rd(void) +{ + fim_load_register(&jp2_loader); +} + +} +#endif /* FIM_WITH_LIBJASPER */ diff --git a/src/FbiStuffJpeg.cpp b/src/FbiStuffJpeg.cpp new file mode 100644 index 0000000..82900e2 --- /dev/null +++ b/src/FbiStuffJpeg.cpp @@ -0,0 +1,657 @@ +/* $LastChangedDate: 2017-04-09 13:01:15 +0200 (Sun, 09 Apr 2017) $ */ +/* + FbiStuffJpeg.cpp : fbi functions for JPEG files, modified for fim + + (c) 2007-2017 Michele Martone + (c) 1998-2006 Gerd Knorr + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +/* + * This file comes from fbi, and will undergo severe reorganization. + * */ + + +#include +#include + +#if 0 + +#ifdef HAVE_STDLIB_H +//#undef HAVE_STDLIB_H +#define HAVE_STDLIB_H_BACKUP HAVE_STDLIB_H +#endif /* HAVE_STDLIB_H */ +#endif /* 0 */ + + +#include +//#include +//#include + +#include "FbiStuff.h" +#include "FbiStuffLoader.h" +//#include "loader.h" +//#define FIM_WITH_LIBEXIF 1 +#ifdef FIM_WITH_LIBEXIF +#include +#define HAVE_NEW_EXIF 1 +#endif /* FIM_WITH_LIBEXIF */ + +// +extern "C" +{ +// we require C linkage for these symbols +#include +} + + +/* + From fbi's misc.h : +*/ + +#if 0 +#define container_of(ptr, type, member) ({ \ + const typeof( ((type *)0)->member ) *__mptr = (ptr); \ + (type *)( (fim_char_t *)__mptr - offsetof(type,member) );}) +#define array_size(x) (sizeof(x)/sizeof(x[0])) +#endif + +/* */ + +#ifdef USE_X11 +# include +# include +# include +# include +# include +# include "RegEdit.h" +# include "ida.h" +# include "viewer.h" +#endif /* USE_X11 */ +namespace fim +{ + +#if HAVE_NEW_EXIF +extern CommandConsole cc; +#endif /* HAVE_NEW_EXIF */ + int fim_jerr=0; + +/* ---------------------------------------------------------------------- */ +/* load */ + +struct jpeg_state { + FILE * infile; /* source file */ + + struct jpeg_decompress_struct cinfo; + struct jpeg_error_mgr jerr; + JSAMPARRAY buffer; /* Output row buffer */ + int row_stride,linelength; /* physical row width in output buffer */ + fim_byte_t *image,*ptr; + + /* thumbnail */ + fim_byte_t *thumbnail; + unsigned int tpos, tsize; +}; + +/* ---------------------------------------------------------------------- */ +/* data source manager for thumbnail images */ + +/*static void thumbnail_src_init(struct jpeg_decompress_struct *cinfo) +{ + struct jpeg_state *h = container_of(cinfo, struct jpeg_state, cinfo); + cinfo->src->next_input_byte = h->thumbnail; + cinfo->src->bytes_in_buffer = h->tsize; +}*/ + +static int thumbnail_src_fill(struct jpeg_decompress_struct *cinfo) +{ + FIM_FBI_PRINTF("jpeg: panic: no more thumbnail input data\n"); + exit(1); +} + +static void thumbnail_src_skip(struct jpeg_decompress_struct *cinfo, + long num_bytes) +{ + cinfo->src->next_input_byte += num_bytes; +} + +static void thumbnail_src_term(struct jpeg_decompress_struct *cinfo) +{ + /* nothing */ +} + +//!! +//see jpeg_init + static struct jpeg_source_mgr thumbnail_mgr ; +/* + static struct jpeg_source_mgr thumbnail_mgr = { + .init_source = thumbnail_src_init, + .fill_input_buffer = thumbnail_src_fill, + .skip_input_data = thumbnail_src_skip, + .resync_to_restart = jpeg_resync_to_restart, + .term_source = thumbnail_src_term, +}; +*/ +//!! + + +static void fim_error_exit (j_common_ptr cinfo) +{ + /* + FIM : NEW, UNFINISHED (if used now, it would break things) + read jpeglib's docs to finish this :) + */ + /* cinfo->err really points to a my_error_mgr struct, so coerce pointer */ +// my_error_ptr myerr = (my_error_ptr) cinfo->err; + + /* Always display the message. */ + /* We could postpone this until after returning, if we chose. */ + std::cerr << "jpeglib:"<<"\n"; + (*cinfo->err->output_message) (cinfo); + + /* Return control to the setjmp point */ +// longjmp(myerr->setjmp_buffer, 1); + fim_jerr=1; +} + +#ifdef FIM_WITH_LIBEXIF +static void fim_ExifContentForeachEntryFunc (ExifEntry *entry, void * user_data) +{ + fim_char_t buffer[FIM_EXIF_BUFSIZE]; + Namespace *nsp = (Namespace*) ((void**)user_data)[0]; + ExifContent *c = (ExifContent *) ((void**)user_data)[1]; + const fim_char_t *value = exif_entry_get_value(entry, buffer, sizeof(buffer)); + ExifIfd ifd = exif_content_get_ifd (c); + const fim_char_t *title = exif_tag_get_name_in_ifd (entry->tag,ifd); /* exif_tag_get_name() is deprecated */ + + if(nsp) + /* std::cout << "|" << title << "|\n", */ + nsp->setVariable(string("EXIF_") + title,value); +} + +static void fim_ExifDataForeachContentFunc (ExifContent *content, void * user_data) +{ + void * user_data2[] = {user_data,content}; + exif_content_foreach_entry (content, fim_ExifContentForeachEntryFunc, user_data2); +} + +static void dump_exif(FILE *out, ExifData *ed, Namespace *nsp = FIM_NULL) +{ +/* FIXME: temporarily here; shall transfer keys/values to a Namespace object */ +#if HAVE_NEW_EXIF + if(nsp) + exif_data_foreach_content (ed, fim_ExifDataForeachContentFunc, nsp); +#endif /* HAVE_NEW_EXIF */ + +/* #if HAVE_NEW_EXIF */ +#if 0 + for (int i = 0; i < EXIF_IFD_COUNT; i++) { + fim_char_t buffer[FIM_EXIF_BUFSIZE]; + const fim_char_t *value=FIM_NULL; + ExifEntry *ee=FIM_NULL; + /* values of EXIF_TAG_* in libexif/exif-tag.h */ + //for (i = 0; i < 1; i++) { // first only + std::cout << "EXIF_IFD_COUNT " << i << " " << EXIF_IFD_COUNT << "\n"; + if( ee=exif_content_get_entry(ed->ifd[i],EXIF_TAG_ORIENTATION)){ + // value can be of the form "X - Y", with X and Y in + // {top,bottom,left,right} + // here we handle only + // on: http://sylvana.net/jpegcrop/exif_orientation.html + // we got the following combinations: + // Value 0th Row 0th Column + // 1 top left side + // 2 top right side + // 3 bottom right side + // 4 bottom left side + // 5 left side top + // 6 right side top + // 7 right side bottom + // 8 left side bottom + // + // neatly depicted in an F letter example: + // + // 1 2 3 4 5 6 7 8 + // + // 888888 888888 88 88 8888888888 88 88 8888888888 + // 88 88 88 88 88 88 88 88 88 88 88 88 + // 8888 8888 8888 8888 88 8888888888 8888888888 88 + // 88 88 88 88 + // 88 88 888888 888888 + // + // note that (in this order): + // 2,3,5,7 want a mirror transformation + // 4,3 want a flip transformation + // 7,8 want a cw rotation + // 5,6 want a ccw rotation + // + bool shouldmirror,shouldrotatecw,shouldrotateccw,shouldflip; fim_char_t r,c;const fim_char_t *p;fim_char_t f; + value=exif_entry_get_value(ee, buffer, sizeof(buffer)); + if(!value || ((p=strstr(value," - "))==FIM_NULL))goto uhmpf; + r=tolower(value[0]); c=tolower(p[3]); + switch(r) + { + case 't': + switch(c){ + case 'l':f=1; break; + case 'r':f=2; break; + default: f=0; + } break; + case 'b': + switch(c){ + case 'r':f=3; break; + case 'l':f=4; break; + default: f=0; + } break; + case 'l': + switch(c){ + case 't':f=5; break; + case 'b':f=8; break; + default: f=0; + } break; + case 'r': + switch(c){ + case 't':f=6; break; + case 'b':f=7; break; + default: f=0; + } break; + default: f=0; + } + //if(f==0)goto uhmpf; + shouldmirror=(f==2 || f==4 || f==5 || f==7); + shouldflip=(f==4 || f==3); + shouldrotatecw=(f==5 || f==6); + shouldrotateccw=(f==7 || f==8); +// std::cout << "EXIF_TAG_ORIENTATION FOUND !\n", +// std::cout << "VALUE: " <<(int)f << r<< c<< +// shouldmirror<< shouldrotatecw<< shouldrotateccw<< shouldflip, +// std::cout << "\n"; + if(shouldrotateccw)cc.setVariable("exif_orientation",1); + if(shouldrotatecw)cc.setVariable("exif_orientation",3); + if(shouldmirror)cc.setVariable("exif_mirrored",1); + if(shouldflip)cc.setVariable("exif_flipped",1); + // FIXME: should complete this code by setting up some mechanism for recovering this rotation/flip info +uhmpf: + 1; + } + /* FIXME: shall rationalize the following: */ + if( ee=exif_content_get_entry(ed->ifd[i],EXIF_TAG_DATE_TIME)){ + value=exif_entry_get_value(ee, buffer, sizeof(buffer)); + if(nsp) nsp->setVariable("EXIF_TAG_DATE_TIME",value); + } + if( ee=exif_content_get_entry(ed->ifd[i],EXIF_TAG_DATE_TIME_ORIGINAL)){ + value=exif_entry_get_value(ee, buffer, sizeof(buffer)); + if(nsp) nsp->setVariable("EXIF_TAG_DATE_TIME_ORIGINAL",value); + } + if( ee=exif_content_get_entry(ed->ifd[i],EXIF_TAG_DATE_TIME_DIGITIZED)){ + value=exif_entry_get_value(ee, buffer, sizeof(buffer)); + if(nsp) nsp->setVariable("EXIF_TAG_DATE_TIME_DIGITIZED",value); + } + if( ee=exif_content_get_entry(ed->ifd[i],EXIF_TAG_EXPOSURE_TIME)){ + value=exif_entry_get_value(ee, buffer, sizeof(buffer)); + if(nsp) nsp->setVariable("EXIF_TAG_EXPOSURE_TIME",value); + } + if( ee=exif_content_get_entry(ed->ifd[i],EXIF_TAG_FNUMBER)){ + value=exif_entry_get_value(ee, buffer, sizeof(buffer)); + if(nsp) nsp->setVariable("EXIF_TAG_FNUMBER",value); + } + if( ee=exif_content_get_entry(ed->ifd[i],EXIF_TAG_BATTERY_LEVEL)){ + value=exif_entry_get_value(ee, buffer, sizeof(buffer)); + if(nsp) nsp->setVariable("EXIF_TAG_BATTERY_LEVEL",value); + } + if( ee=exif_content_get_entry(ed->ifd[i],EXIF_TAG_APERTURE_VALUE)){ + value=exif_entry_get_value(ee, buffer, sizeof(buffer)); + if(nsp) nsp->setVariable("EXIF_TAG_APERTURE_VALUE",value); + } + if( ee=exif_content_get_entry(ed->ifd[i],EXIF_TAG_METERING_MODE)){ + value=exif_entry_get_value(ee, buffer, sizeof(buffer)); + if(nsp) nsp->setVariable("EXIF_TAG_METERING_MODE",value); + } + if( ee=exif_content_get_entry(ed->ifd[i],EXIF_TAG_EXPOSURE_PROGRAM)){ + value=exif_entry_get_value(ee, buffer, sizeof(buffer)); + if(nsp) nsp->setVariable("EXIF_TAG_EXPOSURE_PROGRAM",value); + } + if( ee=exif_content_get_entry(ed->ifd[i],EXIF_TAG_ISO_SPEED_RATINGS)){ + value=exif_entry_get_value(ee, buffer, sizeof(buffer)); + if(nsp) nsp->setVariable("EXIF_TAG_ISO_SPEED_RATINGS",value); + } + if( ee=exif_content_get_entry(ed->ifd[i],EXIF_TAG_MODEL)){ + value=exif_entry_get_value(ee, buffer, sizeof(buffer)); + if(nsp) nsp->setVariable("EXIF_TAG_MODEL",value); + } + if( ee=exif_content_get_entry(ed->ifd[i],EXIF_TAG_TIME_ZONE_OFFSET)){ + value=exif_entry_get_value(ee, buffer, sizeof(buffer)); + if(nsp) nsp->setVariable("EXIF_TAG_TIME_ZONE_OFFSET",value); + } + if( ee=exif_content_get_entry(ed->ifd[i],EXIF_TAG_IMAGE_UNIQUE_ID)){ + value=exif_entry_get_value(ee, buffer, sizeof(buffer)); + if(nsp) nsp->setVariable("EXIF_TAG_IMAGE_UNIQUE_ID",value); + } + if( ee=exif_content_get_entry(ed->ifd[i],EXIF_TAG_SHARPNESS)){ + value=exif_entry_get_value(ee, buffer, sizeof(buffer)); + if(nsp) nsp->setVariable("EXIF_TAG_SHARPNESS",value); + } + // ... EXIF_TAG_XP_TITLE EXIF_TAG_XP_COMMENT EXIF_TAG_XP_AUTHOR EXIF_TAG_XP_KEYWORDS EXIF_TAG_XP_SUBJECT + } +#endif /* HAVE_NEW_EXIF */ +#if 0 + for (i = 0; i < EXIF_IFD_COUNT; i++) { + fprintf(out," ifd %s\n", exif_ifd_get_name (i)); + for (tag = 0; tag < 0xffff; tag++) { + title = exif_tag_get_title(tag); + if (!title) + continue; + ee = exif_content_get_entry (ed->ifd[i], tag); + if (FIM_NULL == ee) + continue; +#ifdef HAVE_NEW_EXIF + value = exif_entry_get_value(ee, buffer, sizeof(buffer)); +#else /* HAVE_NEW_EXIF */ + value = exif_entry_get_value(ee); +#endif /* HAVE_NEW_EXIF */ + fprintf(out," 0x%04x %-30s %s\n", tag, title, value); + } + } + if (ed->data && ed->size) + fprintf(out," thumbnail\n %d bytes data\n", ed->size); +#endif +} +#endif /* FIM_WITH_LIBEXIF */ + + +/* ---------------------------------------------------------------------- */ +/* jpeg loader */ + +static void* +jpeg_init(FILE *fp, const fim_char_t *filename, unsigned int page, + struct ida_image_info *i, int thumbnail) +{ + struct jpeg_state *h; + jpeg_saved_marker_ptr mark; + fim_jerr=0; +#ifdef FIM_WITH_LIBEXIF + //std::cout << "EXIF is not implemented, really :) \n"; +#endif /* FIM_WITH_LIBEXIF */ + + h = (struct jpeg_state *)fim_calloc(1,sizeof(*h)); + if(!h) goto oops; + + h->infile = fp; + + h->jerr.error_exit=FIM_NULL; // ? + h->cinfo.err = jpeg_std_error(&h->jerr); /* FIXME : should use an error manager of ours (this one exits the program!) */ + h->jerr.error_exit = fim_error_exit; /* FIXME : should use an error manager of ours (this one exits the program!) */ + //h->jerr.error_exit = FIM_NULL ; /* FIXME : should use an error manager of ours (this one exits the program!) */ + if(fim_jerr /*&& h->jerr.msg_code*/)goto oops; + jpeg_create_decompress(&h->cinfo); + /*if(h->jerr.msg_code)goto oops;*/ + if(fim_jerr /*&& h->jerr.msg_code*/)goto oops; + jpeg_save_markers(&h->cinfo, JPEG_COM, 0xffff); /* comment */ + if(fim_jerr /*&& h->jerr.msg_code*/)goto oops; + jpeg_save_markers(&h->cinfo, JPEG_APP0+1, 0xffff); /* EXIF */ + jpeg_save_markers(&h->cinfo, JPEG_APP0+13, 0xffff); /* ?? */ + if(fim_jerr /*&& h->jerr.msg_code*/)goto oops; + jpeg_stdio_src(&h->cinfo, h->infile); + if(fim_jerr /*&& h->jerr.msg_code*/)goto oops; +// if(jpeg_read_header(&h->cinfo, FIM_FBI_TRUE)==0) goto oops; + jpeg_read_header(&h->cinfo, FIM_FBI_TRUE); + if(fim_jerr /*&& h->jerr.msg_code*/)goto oops; +// if(h->jerr.msg_code)goto oops; // this triggers with apparently good file + + for (mark = h->cinfo.marker_list; FIM_NULL != mark; mark = mark->next) { + switch (mark->marker) { + case JPEG_COM: + if (FbiStuff::fim_filereading_debug()) + FIM_FBI_PRINTF("jpeg: comment found (COM marker) [%.*s]\n", + (int)mark->data_length, mark->data); + load_add_extra(i,EXTRA_COMMENT,mark->data,mark->data_length); + break; + case JPEG_APP0 +1: + if (FbiStuff::fim_filereading_debug()) + FIM_FBI_PRINTF("jpeg: exif data found (APP1 marker)\n"); + /* load_add_extra(i,EXTRA_COMMENT,mark->data,mark->data_length); */ + +#if HAVE_NEW_EXIF +#ifdef FIM_WITH_LIBEXIF + { + ExifData *ed=exif_data_new_from_data(mark->data,mark->data_length); + if(ed) +#if FIM_EXPERIMENTAL_IMG_NMSPC + dump_exif(stdout,ed,i->nsp); +#else /* FIM_EXPERIMENTAL_IMG_NMSPC */ + dump_exif(stdout,ed,FIM_NULL); +#endif /* FIM_EXPERIMENTAL_IMG_NMSPC */ + } +#endif /* FIM_WITH_LIBEXIF */ +#endif /* HAVE_NEW_EXIF */ +#ifdef FIM_WITH_LIBEXIF_nonono + if (thumbnail) { + ExifData *ed; + + ed = exif_data_new_from_data(mark->data,mark->data_length); + if (ed->data && + ed->data[0] == 0xff && + ed->data[1] == 0xd8) { + if (FbiStuff::fim_filereading_debug()) + FIM_FBI_PRINTF("jpeg: exif thumbnail found\n"); + + /* save away thumbnail data */ + h->thumbnail = fim_malloc(ed->size); + if(!h->thumbnail) goto oops; + h->tsize = ed->size; + memcpy(h->thumbnail,ed->data,ed->size); + } + exif_data_unref(ed); + } +#endif /* FIM_WITH_LIBEXIF_nonono */ + break; + case JPEG_APP0 +13: + if (FbiStuff::fim_filereading_debug()) + printf("jpeg: exif data found (APP13 marker)\n"); + /* load_add_extra(i,EXTRA_COMMENT,mark->data,mark->data_length); */ + + break; + default: + printf("jpeg: unknown marker\n"); + } + } + + // !! + thumbnail_mgr.init_source = /*thumbnail_src_init*/ FIM_NULL /* it is not useful, and breaks c++98 standard C++ compilation */; + thumbnail_mgr.fill_input_buffer = thumbnail_src_fill; + thumbnail_mgr.skip_input_data = thumbnail_src_skip; + thumbnail_mgr.resync_to_restart = jpeg_resync_to_restart; + thumbnail_mgr.term_source = thumbnail_src_term; + // !! + + if (h->thumbnail) { + /* save image size */ + i->thumbnail = 1; + i->real_width = h->cinfo.image_width; + i->real_height = h->cinfo.image_height; + + /* re-setup jpeg */ + jpeg_destroy_decompress(&h->cinfo); + if(fim_jerr)goto oops; + // if(h->jerr.msg_code)goto oops; // this triggers with apparently good files + fim_fclose(h->infile); + h->infile = FIM_NULL; + jpeg_create_decompress(&h->cinfo); + if(fim_jerr)goto oops; + // if(h->jerr.msg_code)goto oops; + h->cinfo.src = &thumbnail_mgr; + jpeg_read_header(&h->cinfo, FIM_FBI_TRUE); + if(fim_jerr)goto oops; +// if(h->jerr.msg_code)goto oops; + } + + h->cinfo.out_color_space = JCS_RGB; + jpeg_start_decompress(&h->cinfo); + if(fim_jerr)goto oops; +// if(h->jerr.msg_code)goto oops; + i->width = h->cinfo.image_width; + i->height = h->cinfo.image_height; + i->npages = 1; + switch (h->cinfo.density_unit) { + case 0: /* unknown */ + break; + case 1: /* dot per inch */ + i->dpi = h->cinfo.X_density; + break; + case 2: /* dot per cm */ + i->dpi = res_cm_to_inch(h->cinfo.X_density); + break; + } + + return h; +oops: +std::cerr << "OOPS: problems decoding "<< filename <<"...\n"; + if( h && h->thumbnail) fim_free(h->thumbnail); + if( h ) fim_free(h); + fim_jerr=0;/* ready for the next */ + return FIM_NULL; +} + +static void +jpeg_read(fim_byte_t *dst, unsigned int line, void *data) +{ + struct jpeg_state *h = (struct jpeg_state*)data; + JSAMPROW row = dst; +// if(h->jerr.msg_code)goto oops; + jpeg_read_scanlines(&h->cinfo, &row, 1); +// oops: + return; +} + +static void +jpeg_done(void *data) +{ + struct jpeg_state *h = (struct jpeg_state*)data; + jpeg_destroy_decompress(&h->cinfo); + if (h->infile) + fim_fclose(h->infile); + if (h->thumbnail) + fim_free(h->thumbnail); + fim_free(h); +} + +static struct ida_loader jpeg_loader = { + /*magic:*/ "\xff\xd8", + /*moff:*/ 0, + /*mlen:*/ 2, + /*name:*/ "libjpeg", + /*init:*/ jpeg_init, + /*read:*/ jpeg_read, + /*done:*/ jpeg_done, +}; + +static void __init init_rd(void) +{ + fim_load_register(&jpeg_loader); +} + +#ifdef USE_X11 + +/* ---------------------------------------------------------------------- */ +/* jpeg writer */ + +static Widget jpeg_shell; +static Widget jpeg_text; +static int jpeg_quality = 75; + +static void +jpeg_button_cb(Widget widget, XtPointer clientdata, XtPointer call_data) +{ + XmSelectionBoxCallbackStruct *cb = call_data; + + if (XmCR_OK == cb->reason) { + jpeg_quality = atoi(XmTextGetString(jpeg_text)); + do_save_print(); + } + XtUnmanageChild(jpeg_shell); +} + +static int +jpeg_conf(Widget parent, struct ida_image *img) +{ + fim_char_t tmp[32]; + + if (!jpeg_shell) { + /* build dialog */ + jpeg_shell = XmCreatePromptDialog(parent,"jpeg",FIM_NULL,0); + XmdRegisterEditres(XtParent(jpeg_shell)); + XtUnmanageChild(XmSelectionBoxGetChild(jpeg_shell,XmDIALOG_HELP_BUTTON)); + jpeg_text = XmSelectionBoxGetChild(jpeg_shell,XmDIALOG_TEXT); + XtAddCallback(jpeg_shell,XmNokCallback,jpeg_button_cb,FIM_NULL); + XtAddCallback(jpeg_shell,XmNcancelCallback,jpeg_button_cb,FIM_NULL); + } + sprintf(tmp,"%d",jpeg_quality); + XmTextSetString(jpeg_text,tmp); + XtManageChild(jpeg_shell); + return 0; +} + +static int +jpeg_write(FILE *fp, struct ida_image *img) +{ + struct jpeg_compress_struct cinfo; + struct jpeg_error_mgr jerr; + fim_byte_t *line; + unsigned int i; + + cinfo.err = jpeg_std_error(&jerr); + jpeg_create_compress(&cinfo); + jpeg_stdio_dest(&cinfo, fp); + cinfo.image_width = img->i.width; + cinfo.image_height = img->i.height; + if (img->i.dpi) { + cinfo.density_unit = 1; + cinfo.X_density = img->i.dpi; + cinfo.Y_density = img->i.dpi; + } + cinfo.input_components = 3; + cinfo.in_color_space = JCS_RGB; + jpeg_set_defaults(&cinfo); + jpeg_set_quality(&cinfo, jpeg_quality, FIM_FBI_TRUE); + jpeg_start_compress(&cinfo, FIM_FBI_TRUE); + + for (i = 0, line = img->data; i < img->i.height; i++, line += img->i.width*3) + jpeg_write_scanlines(&cinfo, &line, 1); + + jpeg_finish_compress(&(cinfo)); + jpeg_destroy_compress(&(cinfo)); + return 0; +} + +struct ida_writer jpeg_writer = { + /*label:*/ "JPEG", + /* ext: */ { "jpg", "jpeg", FIM_NULL}, + /*write:*/ jpeg_write, + /*conf: */ jpeg_conf, +}; + +static void __init init_wr(void) +{ + fim_write_register(&jpeg_writer); +} + + +#endif /* USE_X11 */ +#if 0 +#ifdef HAVE_STDLIB_H_BACKUP +#define HAVE_STDLIB_H HAVE_STDLIB_H_BACKUP +#undef HAVE_STDLIB_H_BACKUP +#endif /* HAVE_STDLIB_H_BACKUP */ +#endif +} diff --git a/src/FbiStuffList.h b/src/FbiStuffList.h new file mode 100644 index 0000000..e4d13ae --- /dev/null +++ b/src/FbiStuffList.h @@ -0,0 +1,210 @@ +/* $LastChangedDate: 2013-07-04 23:07:07 +0200 (Thu, 04 Jul 2013) $ */ +/* + FbiStuffList.h : fbi functions for lists, modified for fim + + (c) 2008-2013 Michele Martone + (c) 1998-2006 Gerd Knorr + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +/* + * This file comes from fbi, and will undergo severe reorganization. + * */ + +#ifndef FBI_STUFF_LIST_H +#define FBI_STUFF_LIST_H + +#include "fim_types.h" + +//from list.h +/* + * Simple doubly linked list implementation. + * -- shameless stolen from the linux kernel sources + * + * Some of the internal functions ("__xxx") are useful when + * manipulating whole lists rather than single entries, as + * sometimes we already know the next/prev entries and we can + * generate better code by using them directly rather than + * using the generic single-entry routines. + */ + +struct list_head { + struct list_head *next, *prev; +}; + +/* beware that LIST_HEAD is defined in freebsd's */ +#ifdef FIM_LIST_HEAD_INIT +#undef FIM_LIST_HEAD_INIT +#endif /* FIM_LIST_HEAD_INIT */ + +#ifdef FIM_LIST_HEAD +#undef FIM_LIST_HEAD +#endif /* FIM_LIST_HEAD */ + +#define FIM_LIST_HEAD_INIT(name) { &(name), &(name) } + +#define FIM_LIST_HEAD(name) \ + struct list_head name = FIM_LIST_HEAD_INIT(name) + +#define FIM_INIT_LIST_HEAD(ptr) do { \ + (ptr)->next = (ptr); (ptr)->prev = (ptr); \ +} while (0) + +/* + * Insert a new entry between two known consecutive entries. + * + * This is only for internal list manipulation where we know + * the prev/next entries already! + */ +static __inline__ void __list_add(struct list_head * _new, + struct list_head * prev, + struct list_head * next) +{ + next->prev = _new; + _new->next = next; + _new->prev = prev; + prev->next = _new; +} + +/** + * list_add - add a new entry + * @new: new entry to be added + * @head: list head to add it after + * + * Insert a new entry after the specified head. + * This is good for implementing stacks. + */ +static __inline__ void list_add(struct list_head *_new, struct list_head *head) +{ + __list_add(_new, head, head->next); +} + +/** + * list_add_tail - add a new entry + * @new: new entry to be added + * @head: list head to add it before + * + * Insert a new entry before the specified head. + * This is useful for implementing queues. + */ +static __inline__ void list_add_tail(struct list_head *_new, struct list_head *head) +{ + __list_add(_new, head->prev, head); +} + +/* + * Delete a list entry by making the prev/next entries + * point to each other. + * + * This is only for internal list manipulation where we know + * the prev/next entries already! + */ +static __inline__ void __list_del(struct list_head * prev, + struct list_head * next) +{ + next->prev = prev; + prev->next = next; +} + +/** + * list_del - deletes entry from list. + * @entry: the element to delete from the list. + * Note: list_empty on entry does not return true after this, the entry is in an undefined state. + */ +static __inline__ void list_del(struct list_head *entry) +{ + __list_del(entry->prev, entry->next); +} + +/** + * list_del_init - deletes entry from list and reinitialize it. + * @entry: the element to delete from the list. + */ +static __inline__ void list_del_init(struct list_head *entry) +{ + __list_del(entry->prev, entry->next); + FIM_INIT_LIST_HEAD(entry); +} + +/** + * list_empty - tests whether a list is empty + * @head: the list to test. + */ +static __inline__ int list_empty(struct list_head *head) +{ + return head->next == head; +} + +/** + * list_splice - join two lists + * @list: the new list to add. + * @head: the place to add it in the first list. + */ +static __inline__ void list_splice(struct list_head *list, struct list_head *head) +{ + struct list_head *first = list->next; + + if (first != list) { + struct list_head *last = list->prev; + struct list_head *at = head->next; + + first->prev = head; + head->next = first; + + last->next = at; + at->prev = last; + } +} + +/** + * list_entry - get the struct for this entry + * @ptr: the &struct list_head pointer. + * @type: the type of the struct this is embedded in. + * @member: the name of the list_struct within the struct. + */ +#define list_entry(ptr, type, member) \ + ((type *)((fim_char_t *)(ptr)-(unsigned long)(&((type *)0)->member))) + +/** + * list_for_each - iterate over a list + * @pos: the &struct list_head to use as a loop counter. + * @head: the head for your list. + */ +#define list_for_each(pos, head) \ + for (pos = (head)->next; pos != (head); pos = pos->next) + +/** + * list_for_each_safe - iterate over a list safe against removal of list entry + * @pos: the &struct list_head to use as a loop counter. + * @n: another &struct list_head to use as temporary storage + * @head: the head for your list. + */ +#define list_for_each_safe(pos, n, head) \ + for (pos = (head)->next, n = pos->next; pos != (head); \ + pos = n, n = pos->next) + +/** + * list_for_each_prev - iterate over a list in reverse order + * @pos: the &struct list_head to use as a loop counter. + * @head: the head for your list. + */ +#define list_for_each_prev(pos, head) \ + for (pos = (head)->prev; pos != (head); pos = pos->prev) + + +//end from list.h + +#endif /* FBI_STUFF_LIST_H */ + diff --git a/src/FbiStuffLoader.cpp b/src/FbiStuffLoader.cpp new file mode 100644 index 0000000..1b279d5 --- /dev/null +++ b/src/FbiStuffLoader.cpp @@ -0,0 +1,197 @@ +/* $LastChangedDate: 2015-12-19 01:44:41 +0100 (Sat, 19 Dec 2015) $ */ +/* + FbiStuffLoader.cpp : fbi functions for loading files, modified for fim + + (c) 2008-2015 Michele Martone + (c) 1998-2006 Gerd Knorr + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +/* + * This file comes from fbi, and will undergo severe reorganization. + * */ + + + +#include +#include +#include + +//#include "loader.h" +#include "fim.h" +#include "FbiStuffLoader.h" + +/* ----------------------------------------------------------------------- */ + +namespace fim +{ + +void load_bits_lsb(fim_byte_t *dst, fim_byte_t *src, int width, + int on, int off) +{ + int i,mask,bit; + + for (i = 0; i < width; i++) { + mask = 1 << (i & 0x07); + bit = src[i>>3] & mask; + dst[0] = bit ? on : off; + dst[1] = bit ? on : off; + dst[2] = bit ? on : off; + dst += 3; + } +} + +void load_bits_msb(fim_byte_t *dst, fim_byte_t *src, int width, + int on, int off) +{ + int i,mask,bit; + + for (i = 0; i < width; i++) { + mask = 1 << (7 - (i & 0x07)); + bit = src[i>>3] & mask; + dst[0] = bit ? on : off; + dst[1] = bit ? on : off; + dst[2] = bit ? on : off; + dst += 3; + } +} + +void load_gray(fim_byte_t *dst, fim_byte_t *src, int width) +{ + int i; + + for (i = 0; i < width; i++) { + dst[0] = src[0]; + dst[1] = src[0]; + dst[2] = src[0]; + dst += 3; + src += 1; + } +} + +void load_graya(fim_byte_t *dst, fim_byte_t *src, int width) +{ + int i; + + for (i = 0; i < width; i++) { + dst[0] = src[0]; + dst[1] = src[0]; + dst[2] = src[0]; + dst += 3; + src += 2; + } +} + +void load_rgba(fim_byte_t *dst, fim_byte_t *src, int width) +{ + int i; + + for (i = 0; i < width; i++) { + dst[0] = src[0]; + dst[1] = src[1]; + dst[2] = src[2]; + dst += 3; + src += 4; + } +} + +/* ----------------------------------------------------------------------- */ + +int load_add_extra(struct ida_image_info *info, enum ida_extype type, + fim_byte_t *data, unsigned int size) +{ + struct ida_extra *extra; + + extra = (struct ida_extra*)malloc(sizeof(*extra)); + if (FIM_NULL == extra) + return -1; + if(type==EXTRA_COMMENT) ++size;// dez's + fim_bzero(extra,sizeof(*extra)); + extra->data = (fim_byte_t*)malloc(size); + if (FIM_NULL == extra->data) { + fim_free(extra); + return -1; + } + extra->type = type; + extra->size = size; + memcpy(extra->data,data,size); + if(type==EXTRA_COMMENT) extra->data[size-1]='\0';// dez's + extra->next = info->extra; + info->extra = extra; + return 0; +} + +struct ida_extra* load_find_extra(struct ida_image_info *info, + enum ida_extype type) +{ + struct ida_extra *extra; + + for (extra = info->extra; FIM_NULL != extra; extra = extra->next) + if (type == extra->type) + return extra; + return FIM_NULL; +} + +int load_free_extras(struct ida_image_info *info) +{ + struct ida_extra *next; + + while (FIM_NULL != info->extra) { + next = info->extra->next; + fim_free(info->extra->data); + fim_free(info->extra); + info->extra = next; + } + return 0; +} + +/* ----------------------------------------------------------------------- */ + +FIM_LIST_HEAD(loaders); +FIM_LIST_HEAD(writers); + +void fim_load_register(struct ida_loader *loader) +{ + list_add_tail(&loader->list, &loaders); +} + +#ifdef USE_X11 +void fim_write_register(struct ida_writer *writer) +{ + list_add_tail(&writer->list, &writers); +} +#endif /* USE_X11 */ + + void fim_loaders_to_stderr(void) + { + /* FIXME: new, should be generalized */ + struct list_head *item=FIM_NULL; + struct ida_loader *loader = FIM_NULL; + FIM_FPRINTF(stderr,"%s","\nSupported file loaders: "); + list_for_each(item,&loaders) + { + loader = list_entry(item, struct ida_loader, list); + if(loader->name && loader->mlen>=1) + FIM_FPRINTF(stderr," %s",loader->name); + } + list_for_each(item,&loaders) + { + loader = list_entry(item, struct ida_loader, list); + if(loader->name && loader->mlen<=0) + FIM_FPRINTF(stderr," %s",loader->name); + } + FIM_FPRINTF(stderr,"%s","\n"); + } +} diff --git a/src/FbiStuffLoader.h b/src/FbiStuffLoader.h new file mode 100644 index 0000000..dda1d76 --- /dev/null +++ b/src/FbiStuffLoader.h @@ -0,0 +1,168 @@ +/* $LastChangedDate: 2017-04-09 13:01:15 +0200 (Sun, 09 Apr 2017) $ */ +/* + FbiStuffLoader.h : fbi functions for loading files, modified for fim + + (c) 2008-2017 Michele Martone + (c) 1998-2006 Gerd Knorr + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +/* + * This file comes from fbi, and will undergo severe reorganization. + * */ + + +#ifndef FIM_STUFF_LOADER_H +#define FIM_STUFF_LOADER_H + +#include "fim_types.h" +#include "FbiStuffList.h" + +//#include "list.h" +#ifdef USE_X11 +# include +#endif /* USE_X11 */ + +namespace fim +{ + +enum ida_extype { + EXTRA_COMMENT = 1, + EXTRA_EXIF = 2 +}; + +struct ida_extra { + enum ida_extype type; + fim_byte_t *data; + unsigned int size; + struct ida_extra *next; +}; + +/* image data and metadata */ +struct ida_image_info { + unsigned int width; + unsigned int height; + unsigned int dpi; + unsigned int npages; + struct ida_extra *extra; +#ifdef FIM_EXPERIMENTAL_ROTATION + unsigned int fim_extra_flags;/* FIXME : unclean: regard this as a hack (flag set on a rotated image) */ +#endif /* FIM_EXPERIMENTAL_ROTATION */ + + int thumbnail; + unsigned int real_width; + unsigned int real_height; +#if FIM_EXPERIMENTAL_IMG_NMSPC + fim::Namespace *nsp; +#endif /* FIM_EXPERIMENTAL_IMG_NMSPC */ +}; + +struct ida_image { + struct ida_image_info i; + fim_byte_t *data; +}; +struct ida_rect { + int x1,y1,x2,y2; +}; + +/* load image files */ +struct ida_loader { + //const fim_byte_t *magic; + const fim_char_t *magic; + int moff; + int mlen; + const fim_char_t *name; + void* (*init)(FILE *fp, const fim_char_t *filename, unsigned int page, + struct ida_image_info *i, int thumbnail); + void (*read)(fim_byte_t *dst, unsigned int line, void *data); + void (*done)(void *data); + struct list_head list; +}; + +/* filter + operations */ +struct ida_op { + const fim_char_t *name; + void* (*init)(const struct ida_image *src, struct ida_rect *rect, + struct ida_image_info *i, void *parm); + void (*work)(const struct ida_image *src, struct ida_rect *rect, + fim_byte_t *dst, int line, + void *data); + void (*done)(void *data); +}; + +void* op_none_init(struct ida_image *src, struct ida_rect *rect, + struct ida_image_info *i, void *parm); +void op_none_done(void *data); +void op_free_done(void *data); + +#ifdef USE_X11 +/* save image files */ +struct ida_writer { + const fim_char_t *label; + const fim_char_t *ext[8]; + int (*write)(FILE *fp, struct ida_image *img); + int (*conf)(Widget widget, struct ida_image *img); + struct list_head list; +}; +#endif /* USE_X11 */ + +/* ----------------------------------------------------------------------- */ +/* resolution */ + +#define res_cm_to_inch(x) ((x * 2540 + 5) / 1000) +#define res_m_to_inch(x) ((x * 2540 + 5) / 100000) +#define res_inch_to_m(x) ((x * 100000 + 5) / 2540) + +/* ----------------------------------------------------------------------- */ + +/* helpers */ +void load_bits_lsb(fim_byte_t *dst, fim_byte_t *src, int width, + int on, int off); +void load_bits_msb(fim_byte_t *dst, fim_byte_t *src, int width, + int on, int off); +void load_gray(fim_byte_t *dst, fim_byte_t *src, int width); +void load_graya(fim_byte_t *dst, fim_byte_t *src, int width); +void load_rgba(fim_byte_t *dst, fim_byte_t *src, int width); + +int load_add_extra(struct ida_image_info *info, enum ida_extype type, + fim_byte_t *data, unsigned int size); +struct ida_extra* load_find_extra(struct ida_image_info *info, + enum ida_extype type); +int load_free_extras(struct ida_image_info *info); + +/* ----------------------------------------------------------------------- */ + +/* other */ +//extern int debug; +extern struct ida_loader ppm_loader; +extern struct ida_loader sane_loader; +extern struct ida_writer ps_writer; +extern struct ida_writer jpeg_writer; + +/* lists */ +#define __init __attribute__ ((constructor)) +#define __fini __attribute__ ((destructor)) + +extern struct list_head loaders; +extern struct list_head writers; + +void fim_load_register(struct ida_loader *loader); +void fim_write_register(struct ida_writer *writer); +void fim_loaders_to_stderr(void); + +} +#endif /* FIM_STUFF_LOADER_H */ + + diff --git a/src/FbiStuffMagick.cpp b/src/FbiStuffMagick.cpp new file mode 100644 index 0000000..95b33d4 --- /dev/null +++ b/src/FbiStuffMagick.cpp @@ -0,0 +1,185 @@ +/* $LastChangedDate: 2015-12-19 01:44:41 +0100 (Sat, 19 Dec 2015) $ */ +/* + FbiStuffMagick.cpp : fim functions for decoding image files using libGraphicsMagick + + (c) 2011-2015 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/* FIXME: This code is very inefficient, so please regard it as temporary */ +/* FIXME: Error handling is incomplete */ +/* TODO: CatchException fprintf's stuff: it is not adequate error reporting; we would prefer an error string instead */ +/* Tested with MagickLibVersion defined as 0x090600 */ + +#include +#include +#include +#include + +#include "../config.h" +#include "fim_types.h" +#include "fim_wrappers.h" +#include "FbiStuffList.h" +#include "FbiStuffLoader.h" + +#ifdef HAVE_LIBGRAPHICSMAGICK +#include + +/* versions as far as e.g. 1.13.12 have this bug, in coders/txt.c:328, due to a FIM_NULL p returning in case of empty text file */ +#ifdef MagickLibVersion +#define HAVE_LIBGRAPHICSMAGICK_TXT_FILEXTENSION_BUG (MagickLibVersion<=0x151200) /* 0x090600 was previously supposed to fix the problem but it did not, seemingly (as of 1.3.20) ... still: + fim: magick/semaphore.c:531: LockSemaphoreInfo: Assertion `semaphore_info != (SemaphoreInfo *) ((void *)0)' failed. + Aborted +*/ +#define HAVE_LIBGRAPHICSMAGICK_TXT_FILEXTENSION_BUG 1 +#else +#define HAVE_LIBGRAPHICSMAGICK_TXT_FILEXTENSION_BUG 1 +#endif /* MagickLibVersion */ + +struct magick_state_t { + Image * image; /* Warning: this is NOT to be confused with fim's Image class */ + Image * cimage; /* Warning: this is NOT to be confused with fim's Image class */ + ImageInfo *image_info; + MagickPassFail mpf; + ExceptionInfo exception; +}; + +static struct magick_state_t ms; + +namespace fim +{ + +static void magick_cleanup(void) +{ + if(ms.image)DestroyImageList(ms.image); + if(ms.cimage)DestroyImageList(ms.cimage); + if(ms.image_info)DestroyImageInfo(ms.image_info); + //DestroyExceptionInfo(ms.exception); + DestroyMagick(); +} + +static void* +magick_init(FILE *fp, const fim_char_t *filename, unsigned int page, + struct ida_image_info *i, int thumbnail) +{ + fim_bzero(&ms,sizeof(ms)); + ms.mpf=MagickFail; + + if(!fp && !filename) + goto nocleanuperr; + if(!filename) + goto nocleanuperr; + if(!fp) + goto nocleanuperr; + +#if HAVE_LIBGRAPHICSMAGICK_TXT_FILEXTENSION_BUG + if(filename) + { + fim_size_t fnl=strlen(filename); + if(fnl>=3 && 0==strcasecmp(filename+fnl-3,"txt")) + goto nocleanuperr; + if(fnl>=4 && 0==strcasecmp(filename+fnl-4,"text")) + goto nocleanuperr; + } +#endif /* HAVE_LIBGRAPHICSMAGICK_TXT_FILEXTENSION_BUG */ + InitializeMagick(filename); + GetExceptionInfo(&ms.exception); + if (ms.exception.severity != UndefinedException) + { + //CatchException(&ms.exception); + goto err; + } + ms.image_info=CloneImageInfo((ImageInfo *) FIM_NULL); + if(ms.image_info==FIM_NULL) + goto err; + + /* FIXME need correctness check on dimensions values ! */ + if(strlen(filename)>MaxTextExtent-1) + goto err; + (void) strncpy(ms.image_info->filename,filename,MaxTextExtent-1); + ms.image_info->filename[MaxTextExtent-1]='\0'; + ms.image=ReadImage(ms.image_info,&ms.exception); + if (ms.exception.severity != UndefinedException) + { + //CatchException(&ms.exception); + goto err; + } + if(!ms.image) + goto err; + i->npages = GetImageListLength(ms.image); /* ! */ + i->width = (ms.image)->columns; + i->height = (ms.image)->rows; + + if(page>=i->npages || page<0)goto err; + + if(i->width<1 || i->height<1 || i->npages<1) + goto err; + + ms.cimage=GetImageFromList(ms.image,page); + if (ms.exception.severity != UndefinedException) + { + //CatchException(&ms.exception); + } + if(!ms.cimage) + { + goto err; + } + return &ms; +err: + magick_cleanup(); +nocleanuperr: + return FIM_NULL; +} + +static void +magick_read(fim_byte_t *dst, unsigned int line, void *data) +{ + /* FIXME: this is extremely inefficient */ + for(unsigned int c=0;c<(ms.cimage)->columns;++c) + { + PixelPacket pp=AcquireOnePixel( ms.cimage, c, line, &ms.exception ); + dst[c*3+0]=pp.red; + dst[c*3+1]=pp.green; + dst[c*3+2]=pp.blue; + } +} + +static void +magick_done(void *data) +{ + magick_cleanup(); +} + +/* + not a filetype-specific decoder +*/ +struct ida_loader magick_loader = { + /*magic:*/ "", + /*moff:*/ 0, + /*mlen:*/ 0, + /*name:*/ "libGraphicsMagick", + /*init:*/ magick_init, + /*read:*/ magick_read, + /*done:*/ magick_done, +}; + +static void __init init_rd(void) +{ + fim_load_register(&magick_loader); +} + +} +#endif /* HAVE_LIBGRAPHICSMAGICK */ diff --git a/src/FbiStuffMatrixMarket.cpp b/src/FbiStuffMatrixMarket.cpp new file mode 100644 index 0000000..0f4b47d --- /dev/null +++ b/src/FbiStuffMatrixMarket.cpp @@ -0,0 +1,157 @@ +/* $LastChangedDate: 2015-12-19 01:44:41 +0100 (Sat, 19 Dec 2015) $ */ +/* + FbiStuffMatrixMarket.cpp : fim functions for decoding Matrix Market files + + (c) 2009-2015 Michele Martone + based on code (c) 1998-2006 Gerd Knorr + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include +#include +#include + +#include "FbiStuff.h" +#include "FbiStuffLoader.h" + +#ifdef HAVE_MATRIX_MARKET_DECODER + +/* This is an experimental library of mine, yet unreleased */ +#include + +namespace fim +{ + +/* ---------------------------------------------------------------------- */ +/* load */ + +struct mm_state_t { + fim_char_t * filename; + fim_byte_t * first_row_dst; + int width ; + int height ; +}; + + +/* ---------------------------------------------------------------------- */ + +static void* +mm_init(FILE *fp, const fim_char_t *filename, unsigned int page, + struct ida_image_info *i, int thumbnail) +{ + rsb_coo_idx_t rows,cols; + struct mm_state_t *h; + h = (struct mm_state_t *)fim_calloc(1,sizeof(*h)); + int rows_max=FIM_RENDERING_MAX_ROWS,cols_max=FIM_RENDERING_MAX_COLS; +// int rows_max=2048,cols_max=2048; + + if(!h)goto err; + h->first_row_dst=FIM_NULL; + + h->filename=FIM_NULL; + i->dpi = FIM_RENDERING_DPI; /* FIXME */ + i->npages = 1; + + if(rsb_lib_init(RSB_NULL_INIT_OPTIONS)) + goto err; + + if(rsb_file_mtx_get_dimensions(filename, &cols, &rows, FIM_NULL, FIM_NULL)) + goto err; + +#if 1 + if(cols<1 || rows<1) + goto err; + + if(cols>cols_max) + cols=cols_max; + if(rows>rows_max) + rows=rows_max; +#endif + + i->width = cols; + i->height = rows; + h->width = cols; + h->height = rows; + + h->filename=dupstr(filename); + + if(!h->filename) + goto err; + + return h; +err: + if( h ) fim_free(h); + return FIM_NULL; +} + +static void +mm_read(fim_byte_t *dst, unsigned int line, void *data) +{ + struct mm_state_t *h = (struct mm_state_t*)data; + + if(!h)return; + if(h->first_row_dst == FIM_NULL) + h->first_row_dst = dst; + else + return; + +#if 0 + if(rsb_get_pixmap_RGB_from_matrix(h->filename, dst, h->width, h->height)) +#else + if(rsb_file_mtx_render(dst,h->filename,h->width,h->width,h->height,RSB_MARF_RGB)) +#endif + goto err; +err: + return; +} + +static void +mm_done(void *data) +{ + struct mm_state_t *h = (struct mm_state_t*)data; + if(!data) + goto err; + if(h->filename) + fim_free(h->filename); + + if(rsb_lib_exit(RSB_NULL_EXIT_OPTIONS)) + goto err; +err: + return; +} + +/* +00000000 25 25 4D 61 74 72 69 78 4D 61 72 6B 65 74 20 6D 61 74 72 69 78 20 63 6F 6F 72 64 69 %%MatrixMarket matrix coordi +*/ +static struct ida_loader mm_loader = { + magic: "%%MatrixMarket matrix", + moff: 0, + mlen: 20, + name: "MatrixMarket", + init: mm_init, + read: mm_read, + done: mm_done, +}; + +static void __init init_rd(void) +{ + fim_load_register(&mm_loader); +} + +} + +#endif // ifdef HAVE_MATRIX_MARKET_DECODER + diff --git a/src/FbiStuffPcx.cpp b/src/FbiStuffPcx.cpp new file mode 100644 index 0000000..9eca7ac --- /dev/null +++ b/src/FbiStuffPcx.cpp @@ -0,0 +1,717 @@ +/* $LastChangedDate: 2016-09-15 17:26:05 +0200 (Thu, 15 Sep 2016) $ */ +/* + FbiStuffPcx.cpp : Code for reading PCX files. + + (c) 2014-2016 Michele Martone + The functions pcx_load_image_fp and pcx_load_image_info_fp are (c) 2014-2014 Mohammed Isam. + Originally based on code (c) 1998-2006 Gerd Knorr + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "fim.h" + +#if FIM_WITH_PCX + +#include +#include +#include +#include +#ifdef HAVE_ENDIAN_H +# include +#endif /* HAVE_ENDIAN_H */ + +namespace fim +{ + +extern CommandConsole cc; + +typedef int pcx_err_t; +#define PCX_ERR_NO_ERROR 0 +#define PCX_ERR_GENERIC -1 + +typedef char BOOL; +#ifdef HAVE_STDINT_H +typedef uint8_t UBYTE; //define UNSIGNED BYTE as 1 byte +typedef uint16_t UWORD; //define UNSIGNED WORD as 2 bytes +typedef uint32_t UDWORD; //define UNSIGNED DOUBLE WORD as 4 bytes +#else /* HAVE_STDINT_H */ +typedef __u8 UBYTE; //define UNSIGNED BYTE as 1 byte +typedef __u16 UWORD; //define UNSIGNED WORD as 2 bytes +typedef __u32 UDWORD; //define UNSIGNED DOUBLE WORD as 4 bytes +#endif /* HAVE_STDINT_H */ + +UWORD swap_word(UWORD x) { + return ((x>>8)&0xff) | // move byte 1 to byte 0 + ((x<<8)&0xff00); // move byte 0 to byte 1 +} + +typedef struct { + unsigned char red; + unsigned char green; + unsigned char blue; + unsigned char alpha; +} urgb; + +typedef struct { + char red; + char green; + char blue; +} colormap_rgb_s; + +typedef struct { + fim_byte_t manufacturer; + fim_byte_t version; + fim_byte_t encoding; + fim_byte_t bpp; + UWORD xstart, ystart, xend, yend; + UWORD hres, vres; + colormap_rgb_s colormap[16]; //amounts to 48 bytes + fim_byte_t reserved; + fim_byte_t planes; + UWORD bpl; + UWORD paletteinfo; + fim_byte_t filler[58]; +}PCX_HEADER_S; +PCX_HEADER_S PCX_HEADER; + +bool PALETTE_DEFINED; +bool COLORMAP_DEFINED; + +#define PCX_RETURN_ERROR(x) \ +{ \ + fprintf(stderr, "%s@%d:",__FILE__,__LINE__); \ + fprintf(stderr, x); \ + goto err; \ +} + +/* ---------------------------------------------------------------------- */ +/* libpcx routines */ +static pcx_err_t pcx_load_image_info_fp(FILE *fp, int * numpagesp, unsigned int *wp, unsigned int *hp) +{ + if(fseek(fp,0,SEEK_SET) != 0) + PCX_RETURN_ERROR("Error setting file pointer\n"); + if(fread(&PCX_HEADER, 128, 1, fp) != 1) + PCX_RETURN_ERROR("Error reading first 128 bytes of PCX file\n"); + if(fseek(fp,0,SEEK_SET) != 0) + PCX_RETURN_ERROR("Error setting file pointer\n"); + + if(fread(&PCX_HEADER, 128, 1, fp) != 1) + PCX_RETURN_ERROR("Error reading file header\n"); + + if(PCX_HEADER.manufacturer != 10) + PCX_RETURN_ERROR("Not a PCX image\n"); + + if(PCX_HEADER.encoding != 1) + PCX_RETURN_ERROR("Invalid encoding\n"); + +/* PCX is little-endian. If machine is big-endian, swap bytes.. */ +#if BYTE_ORDER == BIG_ENDIAN + PCX_HEADER.xend = swap_word(PCX_HEADER.xend); + PCX_HEADER.xstart = swap_word(PCX_HEADER.xstart); + PCX_HEADER.yend = swap_word(PCX_HEADER.yend); + PCX_HEADER.ystart = swap_word(PCX_HEADER.ystart); + PCX_HEADER.hres = swap_word(PCX_HEADER.hres); + PCX_HEADER.vres = swap_word(PCX_HEADER.vres); + PCX_HEADER.bpl = swap_word(PCX_HEADER.bpl); + PCX_HEADER.paletteinfo = swap_word(PCX_HEADER.paletteinfo); +#endif /* BYTE_ORDER == BIG_ENDIAN */ + //Calculate the width and height + *wp = (PCX_HEADER.xend-PCX_HEADER.xstart)+1; + *hp = (PCX_HEADER.yend-PCX_HEADER.ystart)+1; + *numpagesp = 1; + return PCX_ERR_NO_ERROR; +err: + return PCX_ERR_GENERIC; +} + +static pcx_err_t pcx_load_image_fp(FILE *fp, unsigned int page, unsigned char * rgb, int bytes_per_line) +{ + urgb palette[256]; + long pos2; + int tmp = 0; + int h; + long line_bytes; + int image_w; + int image_h; + long bitmap_size; + int padding; + long pos, count; + unsigned char repeat, value; + int FLAG_MASK = 192; //11000000 + int REVERSE_MASK = 63; //00111111 + int plane, i; + + if(fseek(fp,0,SEEK_SET) != 0) + PCX_RETURN_ERROR("Error setting file pointer\n"); + if(fread(&PCX_HEADER, 128, 1, fp) != 1) + PCX_RETURN_ERROR("Error reading file header\n"); + + if(PCX_HEADER.manufacturer != 10) + PCX_RETURN_ERROR("Not a PCX image\n"); + if(PCX_HEADER.encoding != 1) + PCX_RETURN_ERROR("Invalid encoding\n"); + +/* PCX is little-endian. If machine is big-endian, swap bytes.. */ +#if BYTE_ORDER == BIG_ENDIAN + PCX_HEADER.xend = swap_word(PCX_HEADER.xend); + PCX_HEADER.xstart = swap_word(PCX_HEADER.xstart); + PCX_HEADER.yend = swap_word(PCX_HEADER.yend); + PCX_HEADER.ystart = swap_word(PCX_HEADER.ystart); + PCX_HEADER.hres = swap_word(PCX_HEADER.hres); + PCX_HEADER.vres = swap_word(PCX_HEADER.vres); + PCX_HEADER.bpl = swap_word(PCX_HEADER.bpl); + PCX_HEADER.paletteinfo = swap_word(PCX_HEADER.paletteinfo); +#endif /* BYTE_ORDER == BIG_ENDIAN */ + + PALETTE_DEFINED = 0; + COLORMAP_DEFINED = 0; + pos2 = ftell(fp); + if(fseek(fp, -769, SEEK_END) != 0) + PCX_RETURN_ERROR("Error setting file pointer\n"); + + h = fread(&tmp, 1, 1, fp); + if(h != 1) PCX_RETURN_ERROR("Error reading from file\n"); + + if(tmp == 12) + { + //fprintf(stderr, "Reading palette\n"); + //check the first color is black + h = fread(&palette[0].red, 1, 1, fp); + if(h != 1) PCX_RETURN_ERROR("Error reading palette information\n"); + h = fread(&palette[0].green, 1, 1, fp); + if(h != 1) PCX_RETURN_ERROR("Error reading palette information\n"); + h = fread(&palette[0].blue, 1, 1, fp); + if(h != 1) PCX_RETURN_ERROR("Error reading palette information\n"); + if(palette[0].red == 0 && palette[0].blue == 0 && palette[0].green == 0) + { + for(h = 1; h < 256; h++) + { + if(fread(&palette[h].red, 1, 1, fp) != 1) + PCX_RETURN_ERROR("Error reading palette information\n"); + if(fread(&palette[h].green, 1, 1, fp) != 1) + PCX_RETURN_ERROR("Error reading palette information\n"); + if(fread(&palette[h].blue, 1, 1, fp) != 1) + PCX_RETURN_ERROR("Error reading palette information\n"); + } + PALETTE_DEFINED = 1; + //file_size -= 769; //exclude palette data from image data + } + } + if(fseek(fp, pos2, SEEK_SET) != 0) + PCX_RETURN_ERROR("Error setting file pointer\n"); + + line_bytes = PCX_HEADER.bpl*PCX_HEADER.planes; + image_w = (PCX_HEADER.xend-PCX_HEADER.xstart)+1; + image_h = (PCX_HEADER.yend-PCX_HEADER.ystart)+1; + bitmap_size = image_w*image_h*3; + padding = (line_bytes*(8/PCX_HEADER.bpp))-(image_w*PCX_HEADER.planes); + //fprintf(stderr, "padding=%d, size=%d\n", padding, bitmap_size); + pos = 0; count = 0; + if(PCX_HEADER.planes != 1) + plane = 0; //0=RED 1=GREEN 2=BLUE 3=ALPHA 4=SINGLE PLANE + else plane = 4; + + while(pos < bitmap_size) + { + h = fread(&value, 1, 1, fp); + //fprintf(stderr, "size=%d, pos=%d\n", bitmap_size, pos); + if(h != 1) value = 0; + //PCX_RETURN_ERROR("Error reading pixel value from file\n"); + if((value & FLAG_MASK) == FLAG_MASK) //RLE code + { + repeat = (value & REVERSE_MASK); + h = fread(&value, 1, 1, fp); + if(h != 1) PCX_RETURN_ERROR("Error reading pixel value from file\n"); + for(h = 0; h < repeat; h++) + { + switch(PCX_HEADER.bpp) + { + ///////////////////////////////////// + //8 bits per pixel + //////////////////////////////////// + case(8): + if(plane == 0) *(rgb+pos ) = value; //red + else if(plane == 1) *(rgb+pos+1) = value; //green + else if(plane == 2) *(rgb+pos+2) = value; //blue + else if(plane == 3) ; //alpha-not used + else if(plane == 4) + { + if(COLORMAP_DEFINED) + { + *(rgb+pos ) = PCX_HEADER.colormap[value].red; + *(rgb+pos+1) = PCX_HEADER.colormap[value].green; + *(rgb+pos+2) = PCX_HEADER.colormap[value].blue; + } + else if(PALETTE_DEFINED) + { + *(rgb+pos ) = palette[value].red; + *(rgb+pos+1) = palette[value].green; + *(rgb+pos+2) = palette[value].blue; + } + else + { + *(rgb+pos ) = value; + *(rgb+pos+1) = value; + *(rgb+pos+2) = value; + } + } + pos+=3; count++; + if(count >= image_w) + { + if(plane < PCX_HEADER.planes-1) + { + plane++; pos -= (image_w*3); + } + else if(plane == PCX_HEADER.planes-1) + { + if(pos >= bitmap_size) break; + if(padding) + h += padding; + plane = 0; + } + else + { + //fprintf(stderr, "h=%d, repeat=%d, pos=%d, count=%d\n", h, repeat, pos, count); + if(pos >= bitmap_size) break; + if(padding) + h += padding; + } + count = 0; + } + break; + ///////////////////////////////////// + //4 bits per pixel + //////////////////////////////////// + case(4): + if(COLORMAP_DEFINED) + { + *(rgb+pos ) = PCX_HEADER.colormap[value&240].red; + *(rgb+pos+1) = PCX_HEADER.colormap[value&240].green; + *(rgb+pos+2) = PCX_HEADER.colormap[value&240].blue; + *(rgb+pos+3) = PCX_HEADER.colormap[value&15].red; + *(rgb+pos+4) = PCX_HEADER.colormap[value&15].green; + *(rgb+pos+5) = PCX_HEADER.colormap[value&15].blue; + } + else if(PALETTE_DEFINED) + { + *(rgb+pos ) = palette[value&240].red; + *(rgb+pos+1) = palette[value&240].green; + *(rgb+pos+2) = palette[value&240].blue; + *(rgb+pos+3) = palette[value&15].red; + *(rgb+pos+4) = palette[value&15].green; + *(rgb+pos+5) = palette[value&15].blue; + } + pos+=6; count+=2; + if(count >= image_w) + { + if(pos >= bitmap_size) break; + if(padding) + h += padding; + count = 0; + } + break; + ///////////////////////////////////// + //2 bits per pixel + //////////////////////////////////// + case(2): + if(COLORMAP_DEFINED) + { + *(rgb+pos ) = PCX_HEADER.colormap[value&192].red; + *(rgb+pos+1 ) = PCX_HEADER.colormap[value&192].green; + *(rgb+pos+2 ) = PCX_HEADER.colormap[value&192].blue; + *(rgb+pos+3 ) = PCX_HEADER.colormap[value&48].red; + *(rgb+pos+4 ) = PCX_HEADER.colormap[value&48].green; + *(rgb+pos+5 ) = PCX_HEADER.colormap[value&48].blue; + *(rgb+pos+6 ) = PCX_HEADER.colormap[value&12].red; + *(rgb+pos+7 ) = PCX_HEADER.colormap[value&12].green; + *(rgb+pos+8 ) = PCX_HEADER.colormap[value&12].blue; + *(rgb+pos+9 ) = PCX_HEADER.colormap[value&3].red; + *(rgb+pos+10) = PCX_HEADER.colormap[value&3].green; + *(rgb+pos+11) = PCX_HEADER.colormap[value&3].blue; + } + else if(PALETTE_DEFINED) + { + *(rgb+pos ) = palette[value&192].red; + *(rgb+pos+1 ) = palette[value&192].green; + *(rgb+pos+2 ) = palette[value&192].blue; + *(rgb+pos+3 ) = palette[value&48].red; + *(rgb+pos+4 ) = palette[value&48].green; + *(rgb+pos+5 ) = palette[value&48].blue; + *(rgb+pos+6 ) = palette[value&12].red; + *(rgb+pos+7 ) = palette[value&12].green; + *(rgb+pos+8 ) = palette[value&12].blue; + *(rgb+pos+9 ) = palette[value&3].red; + *(rgb+pos+10) = palette[value&3].green; + *(rgb+pos+11) = palette[value&3].blue; + } + pos+=12; count+=4; + if(count >= image_w) + { + if(pos >= bitmap_size) break; + if(padding) + h += padding; + count = 0; + } + break; + ///////////////////////////////////// + //1 bit per pixel + //////////////////////////////////// + case(1): + *(rgb+pos ) = (value & 128) ? 255 : 0; //pixel 1 RED + *(rgb+pos+3 ) = (value & 64) ? 255 : 0; //pixel 2 RED + *(rgb+pos+6 ) = (value & 32) ? 255 : 0; //... + *(rgb+pos+9 ) = (value & 16) ? 255 : 0; + *(rgb+pos+12) = (value & 8) ? 255 : 0; + *(rgb+pos+15) = (value & 4) ? 255 : 0; + *(rgb+pos+18) = (value & 2) ? 255 : 0; + *(rgb+pos+21) = (value & 1) ? 255 : 0; + *(rgb+pos+1 ) = *(rgb+pos ); //pixel 1 GREEN + *(rgb+pos+4 ) = *(rgb+pos+3 ); //pixel 2 GREEN + *(rgb+pos+7 ) = *(rgb+pos+6 ); //... + *(rgb+pos+10) = *(rgb+pos+9 ); + *(rgb+pos+13) = *(rgb+pos+12); + *(rgb+pos+16) = *(rgb+pos+15); + *(rgb+pos+19) = *(rgb+pos+18); + *(rgb+pos+22) = *(rgb+pos+21); + *(rgb+pos+2 ) = *(rgb+pos ); //pixel 1 BLUE + *(rgb+pos+5 ) = *(rgb+pos+3 ); //pixel 2 BLUE + *(rgb+pos+8 ) = *(rgb+pos+6 ); //... + *(rgb+pos+11) = *(rgb+pos+9 ); + *(rgb+pos+14) = *(rgb+pos+12); + *(rgb+pos+17) = *(rgb+pos+15); + *(rgb+pos+20) = *(rgb+pos+18); + *(rgb+pos+23) = *(rgb+pos+21); + pos+=24; count+=8; + if(count >= image_w) + { + if(pos >= bitmap_size) break; + if(padding) + h += padding; + count = 0; + } + break; + } + }//end for + } + else + { + switch(PCX_HEADER.bpp) + { + ///////////////////////////////////// + //8 bits per pixel + //////////////////////////////////// + case(8): + if(plane == 0) *(rgb+pos ) = value; //red + else if(plane == 1) *(rgb+pos+1) = value; //green + else if(plane == 2) *(rgb+pos+2) = value; //blue + else if(plane == 3) ; //alpha - not used + else if(plane == 4) + { + if(COLORMAP_DEFINED) + { + *(rgb+pos ) = PCX_HEADER.colormap[value].red; + *(rgb+pos+1) = PCX_HEADER.colormap[value].green; + *(rgb+pos+2) = PCX_HEADER.colormap[value].blue; + } + else if(PALETTE_DEFINED) + { + *(rgb+pos ) = palette[value].red; + *(rgb+pos+1) = palette[value].green; + *(rgb+pos+2) = palette[value].blue; + } + else + { + *(rgb+pos ) = value; + *(rgb+pos+1) = value; + *(rgb+pos+2) = value; + } + } + pos+=3; count++; + if(count >= image_w) + { + if(plane < PCX_HEADER.planes-1) + { + plane++; pos -= (image_w*3); + } + else if(plane == PCX_HEADER.planes-1) + { + if(pos >= bitmap_size) break; + if(padding) + for(i = 0; i < padding; i++) + { + if(fread(&value, 1, 1, fp) != 1) + PCX_RETURN_ERROR("Error reading from file\n"); + } + plane = 0; + } + else + { + //fprintf(stderr, "size=%d, pos=%d, count=%d\n", bitmap_size, pos, count); + if(pos >= bitmap_size) break; + /*if(padding) + for(i = 0; i < padding; i++) + { + if(fread(&value, 1, 1, fp) != 1) + PCX_RETURN_ERROR("Error reading from file\n"); + }*/ + } + count = 0; + } + break; + ///////////////////////////////////// + //4 bits per pixel + //////////////////////////////////// + case(4): + if(COLORMAP_DEFINED) + { + *(rgb+pos ) = PCX_HEADER.colormap[value&240].red; + *(rgb+pos+1) = PCX_HEADER.colormap[value&240].green; + *(rgb+pos+2) = PCX_HEADER.colormap[value&240].blue; + *(rgb+pos+3) = PCX_HEADER.colormap[value&15].red; + *(rgb+pos+4) = PCX_HEADER.colormap[value&15].green; + *(rgb+pos+5) = PCX_HEADER.colormap[value&15].blue; + } + else if(PALETTE_DEFINED) + { + *(rgb+pos ) = palette[value&240].red; + *(rgb+pos+1) = palette[value&240].green; + *(rgb+pos+2) = palette[value&240].blue; + *(rgb+pos+3) = palette[value&15].red; + *(rgb+pos+4) = palette[value&15].green; + *(rgb+pos+5) = palette[value&15].blue; + } + pos+=6; count+=2; + if(count >= image_w) + { + if(pos >= bitmap_size) break; + /*if(padding) + for(i = 0; i < padding; i++) + { + if(fread(&value, 1, 1, fp) != 1) + PCX_RETURN_ERROR("Error reading from file\n"); + }*/ + count = 0; + } + break; + ///////////////////////////////////// + //2 bits per pixel + //////////////////////////////////// + case(2): + if(COLORMAP_DEFINED) + { + *(rgb+pos ) = PCX_HEADER.colormap[value&192].red; + *(rgb+pos+1 ) = PCX_HEADER.colormap[value&192].green; + *(rgb+pos+2 ) = PCX_HEADER.colormap[value&192].blue; + *(rgb+pos+3 ) = PCX_HEADER.colormap[value&48].red; + *(rgb+pos+4 ) = PCX_HEADER.colormap[value&48].green; + *(rgb+pos+5 ) = PCX_HEADER.colormap[value&48].blue; + *(rgb+pos+6 ) = PCX_HEADER.colormap[value&12].red; + *(rgb+pos+7 ) = PCX_HEADER.colormap[value&12].green; + *(rgb+pos+8 ) = PCX_HEADER.colormap[value&12].blue; + *(rgb+pos+9 ) = PCX_HEADER.colormap[value&3].red; + *(rgb+pos+10) = PCX_HEADER.colormap[value&3].green; + *(rgb+pos+11) = PCX_HEADER.colormap[value&3].blue; + } + else if(PALETTE_DEFINED) + { + *(rgb+pos ) = palette[value&192].red; + *(rgb+pos+1 ) = palette[value&192].green; + *(rgb+pos+2 ) = palette[value&192].blue; + *(rgb+pos+3 ) = palette[value&48].red; + *(rgb+pos+4 ) = palette[value&48].green; + *(rgb+pos+5 ) = palette[value&48].blue; + *(rgb+pos+6 ) = palette[value&12].red; + *(rgb+pos+7 ) = palette[value&12].green; + *(rgb+pos+8 ) = palette[value&12].blue; + *(rgb+pos+9 ) = palette[value&3].red; + *(rgb+pos+10) = palette[value&3].green; + *(rgb+pos+11) = palette[value&3].blue; + } + pos+=12; count+=4; + if(count >= image_w) + { + if(pos >= bitmap_size) break; + /*if(padding) + for(i = 0; i < padding; i++) + { + if(fread(&value, 1, 1, fp) != 1) + PCX_RETURN_ERROR("Error reading from file\n"); + }*/ + count = 0; + } + break; + ///////////////////////////////////// + //1 bit per pixel + //////////////////////////////////// + case(1): + *(rgb+pos ) = (value & 128) ? 255 : 0; //pixel 1 RED + *(rgb+pos+3 ) = (value & 64) ? 255 : 0; //pixel 2 RED + *(rgb+pos+6 ) = (value & 32) ? 255 : 0; //... + *(rgb+pos+9 ) = (value & 16) ? 255 : 0; + *(rgb+pos+12) = (value & 8) ? 255 : 0; + *(rgb+pos+15) = (value & 4) ? 255 : 0; + *(rgb+pos+18) = (value & 2) ? 255 : 0; + *(rgb+pos+21) = (value & 1) ? 255 : 0; + *(rgb+pos+1 ) = *(rgb+pos ); //pixel 1 GREEN + *(rgb+pos+4 ) = *(rgb+pos+3 ); //pixel 2 GREEN + *(rgb+pos+7 ) = *(rgb+pos+6 ); //... + *(rgb+pos+10) = *(rgb+pos+9 ); + *(rgb+pos+13) = *(rgb+pos+12); + *(rgb+pos+16) = *(rgb+pos+15); + *(rgb+pos+19) = *(rgb+pos+18); + *(rgb+pos+22) = *(rgb+pos+21); + *(rgb+pos+2 ) = *(rgb+pos ); //pixel 1 BLUE + *(rgb+pos+5 ) = *(rgb+pos+3 ); //pixel 2 BLUE + *(rgb+pos+8 ) = *(rgb+pos+6 ); //... + *(rgb+pos+11) = *(rgb+pos+9 ); + *(rgb+pos+14) = *(rgb+pos+12); + *(rgb+pos+17) = *(rgb+pos+15); + *(rgb+pos+20) = *(rgb+pos+18); + *(rgb+pos+23) = *(rgb+pos+21); + pos+=24; count+=8; + if(count >= image_w) + { + if(pos >= bitmap_size) break; + /*if(padding) + for(i = 0; i < padding; i++) + { + if(fread(&value, 1, 1, fp) != 1) + PCX_RETURN_ERROR("Error reading from file\n"); + }*/ + count = 0; + } + break; + } + } + }//end while + + return PCX_ERR_NO_ERROR; +err: + return PCX_ERR_GENERIC; +} +/* ---------------------------------------------------------------------- */ +/* load */ + +struct pcx_state { + FILE *fp; + int w; /* image width: 1... */ + int h; /* image height: 1... */ + int np; /* number of pages: 1... */ + size_t flen; /* file length */ + fim_byte_t*rgb; /* pixels, from upper left to lower right, line by line */ + int bytes_per_line; /* rgb has bytes_per_line bytes per line */ +}; + +static void* +pcx_init(FILE *fp, const fim_char_t *filename, unsigned int page, struct ida_image_info *i, int thumbnail) +{ + /* it is safe to ignore filename, page, thumbnail */ + struct pcx_state *h = FIM_NULL; + pcx_err_t errval = PCX_ERR_GENERIC; + + h = (struct pcx_state *)fim_calloc(1,sizeof(*h)); + + if(!h) + goto oops; + + h->fp = fp; + + if(fseek(h->fp,0,SEEK_END)!=0) + goto oops; + + if((h->flen=ftell(h->fp))==(unsigned)-1) + goto oops; + + errval = pcx_load_image_info_fp(h->fp, &h->np, &i->width, &i->height); + if(errval != PCX_ERR_NO_ERROR) + { + std::cerr << "Failed pcx_load_image_info_fp !\n"; + goto oops; + } + + i->npages = 1; + h->w = i->width; + h->h = i->height; + h->bytes_per_line = i->width * 3; + h->rgb = (fim_byte_t*)fim_malloc(i->height * h->bytes_per_line ); + if(!h->rgb) + { + std::cerr << "Failed fim_malloc!\n"; + goto oops; + } + + errval = pcx_load_image_fp(h->fp, page, h->rgb, h->bytes_per_line); + if(errval != PCX_ERR_NO_ERROR) + { + std::cerr << "Failed pcx_load_image_fp!\n"; + goto oops; + } + + return h; +oops: + if(h) + { + if(h->rgb) + fim_free(h->rgb); + fim_free(h); + } + return FIM_NULL; +} + +static void +pcx_read(fim_byte_t *dst, unsigned int line, void *data) +{ + struct pcx_state *h = (struct pcx_state *) data; + int c; + + for (c=0;cw;++c) + { + dst[c*3+0] = h->rgb[h->bytes_per_line*line+c*3+0]; + dst[c*3+1] = h->rgb[h->bytes_per_line*line+c*3+1]; + dst[c*3+2] = h->rgb[h->bytes_per_line*line+c*3+2]; + } +} + +static void +pcx_done(void *data) +{ + struct pcx_state *h = (struct pcx_state *) data; + + fclose(h->fp); + fim_free(h->rgb); + fim_free(h); +} + +struct ida_loader pcx_loader = { +/* + * 0000000: 0a05 0108 0000 0000 ff03 5702 2c01 2c01 ..........W.,.,. + */ + /*magic:*/ "\012", + /*moff:*/ 0, + /*mlen:*/ 1, + /*name:*/ "pcx", + /*init:*/ pcx_init, + /*read:*/ pcx_read, + /*done:*/ pcx_done, +}; + +static void __init init_rd(void) +{ + fim_load_register(&pcx_loader); +} + +} +#endif /* FIM_WITH_PCX */ diff --git a/src/FbiStuffPdf.cpp b/src/FbiStuffPdf.cpp new file mode 100644 index 0000000..24f4d6e --- /dev/null +++ b/src/FbiStuffPdf.cpp @@ -0,0 +1,295 @@ +/* $LastChangedDate: 2015-12-19 01:44:41 +0100 (Sat, 19 Dec 2015) $ */ +/* + FbiStuffPdf.cpp : fim functions for decoding PDF files + + (c) 2008-2015 Michele Martone + based on code (c) 1998-2006 Gerd Knorr + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/* + * this code should be fairly correct, although unfinished + * */ + +#include +#include +#include + +#include "FbiStuff.h" +#include "FbiStuffLoader.h" + +#ifdef HAVE_LIBPOPPLER + +/* + * Note : at the time of writing this, the poppler API is unstable, + * and subject to change. + * So when changing these headers here, take care of changing them + * in the configure script, too. + * And please don't blame me (fim's author)! + */ +#include +#if (POPPLER_VERSION_MINOR>=21) +#if (POPPLER_VERSION_MINOR< 24) +#include +#include +#else +#include +#include +#endif /* (POPPLER_VERSION_MINOR< 24) */ +#include +#include +#include +#include +#include +#include /* globalParams lives here */ +#endif /* (POPPLER_VERSION_MINOR>=21) */ + +#if HAVE_FILENO +#define FIM_PDF_USE_FILENO 1 +#else +#define FIM_PDF_USE_FILENO 0 +#endif /* HAVE_FILENO */ + +/* */ + +namespace fim +{ +extern CommandConsole cc; + +/* ---------------------------------------------------------------------- */ +/* load */ + +struct pdf_state_t { + SplashBitmap* bmp ; + PDFDoc * pd ; + SplashOutputDev * od ; + int row_stride; /* physical row width in output buffer */ + fim_byte_t * first_row_dst; +}; + + +/* ---------------------------------------------------------------------- */ + +static SplashColor splashColRed; +static SplashColor splashColGreen; +static SplashColor splashColBlue; +static SplashColor splashColWhite; +static SplashColor splashColBlack; +//static SplashColorMode gSplashColorMode = splashModeBGR8; +static SplashColorMode gSplashColorMode = splashModeRGB8; +#define SPLASH_COL_RED_PTR (SplashColorPtr)&(splashColRed[0]) +#define SPLASH_COL_GREEN_PTR (SplashColorPtr)&(splashColGreen[0]) +#define SPLASH_COL_BLUE_PTR (SplashColorPtr)&(splashColBlue[0]) +#define SPLASH_COL_WHITE_PTR (SplashColorPtr)&(splashColWhite[0]) +#define SPLASH_COL_BLACK_PTR (SplashColorPtr)&(splashColBlack[0]) + +static SplashColorPtr gBgColor = SPLASH_COL_WHITE_PTR; + +static void splashColorSet(SplashColorPtr col, Guchar red, Guchar green, Guchar blue, Guchar alpha) +{ + switch (gSplashColorMode) + { + case splashModeBGR8: + col[0] = blue; + col[1] = green; + col[2] = red; + break; + case splashModeRGB8: + col[0] = red; + col[1] = green; + col[2] = blue; + break; + default: + assert(0); + break; + } +} + +void SplashColorsInit(void) +{ + splashColorSet(SPLASH_COL_RED_PTR, 0xff, 0, 0, 0); + splashColorSet(SPLASH_COL_GREEN_PTR, 0, 0xff, 0, 0); + splashColorSet(SPLASH_COL_BLUE_PTR, 0, 0, 0xff, 0); + splashColorSet(SPLASH_COL_BLACK_PTR, 0, 0, 0, 0); + splashColorSet(SPLASH_COL_WHITE_PTR, 0xff, 0xff, 0xff, 0); +} + +static void* +pdf_init(FILE *fp, const fim_char_t *filename, unsigned int page, + struct ida_image_info *i, int thumbnail) +{ + fim_char_t _[1]; + _[0]='\0'; + struct pdf_state_t * ds=FIM_NULL; + int rotation=0,pageNo=page+1; + double zoomReal=100.0; + double hDPI; + double vDPI; + GBool useMediaBox ; + GBool crop ; + GBool doLinks ; + fim_int prd=cc.getIntVariable(FIM_VID_PREFERRED_RENDERING_DPI); + prd=prd<1?FIM_RENDERING_DPI:prd; + + if(filename==std::string(FIM_STDIN_IMAGE_NAME)) + { + std::cerr<<"sorry, stdin multipage file reading is not supported\n"; + goto retnull; + } /* a drivers's problem */ + +#if !FIM_PDF_USE_FILENO + if(fp) fclose(fp); +#else + if(fp) + { + // FIXME: this hack will only work on Linux. + static fim_char_t linkname[FIM_LINUX_LINKFILENAME_BUFSIZE]; + sprintf(linkname,"/proc/self/fd/%d",fileno(fp)); + //printf("%s\n",linkname); + filename=linkname; + if(-1==access(filename,R_OK)) + return FIM_NULL; + } +#endif /* FIM_PDF_USE_FILENO */ + + + ds = (struct pdf_state_t*)fim_calloc(1,sizeof(struct pdf_state_t)); + + if(!ds) + return FIM_NULL; + + ds->first_row_dst = FIM_NULL; + ds->bmp = FIM_NULL; + ds->pd = FIM_NULL; + ds->od = FIM_NULL; + + SplashColorsInit(); + + // WARNING : a global variable from libpoppler! damn!! + globalParams = new GlobalParams(); + if (!globalParams) + goto err; + + globalParams->setErrQuiet(gFalse); + +#if defined(POPPLER_VERSION_MINOR) && (POPPLER_VERSION_MINOR<22) + globalParams->setBaseDir(_); +#endif /* defined(POPPLER_VERSION_MINOR) && (POPPLER_VERSION_MINOR<22) */ + + ds->pd = new PDFDoc(new GooString(filename), FIM_NULL, FIM_NULL, (void*)FIM_NULL); + if (!ds->pd) + goto err; + + if (!ds->pd->isOk()) + goto err; + + if (!ds->od) + { + GBool bitmapTopDown = gTrue; + ds->od = new SplashOutputDev(gSplashColorMode, /*4*/3, gFalse, gBgColor, bitmapTopDown,gFalse/*antialias*/); + if (ds->od) +#ifdef POPPLER_VERSION /* as of 0.20.2, from poppler/poppler-config.h */ + /* FIXME: this is an incomplete fix (triggered on 20120719's email on fim-devel); + I don't really know which version of poppler defines this macro first, but I assume 0.20.2 or so */ + ds->od->startDoc(ds->pd); +#else /* POPPLER_VERSION */ + ds->od->startDoc(ds->pd->getXRef()); +#endif /* POPPLER_VERSION */ + } + if (!ds->od) + goto err; + + i->dpi = prd; + hDPI = (double)i->dpi* (zoomReal * 0.01); + vDPI = (double)i->dpi* (zoomReal * 0.01); + + useMediaBox = gFalse; + crop = gTrue; + doLinks = gTrue; + + i->npages = ds->pd->getNumPages(); + if(page>=i->npages || page<0)goto err; + + ds->pd->displayPage(ds->od, pageNo, hDPI, vDPI, rotation, useMediaBox, crop, doLinks, FIM_NULL, FIM_NULL); + + + if(!ds->pd) goto err; + + ds->bmp = ds->od->takeBitmap(); + if(!ds->bmp) goto err; + + i->width = ds->bmp->getWidth(); + i->height = ds->bmp->getHeight(); + + return ds; +err: + + if(ds->pd) delete ds->pd ; + if(ds->od) delete ds->od ; + if (globalParams) delete globalParams; + globalParams = FIM_NULL; + if(ds)fim_free(ds); +retnull: + return FIM_NULL; +} + +static void +pdf_read(fim_byte_t *dst, unsigned int line, void *data) +{ + struct pdf_state_t *ds = (struct pdf_state_t*)data; + if(!ds)return; + + if(ds->first_row_dst == FIM_NULL) + ds->first_row_dst = dst; + else return; + + memcpy(dst,ds->bmp->getDataPtr(),ds->bmp->getHeight()*ds->bmp->getWidth()*3); +} + +static void +pdf_done(void *data) +{ + struct pdf_state_t *ds = (struct pdf_state_t*)data; + if(!ds) return; + + if(ds->pd) delete ds->pd ; + if(ds->od) delete ds->od ; + if (globalParams) delete globalParams; + globalParams = FIM_NULL; + + fim_free(ds); +} + +/* +0000000: 2550 4446 2d31 2e34 0a25 d0d4 c5d8 0a35 %PDF-1.4.%.....5 +*/ +static struct ida_loader pdf_loader = { + /*magic:*/ "%PDF-",// FI/*XME :*/ are sure this is enough ? + /*moff:*/ 0, + /*mlen:*/ 5, + /*name:*/ "libpoppler", + /*init:*/ pdf_init, + /*read:*/ pdf_read, + /*done:*/ pdf_done, +}; + +static void __init init_rd(void) +{ + fim_load_register(&pdf_loader); +} + +} +#endif // ifdef HAVE_LIBPOPPLER diff --git a/src/FbiStuffPng.cpp b/src/FbiStuffPng.cpp new file mode 100644 index 0000000..7e90e0c --- /dev/null +++ b/src/FbiStuffPng.cpp @@ -0,0 +1,366 @@ +/* $LastChangedDate: 2015-12-19 01:44:41 +0100 (Sat, 19 Dec 2015) $ */ +/* + FbiStuffPng.cpp : fbi functions for PNG files, modified for fim + + (c) 2008-2015 Michele Martone + (c) 1998-2006 Gerd Knorr + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +/* + * This file comes from fbi, and will undergo severe reorganization. + * */ + +#include +#include +#include +#include +#include + +//#include "loader.h" +#include "FbiStuff.h" +#include "FbiStuffLoader.h" +#ifdef USE_X11 +# include "viewer.h" +#endif /* USE_X11 */ +namespace fim +{ + + +static const fim_char_t *ct[] = { + "gray", "X1", "rgb", "palette", + "graya", "X5", "rgba", "X7", +}; + +struct fim_png_state { + FILE *infile; + png_structp png; + png_infop info; + png_bytep image; + png_uint_32 w,h; + int color_type; + struct ida_image_info *i; + char * cmt; +}; + +static FILE*fim_png_fp; +void PNGAPI fim_png_rw_ptr(png_structp s, png_bytep p, png_size_t l) +{ + fim_fread(p, l, 1, fim_png_fp); +} + +void fim_png_rd_cmts(void *data, png_infop info) +#ifdef PNG_WRITE_tEXt_SUPPORTED + { + struct fim_png_state *h = (struct fim_png_state *) data; + png_textp text_ptr = FIM_NULL; + int num_comments = png_get_text(h->png, info, &text_ptr, FIM_NULL); + int ti = 0; + fim::string fs; + + for (ti=0;ti 1 ) + fs+=" "; + } + } + + if(num_comments>0) + if(fs.c_str() && strlen(fs.c_str())) + { + const char * s = fs.c_str(); + + if(!h->cmt) + h->cmt = (char*) calloc(strlen(s)+1,1); + else + { + h->cmt = (char*) realloc(h->cmt,strlen(h->cmt)+strlen(s)+1); + if(h->cmt) + strcat(h->cmt," "); + } + + if(h->cmt) + { + strcat(h->cmt,s); + } + } + } +#else + { + } +#endif + +static void* +png_init(FILE *fp, const fim_char_t *filename, unsigned int page, + struct ida_image_info *i, int thumbnail) +{ + struct fim_png_state *h; + int bit_depth, interlace_type; + int pass, number_passes; + unsigned int y; + png_uint_32 resx, resy; + /* + png_color_16 *file_bg, my_bg = { + .red = 192, + .green = 192, + .blue = 192, + .gray = 192, + };*/ + png_color_16 *file_bg, my_bg ; + my_bg .red = 192; + my_bg .green = 192; + my_bg .blue = 192; + my_bg .gray = 192; + int unit; + + h = (struct fim_png_state *) fim_calloc(1,sizeof(*h)); + if(!h) goto oops; + + h->infile = fp; + h->i = i; + + h->png = png_create_read_struct(PNG_LIBPNG_VER_STRING, + FIM_NULL, FIM_NULL, FIM_NULL); + if (FIM_NULL == h->png) + goto oops; + h->info = png_create_info_struct(h->png); + if (FIM_NULL == h->info) + goto oops; + + fim_png_fp=fp; +#if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER>=10249) + /* in the above, check on version >=10249 is not sufficient, not necessary. for e.g; 10606 it's necessary */ + png_set_read_fn(h->png,FIM_NULL,fim_png_rw_ptr); /* TODO: shall make use of return second argument */ +#else + h->png->read_data_fn=&fim_png_rw_ptr; +#endif + png_init_io(h->png, h->infile); + png_read_info(h->png, h->info); + png_get_IHDR(h->png, h->info, &h->w, &h->h, + &bit_depth,&h->color_type,&interlace_type, FIM_NULL,FIM_NULL); + png_get_pHYs(h->png, h->info, &resx, &resy, &unit); + i->width = h->w; + i->height = h->h; + if (PNG_RESOLUTION_METER == unit) + i->dpi = res_m_to_inch(resx); + if (FbiStuff::fim_filereading_debug()) + FIM_FBI_PRINTF("png: color_type=%s #1\n",ct[h->color_type]); + i->npages = 1; + + png_set_packing(h->png); + if (bit_depth == 16) + png_set_strip_16(h->png); + if (h->color_type == PNG_COLOR_TYPE_PALETTE) + png_set_palette_to_rgb(h->png); + if (h->color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) +// according to http://www.libpng.org/pub/png/libpng-manual.txt, retrieved 20101129 +#ifdef PNG_LIBPNG_VER + #if (PNG_LIBPNG_VER>=10209) + png_set_expand_gray_1_2_4_to_8(h->png); + #else + png_set_gray_1_2_4_to_8(h->png); + #endif /* PNG_LIBPNG_VER */ +#else + #error need a proper function name for png_set_gray_1_2_4_to_8, here. +#endif /* PNG_LIBPNG_VER */ + if (png_get_bKGD(h->png, h->info, &file_bg)) { + png_set_background(h->png,file_bg,PNG_BACKGROUND_GAMMA_FILE,1,1.0); + } else { + png_set_background(h->png,&my_bg,PNG_BACKGROUND_GAMMA_SCREEN,0,1.0); + } + + number_passes = png_set_interlace_handling(h->png); + png_read_update_info(h->png, h->info); + + h->color_type = png_get_color_type(h->png, h->info); + if (FbiStuff::fim_filereading_debug()) + FIM_FBI_PRINTF("png: color_type=%s #2\n",ct[h->color_type]); + + h->image = (png_byte*)fim_malloc(i->width * i->height * 4); + if(!h->image) goto oops; + + for (pass = 0; pass < number_passes-1; pass++) { + if (FbiStuff::fim_filereading_debug()) + FIM_FBI_PRINTF("png: pass #%d\n",pass); + for (y = 0; y < i->height; y++) { + png_bytep row = h->image + y * i->width * 4; + png_read_rows(h->png, &row, FIM_NULL, 1); + } + } + + fim_png_rd_cmts(h,h->info); + + return h; + + oops: + if (h && h->image) + fim_free(h->image); + if (h->png) + png_destroy_read_struct(&h->png, FIM_NULL, FIM_NULL); + fim_fclose(h->infile); + if(h->cmt) + fim_free(h->cmt); + if(h)fim_free(h); + return FIM_NULL; +} + +static void +png_read(fim_byte_t *dst, unsigned int line, void *data) +{ + struct fim_png_state *h = (struct fim_png_state *) data; + + png_bytep row = h->image + line * h->w * 4; + switch (h->color_type) { + case PNG_COLOR_TYPE_GRAY: + png_read_rows(h->png, &row, FIM_NULL, 1); + load_gray(dst,row,h->w); + break; + case PNG_COLOR_TYPE_RGB: + png_read_rows(h->png, &row, FIM_NULL, 1); + memcpy(dst,row,3*h->w); + break; + case PNG_COLOR_TYPE_RGB_ALPHA: + png_read_rows(h->png, &row, FIM_NULL, 1); + load_rgba(dst,row,h->w); + break; + case PNG_COLOR_TYPE_GRAY_ALPHA: + png_read_rows(h->png, &row, FIM_NULL, 1); + load_graya(dst,row,h->w); + break; + default: + /* shouldn't happen */ + FIM_FBI_PRINTF("Oops: %s:%d\n",__FILE__,__LINE__); + exit(1); + } +} + +static void +png_done(void *data) +{ + struct fim_png_state *h =(struct fim_png_state *) data; + png_infop end_info = png_create_info_struct(h->png); + + png_read_end(h->png, end_info ); + fim_png_rd_cmts(h,end_info); + + if(h->cmt) + { + load_add_extra(h->i,EXTRA_COMMENT,(fim_byte_t*)h->cmt,strlen(h->cmt)); + fim_free(h->cmt); + } + + fim_free(h->image); + png_destroy_read_struct(&h->png, &h->info, FIM_NULL); + fim_fclose(h->infile); + fim_free(h); +} + +//used in FbiStuff.cpp +#ifdef FIM_WITH_LIBPNG +struct ida_loader png_loader +#else +static struct ida_loader png_loader +#endif /* FIM_WITH_LIBPNG */ += { + /*magic:*/ "\x89PNG", + /*moff:*/ 0, + /*mlen:*/ 4, + /*name:*/ "libpng", + /*init:*/ png_init, + /*read:*/ png_read, + /*done:*/ png_done, +}; + +static void __init init_rd(void) +{ + fim_load_register(&png_loader); +} + +#ifdef USE_X11 +/* ---------------------------------------------------------------------- */ +/* save */ + +static int +png_write(FILE *fp, struct ida_image *img) +{ + png_structp png_ptr = FIM_NULL; + png_infop info_ptr = FIM_NULL; + png_bytep row; + unsigned int y; + + /* Create and initialize the png_struct with the desired error handler + * functions. If you want to use the default stderr and longjump based method, + * you can supply FIM_NULL for the last three parameters. We also check that + * the library version is compatible with the one used at compile time, + * in case we are using dynamically linked libraries. REQUIRED. + */ + png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING,FIM_NULL,FIM_NULL,FIM_NULL); + if (png_ptr == FIM_NULL) + goto oops; + + /* Allocate/initialize the image information data. REQUIRED */ + info_ptr = png_create_info_struct(png_ptr); + if (info_ptr == FIM_NULL) + goto oops; + if (setjmp(png_jmpbuf(png_ptr))) + goto oops; + + png_init_io(png_ptr, fp); + png_set_IHDR(png_ptr, info_ptr, img->i.width, img->i.height, 8, + PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, + PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); + if (img->i.dpi) { + png_set_pHYs(png_ptr, info_ptr, + res_inch_to_m(img->i.dpi), + res_inch_to_m(img->i.dpi), + PNG_RESOLUTION_METER); + } + png_write_info(png_ptr, info_ptr); + png_set_packing(png_ptr); + + for (y = 0; y < img->i.height; y++) { + row = img->data + y * 3 * img->i.width; + png_write_rows(png_ptr, &row, 1); + } + png_write_end(png_ptr, info_ptr); + png_destroy_write_struct(&png_ptr, &info_ptr); + return 0; + + oops: + FIM_FBI_PRINTF("can't save image: libpng error\n"); + if (png_ptr) + png_destroy_write_struct(&png_ptr, (png_infopp)FIM_NULL); + return -1; +} + +static struct ida_writer png_writer = { + /*label:*/ "PNG", + /* ext:*/ { "png", FIM_NULL}, + /*write:*/ png_write, +}; + +static void __init init_wr(void) +{ + fim_write_register(&png_writer); +} + + +#endif /* USE_X11 */ +} diff --git a/src/FbiStuffPpm.cpp b/src/FbiStuffPpm.cpp new file mode 100644 index 0000000..566829f --- /dev/null +++ b/src/FbiStuffPpm.cpp @@ -0,0 +1,205 @@ +/* $LastChangedDate: 2017-03-10 19:52:14 +0100 (Fri, 10 Mar 2017) $ */ +/* + FbiStuffPpm.cpp : fbi functions for PPM files, modified for fim + + (c) 2008-2017 Michele Martone + (c) 1998-2006 Gerd Knorr + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +/* + * This file comes from fbi, and will undergo severe reorganization. + * */ + + + +#include +#include +#include +#include + +//#include "loader.h" +#include "fim.h" +#include "FbiStuffLoader.h" +#ifdef USE_X11 +# include "viewer.h" +#endif /* USE_X11 */ + +/* ---------------------------------------------------------------------- */ +/* load */ + +namespace fim +{ + +struct ppm_state { + FILE *infile; + int width,height; + int Maxval; + fim_byte_t *row; +}; + +static void* +pnm_init(FILE *fp, const fim_char_t *filename, unsigned int page, + struct ida_image_info *i, int thumbnail) +{ + struct ppm_state *h; + fim_char_t line[FIM_FBI_PPM_LINEBUFSIZE],*fr; + + h = (struct ppm_state*) fim_calloc(1,sizeof(*h)); + if(!h)return FIM_NULL; + + h->infile = fp; + fr=fgets(line,sizeof(line),fp); /* Px */ + if(!fr)goto oops; + fr=fgets(line,sizeof(line),fp); /* width height */ + if(!fr)goto oops; + while ('#' == line[0]) + { + fr=fgets(line,sizeof(line),fp); /* skip comments */ + if(!fr)goto oops; + } + sscanf(line,"%d %d",&h->width,&h->height); + fr=fgets(line,sizeof(line),fp); /* ??? */ + sscanf(line,"%d",&h->Maxval); + if(!fr)goto oops; + if (0 == h->width || 0 == h->height) + goto oops; + i->width = h->width; + i->height = h->height; + i->npages = 1; + if( h->Maxval < 256 ) + h->row = (fim_byte_t*)fim_malloc(h->width*3*1); // 1 byte read per component + else + h->row = (fim_byte_t*)fim_malloc(h->width*3*2); // 2 bytes read per component (but first taken) + if(!h->row)goto oops; + + return h; + + oops: + fim_fclose(fp); + if(h->row)fim_free(h->row); + if(h)fim_free(h); + return FIM_NULL; +} + +static void +ppm_read(fim_byte_t *dst, unsigned int line, void *data) +{ + struct ppm_state *h = (struct ppm_state *) data; + int fr; + if( h->Maxval < 256 ) + fr=fim_fread(dst,h->width,3,h->infile); + else + { + fim_byte_t *src = h->row; + fr=fim_fread(src,h->width,6,h->infile); + for (int x = 0; x < h->width; x++) + { + dst[3*x+0]=src[2*(3*x+0)]; + dst[3*x+1]=src[2*(3*x+1)]; + dst[3*x+2]=src[2*(3*x+2)]; + } + } + + if(fr){/* FIXME : there should be error handling */} +} + +static void +pgm_read(fim_byte_t *dst, unsigned int line, void *data) +{ + struct ppm_state *h = (struct ppm_state *) data; + fim_byte_t *src; + int x,fr,inc=1; + + if( h->Maxval >= 256 ) + inc=2; + fr=fim_fread(h->row,h->width,inc,h->infile); + if(!fr){/* FIXME : there should be error handling */ return ; } + src = h->row; + for (x = 0; x < h->width; x++) { + dst[0] = src[0]; + dst[1] = src[0]; + dst[2] = src[0]; + dst += 3; + src += inc; + } +} + +static void +pnm_done(void *data) +{ + struct ppm_state *h = (struct ppm_state *) data; + + fim_fclose(h->infile); + fim_free(h->row); + fim_free(h); +} + +struct ida_loader ppm_loader = { + /*magic:*/ "P6", + /*moff:*/ 0, + /*mlen:*/ 2, + /*name:*/ "ppm", + /*init:*/ pnm_init, + /*read:*/ ppm_read, + /*done:*/ pnm_done, +}; + +struct ida_loader pgm_loader = { + /*magic:*/ "P5", + /*moff:*/ 0, + /*mlen:*/ 2, + /*name:*/ "pgm", + /*init:*/ pnm_init, + /*read:*/ pgm_read, + /*done:*/ pnm_done, +}; + +static void __init init_rd(void) +{ + fim_load_register(&ppm_loader); + fim_load_register(&pgm_loader); +} + +#ifdef USE_X11 +/* ---------------------------------------------------------------------- */ +/* save */ + +static int +ppm_write(FILE *fp, struct ida_image *img) +{ + fprintf(fp,"P6\n" + "# written by ida " VERSION "\n" + "# http://bytesex.org/ida/\n" + "%d %d\n255\n", + img->i.width,img->i.height); + fwrite(img->data, img->i.height, 3*img->i.width, fp); + return 0; +} + +static struct ida_writer ppm_writer = { + /*label:*/ "PPM", + /*ext:*/ { "ppm", FIM_NULL}, + /*write:*/ ppm_write, +}; + +static void __init init_wr(void) +{ + fim_write_register(&ppm_writer); +} +#endif /* USE_X11 */ + +} + diff --git a/src/FbiStuffPs.cpp b/src/FbiStuffPs.cpp new file mode 100644 index 0000000..7c160b0 --- /dev/null +++ b/src/FbiStuffPs.cpp @@ -0,0 +1,215 @@ +/* $LastChangedDate: 2017-07-09 15:39:36 +0200 (Sun, 09 Jul 2017) $ */ +/* + FbiStuffPs.cpp : fim functions for decoding PS files + + (c) 2008-2017 Michele Martone + based on code (c) 1998-2006 Gerd Knorr + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/* + * this code should be fairly correct, although unfinished + * */ + +#include +#include +#include + +#include "FbiStuff.h" +#include "FbiStuffLoader.h" + +#ifdef HAVE_LIBSPECTRE + +extern "C" +{ +// we require C linkage for these symbols +#include +} + +/* */ + +namespace fim +{ +extern CommandConsole cc; + +/* ---------------------------------------------------------------------- */ +/* load */ + +struct ps_state_t { + int row_stride; /* physical row width in output buffer */ + fim_byte_t * first_row_dst; + int w,h; + SpectreDocument * sd; + SpectrePage * sp; + SpectreRenderContext * src; + SpectreStatus ss; +}; + + +/* ---------------------------------------------------------------------- */ +#define FIM_SPECTRE_DEFAULT_DPI 72 +static void* +ps_init(FILE *fp, const fim_char_t *filename, unsigned int page, + struct ida_image_info *i, int thumbnail) +{ + fim_int prd=cc.getIntVariable(FIM_VID_PREFERRED_RENDERING_DPI); + prd=prd<1?FIM_RENDERING_DPI:prd; + double scale = 1.0* (((double)prd)/((double)FIM_SPECTRE_DEFAULT_DPI)) ; + double rcscale = scale; + struct ps_state_t * ds=FIM_NULL; + + if(std::string(filename)==FIM_STDIN_IMAGE_NAME){std::cerr<<"sorry, stdin multipage file reading is not supported\n";return FIM_NULL;} /* a drivers's problem */ + if(fp) fclose(fp); + + ds = (struct ps_state_t*)fim_calloc(1,sizeof(struct ps_state_t)); + + if(!ds) + return FIM_NULL; + + ds->first_row_dst = FIM_NULL; + ds->sd = FIM_NULL; + ds->sp = FIM_NULL; + ds->src = FIM_NULL; + ds->ss = SPECTRE_STATUS_SUCCESS; + + ds->sd = spectre_document_new(); + if(!ds->sd) + goto err; + + spectre_document_load(ds->sd,filename); + + ds->ss = spectre_document_status(ds->sd); + if(ds->ss != SPECTRE_STATUS_SUCCESS) + goto err; + + ds->src = spectre_render_context_new(); + if(!ds->src) + goto err; + + i->dpi = FIM_SPECTRE_DEFAULT_DPI; /* FIXME */ + + spectre_render_context_set_scale(ds->src,scale,scale); + spectre_render_context_set_rotation(ds->src,0); + spectre_render_context_set_resolution(ds->src,i->dpi,i->dpi); + + i->npages = spectre_document_get_n_pages(ds->sd); + if(page>=i->npages || page<0)goto err; + + ds->sp = spectre_document_get_page(ds->sd,page);/* pages, from 0 */ + if(!ds->sp) + goto err; + ds->ss = spectre_page_status(ds->sp); + if(ds->ss != SPECTRE_STATUS_SUCCESS) + goto err; + + spectre_page_get_size(ds->sp, (int*)(&i->width), (int*)(&i->height)); +// spectre_render_context_get_page_size(ds->src, (int*)(&i->width), (int*)(&i->height)); +// spectre_document_get_page_size(ds->sd, (int*)(&i->width), (int*)(&i->height)); + + i->width *= scale; + i->height *= scale; + + + spectre_render_context_set_page_size(ds->src, (int)(i->width), (int)(i->height)); + spectre_render_context_set_scale(ds->src,rcscale,rcscale); + + if(i->width<1 || i->height<1) + goto err; + + ds->w=i->width; + ds->h=i->height; + + return ds; + +err: + + if(ds->sd )spectre_document_free(ds->sd); + if(ds->sp )spectre_page_free(ds->sp); + if(ds->src)spectre_render_context_free(ds->src); + if(ds)fim_free(ds); + return FIM_NULL; +} + +static void +ps_read(fim_byte_t *dst, unsigned int line, void *data) +{ + struct ps_state_t *ds = (struct ps_state_t*)data; + if(!ds)return; + + if(ds->first_row_dst == FIM_NULL) + ds->first_row_dst = dst; + else return; + + fim_byte_t *page_data=FIM_NULL; + + //render in RGB32 format + //spectre_page_render(ds->sp,ds->src,&page_data,&ds->row_stride); + spectre_page_render_slice(ds->sp,ds->src,0,0,ds->w,ds->h,&page_data,&ds->row_stride); + + ds->ss = spectre_page_status(ds->sp); + if(ds->ss != SPECTRE_STATUS_SUCCESS) + return; + + int i,j; + for(i=0;ih;++i) + for(j=0;jw;++j) + { +#if 0 + dst[ds->w*i*3+3*j+0]=page_data[ds->row_stride*i+4*j+0]; + dst[ds->w*i*3+3*j+1]=page_data[ds->row_stride*i+4*j+1]; + dst[ds->w*i*3+3*j+2]=page_data[ds->row_stride*i+4*j+2]; +#else + dst[ds->w*i*3+3*j+2]=page_data[ds->row_stride*i+4*j+0]; + dst[ds->w*i*3+3*j+1]=page_data[ds->row_stride*i+4*j+1]; + dst[ds->w*i*3+3*j+0]=page_data[ds->row_stride*i+4*j+2]; +#endif + } + fim_free(page_data); +} + +static void +ps_done(void *data) +{ + struct ps_state_t *ds = (struct ps_state_t*)data; + if(!ds) return; + + if(ds->sd )spectre_document_free(ds->sd); + if(ds->sp )spectre_page_free(ds->sp); + if(ds->src)spectre_render_context_free(ds->src); + + fim_free(ds); +} + +/* +0000000: 2521 5053 2d41 646f 6265 2d33 2e30 0a25 %!PS-Adobe-3.0.% +*/ +static struct ida_loader ps_loader = { + /*magic:*/ "%!PS-",// FI/*XME :*/ are sure this is enough ? + /*moff:*/ 0, + /*mlen:*/ 5, + /*name:*/ "libspectre", + /*init:*/ ps_init, + /*read:*/ ps_read, + /*done:*/ ps_done, +}; + +static void __init init_rd(void) +{ + fim_load_register(&ps_loader); +} + +} +#endif // ifdef HAVE_LIBSPECTRE diff --git a/src/FbiStuffText.cpp b/src/FbiStuffText.cpp new file mode 100644 index 0000000..24f4998 --- /dev/null +++ b/src/FbiStuffText.cpp @@ -0,0 +1,215 @@ +/* $LastChangedDate: 2013-07-04 21:56:00 +0200 (Thu, 04 Jul 2013) $ */ +/* + FbiStuffBitText.cpp : fbi functions for rendering image bytes as text + + (c) 2013-2016 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +/* + * this is basically toy code, so enjoy! + * */ + + +#include "fim.h" + +#if FIM_WANT_TEXT_RENDERING + +#include +#include +#include +#include +#ifdef HAVE_ENDIAN_H +# include +#endif /* HAVE_ENDIAN_H */ + +namespace fim +{ + +extern CommandConsole cc; + +/* ---------------------------------------------------------------------- */ + +typedef unsigned int uint32; +typedef unsigned short uint16; + +/* ---------------------------------------------------------------------- */ +/* load */ + +struct text_state { + FILE *fp; + uint32 w; + uint32 h; + uint32 flen; + struct fs_font *f_; + fim_int fw,fh; + long maxc; + fim_int cw,ch; +}; + +static void* +text_init(FILE *fp, const fim_char_t *filename, unsigned int page, + struct ida_image_info *i, int thumbnail) +{ + struct text_state *h=FIM_NULL; + long ftellr; + fim_int prw=cc.getIntVariable(FIM_VID_PREFERRED_RENDERING_WIDTH); + + prw=prw<1?FIM_BITRENDERING_DEF_WIDTH:prw; + + h = (struct text_state *)fim_calloc(1,sizeof(*h)); + if(!h) + goto oops; + + FontServer::fb_text_init1(FIM_NULL,&(h->f_)); // FIXME : move this outta here + if(!h->f_) + goto oops; + h->fp = fp; + h->fw = h->f_->width; + h->fh = h->f_->height; + + h->cw = prw / h->fw; + + if(fseek(fp,0,SEEK_END)!=0) + goto oops; + ftellr=ftell(fp); + if((ftellr)==-1) + goto oops; + if(ftellr==0) + ftellr=1; /* (artificial) promotion to 1x1 */ + h->maxc = (128*1024*1024)/(3*h->fw*h->fh); + + ftellr = FIM_MIN(h->maxc,ftellr); + /* FIXME: shall make max allocation limit configurable :) */ + h->cw = FIM_MIN(h->cw, ftellr); + + h->ch = ( ( ftellr + h->cw - 1 ) / h->cw ); + + i->width = h->w = /* prw */ h->fw * h->cw; + i->height = h->h = h->ch * h->fh; + return h; + oops: + + if(h && h->f_)fim_free_fs_font(h->f_); + if(h)fim_free(h); + return FIM_NULL; +} + +static void fs_render_fb(fim_byte_t *ptr, int pitch, FSXCharInfo *charInfo, int fs_bpp_, fim_byte_t *data) +{ +/* FIXME: shall produce generic version of this code and move somewhere else */ + +/* + * These preprocessor macros should serve *only* for font handling purposes. + * */ +#define BIT_ORDER BitmapFormatBitOrderMSB +#ifdef BYTE_ORDER +#undef BYTE_ORDER +#endif /* BYTE_ORDER */ +#define BYTE_ORDER BitmapFormatByteOrderMSB +#define SCANLINE_UNIT BitmapFormatScanlineUnit8 +#define SCANLINE_PAD BitmapFormatScanlinePad8 +#define EXTENTS BitmapFormatImageRectMin + +#define SCANLINE_PAD_BYTES 1 +#define GLWIDTHBYTESPADDED(bits, nBytes) \ + ((nBytes) == 1 ? (((bits) + 7) >> 3) /* pad to 1 byte */\ + :(nBytes) == 2 ? ((((bits) + 15) >> 3) & ~1) /* pad to 2 bytes */\ + :(nBytes) == 4 ? ((((bits) + 31) >> 3) & ~3) /* pad to 4 bytes */\ + :(nBytes) == 8 ? ((((bits) + 63) >> 3) & ~7) /* pad to 8 bytes */\ + : 0) + + int row,bit,bpr,x; + + bpr = GLWIDTHBYTESPADDED((charInfo->right - charInfo->left), + SCANLINE_PAD_BYTES); + for (row = 0; row < (charInfo->ascent + charInfo->descent); row++) { + for (x = 0, bit = 0; bit < (charInfo->right - charInfo->left); bit++) { + if (data[bit>>3] & fs_masktab[bit&7]) + // WARNING ! + // fs_setpixel(ptr+x,fs_white_); + ptr[x+0]=0xFF, + ptr[x+1]=0xFF, + ptr[x+2]=0xFF; + x += fs_bpp_; + } + data += bpr; + ptr += pitch; + } + +#undef BIT_ORDER +#undef BYTE_ORDER +#undef SCANLINE_UNIT +#undef SCANLINE_PAD +#undef EXTENTS +#undef SCANLINE_PAD_BYTES +#undef GLWIDTHBYTESPADDED +} + + + +static void +text_read(fim_byte_t *dst, unsigned int line, void *data) +{ + struct text_state *h = (struct text_state *) data; + int fr,cc=0; + + if(line==0) + { + bzero(dst,3*h->h*h->w); + fseek(h->fp, 0,SEEK_SET ); + while( ( fr = fgetc(h->fp) ) != EOF && cc < h->maxc ) + { + fim_byte_t *dstp=dst+3*( (cc/h->cw)*h->fh*h->w + (cc%h->cw)*h->fw); + + if(!isprint(fr)) + fr=' '; + fs_render_fb(dstp, h->w*3 , h->f_->eindex[fr], 3, h->f_->gindex[fr]); + cc++; + } + } +} + +static void +text_done(void *data) +{ + struct text_state *h = (struct text_state *) data; + + fclose(h->fp); + if(h && h->f_)fim_free_fs_font(h->f_); + fim_free(h); +} + +struct ida_loader text_loader = { +/* + not a filetype-specific decoder + */ + /*magic:*/ "", + /*moff:*/ 0, + /*mlen:*/ 0, + /*name:*/ "Text", + /*init:*/ text_init, + /*read:*/ text_read, + /*done:*/ text_done, +}; + +static void __init init_rd(void) +{ + fim_load_register(&text_loader); +} + + +} +#endif /* FIM_WANT_TEXT_RENDERING */ diff --git a/src/FbiStuffTiff.cpp b/src/FbiStuffTiff.cpp new file mode 100644 index 0000000..028d30f --- /dev/null +++ b/src/FbiStuffTiff.cpp @@ -0,0 +1,294 @@ +/* $LastChangedDate: 2015-12-19 01:44:41 +0100 (Sat, 19 Dec 2015) $ */ +/* + FbiStuffTiff.cpp : fbi functions for TIFF files, modified for fim + + (c) 2007-2015 Michele Martone + (c) 1998-2006 Gerd Knorr + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +/* + * This file comes from fbi, and will undergo severe reorganization. + * */ + + +#include +#include +#include +#include +#include + +#include "FbiStuff.h" +#include "FbiStuffLoader.h" +#ifdef USE_X11 +# include "viewer.h" +#endif /* USE_X11 */ + +namespace fim +{ + +struct tiff_state { + TIFF* tif; + //char emsg[FIM_LIBERR_BUFSIZE]; + tdir_t ndirs; /* Number of directories */ + /* (could be interpreted as number of pages) */ + uint32 width,height; + uint16 config,nsamples,depth,fillorder,photometric; + uint32* row; + uint32* image; + uint16 resunit; + float xres,yres; +}; + +static void* +tiff_init(FILE *fp, const fim_char_t *filename, unsigned int page, + struct ida_image_info *i, int thumbnail) +{ + struct tiff_state *h=FIM_NULL; + + fclose(fp); + h = (struct tiff_state *) fim_calloc(1,sizeof(*h)); + if(!h)goto oops; + + TIFFSetWarningHandler(FIM_NULL); + h->tif = TIFFOpen(filename,"r"); + if (FIM_NULL == h->tif) + goto oops; + /* Determine number of directories */ + h->ndirs = 1; + while (TIFFReadDirectory(h->tif)) + h->ndirs++; + i->npages = h->ndirs; + /* Select requested directory (page) */ + if (!TIFFSetDirectory(h->tif, (tdir_t)page)) + goto oops; + + TIFFGetField(h->tif, TIFFTAG_IMAGEWIDTH, &h->width); + TIFFGetField(h->tif, TIFFTAG_IMAGELENGTH, &h->height); + TIFFGetField(h->tif, TIFFTAG_PLANARCONFIG, &h->config); + TIFFGetField(h->tif, TIFFTAG_SAMPLESPERPIXEL, &h->nsamples); + TIFFGetField(h->tif, TIFFTAG_BITSPERSAMPLE, &h->depth); + TIFFGetField(h->tif, TIFFTAG_FILLORDER, &h->fillorder); + TIFFGetField(h->tif, TIFFTAG_PHOTOMETRIC, &h->photometric); + h->row = (uint32*)fim_malloc(TIFFScanlineSize(h->tif)); + if(!h->row)goto oops; + if (FbiStuff::fim_filereading_debug()) +#ifndef FIM_PRId32 +#define FIM_PRId32 "x" +#endif /* FIM_PRId32 */ + FIM_FBI_PRINTF("tiff: %" FIM_PRId32 "x%" FIM_PRId32 ", planar=%d, " + "nsamples=%d, depth=%d fo=%d pm=%d scanline=%" FIM_PRId32 "\n", +// FIM_FBI_PRINTF("tiff: %" "%d" "x%" "%d" ", planar=%d, " +// "nsamples=%d, depth=%d fo=%d pm=%d scanline=%" "%d" "\n", + h->width,h->height,h->config,h->nsamples,h->depth, + h->fillorder,h->photometric, + TIFFScanlineSize(h->tif)); + + if (PHOTOMETRIC_PALETTE == h->photometric || + PHOTOMETRIC_YCBCR == h->photometric || + PHOTOMETRIC_SEPARATED == h->photometric || + TIFFIsTiled(h->tif) || + (1 != h->depth && 8 != h->depth)) { + /* for the more difficuilt cases we let libtiff + * do all the hard work. Drawback is that we lose + * progressive loading and decode everything here */ + if (FbiStuff::fim_filereading_debug()) + FIM_FBI_PRINTF("tiff: reading whole image [TIFFReadRGBAImage]\n"); + h->image=(uint32*)fim_malloc(4*h->width*h->height); + if(!h->image)goto oops; + TIFFReadRGBAImage(h->tif, h->width, h->height, h->image, 0); + } else { + if (FbiStuff::fim_filereading_debug()) + FIM_FBI_PRINTF("tiff: reading scanline by scanline\n"); + h->row = (uint32*)fim_malloc(TIFFScanlineSize(h->tif)); + if(!h->row)goto oops; + } + + i->width = h->width; + i->height = h->height; + + if (TIFFGetField(h->tif, TIFFTAG_RESOLUTIONUNIT, &h->resunit) && + TIFFGetField(h->tif, TIFFTAG_XRESOLUTION, &h->xres) && + TIFFGetField(h->tif, TIFFTAG_YRESOLUTION, &h->yres)) { + switch (h->resunit) { + case RESUNIT_NONE: + break; + case RESUNIT_INCH: + i->dpi = (unsigned int)h->xres; + break; + case RESUNIT_CENTIMETER: + i->dpi = (unsigned int)res_cm_to_inch(h->xres); + break; + } + } + + return h; + + oops: + if (h && h->tif) + TIFFClose(h->tif); + if(h && h->row)fim_free(h->row); + if(h && h->image)fim_free(h->image); + if(h)fim_free(h); + return FIM_NULL; +} + +static void +tiff_read(fim_byte_t *dst, unsigned int line, void *data) +{ + struct tiff_state *h = (struct tiff_state *) data; + int s,on,off; + + if (h->image) { + /* loaded whole image using TIFFReadRGBAImage() */ + uint32 *row = h->image + h->width * (h->height - line -1); + load_rgba(dst,(fim_byte_t*)row,h->width); + return; + } + + if (h->config == PLANARCONFIG_CONTIG) { + TIFFReadScanline(h->tif, h->row, line, 0); + } else if (h->config == PLANARCONFIG_SEPARATE) { + for (s = 0; s < h->nsamples; s++) + TIFFReadScanline(h->tif, h->row, line, s); + } + + switch (h->nsamples) { + case 1: + if (1 == h->depth) { + /* black/white */ + on = 0, off = 0; + if (PHOTOMETRIC_MINISWHITE == h->photometric) + on = 0, off = 255; + if (PHOTOMETRIC_MINISBLACK == h->photometric) + on = 255, off = 0; +#if 0 + /* Huh? Does TIFFReadScanline handle this already ??? */ + if (FILLORDER_MSB2LSB == h->fillorder) + load_bits_msb(dst,(fim_byte_t*)(h->row),h->width,on,off); + else + load_bits_lsb(dst,(fim_byte_t*)(h->row),h->width,on,off); +#else + load_bits_msb(dst,(fim_byte_t*)(h->row),h->width,on,off); +#endif + } else { + /* grayscaled */ + load_gray(dst,(fim_byte_t*)(h->row),h->width); + } + break; + case 3: + /* rgb */ + memcpy(dst,h->row,3*h->width); + break; + case 4: + /* rgb+alpha */ + load_rgba(dst,(fim_byte_t*)(h->row),h->width); + break; + } +} + +static void +tiff_done(void *data) +{ + struct tiff_state *h = (struct tiff_state *) data; + + TIFFClose(h->tif); + if (h->row) + fim_free(h->row); + if (h->image) + fim_free(h->image); + fim_free(h); +} + +static struct ida_loader tiff1_loader = { + /*magic:*/ "MM\x00\x2a", + /*moff:*/ 0, + /*mlen:*/ 4, + /*name:*/ "libtiff-MM", + /*init:*/ tiff_init, + /*read:*/ tiff_read, + /*done:*/ tiff_done, +}; +static struct ida_loader tiff2_loader = { + /*magic:*/ "II\x2a\x00", + /*moff:*/ 0, + /*mlen:*/ 4, + /*name:*/ "libtiff-II", + /*init:*/ tiff_init, + /*read:*/ tiff_read, + /*done:*/ tiff_done, +}; + +static void __init init_rd(void) +{ + fim_load_register(&tiff1_loader); + fim_load_register(&tiff2_loader); +} + +#ifdef USE_X11 +/* ---------------------------------------------------------------------- */ +/* save */ + +static int +tiff_write(FILE *fp, struct ida_image *img) +{ + TIFF *TiffHndl; + tdata_t buf; + unsigned int y; + + TiffHndl = TIFFFdOpen(fileno(fp),"42.tiff","w"); + if (TiffHndl == FIM_NULL) + return -1; + TIFFSetField(TiffHndl, TIFFTAG_IMAGEWIDTH, img->i.width); + TIFFSetField(TiffHndl, TIFFTAG_IMAGELENGTH, img->i.height); + TIFFSetField(TiffHndl, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); + TIFFSetField(TiffHndl, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB); + TIFFSetField(TiffHndl, TIFFTAG_BITSPERSAMPLE, 8); + TIFFSetField(TiffHndl, TIFFTAG_SAMPLESPERPIXEL, 3); + TIFFSetField(TiffHndl, TIFFTAG_ROWSPERSTRIP, 2); + TIFFSetField(TiffHndl, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT); +#if 0 /* fixme: make this configureable */ + TIFFSetField(TiffHndl, TIFFTAG_COMPRESSION, COMPRESSION_LZW); + TIFFSetField(TiffHndl, TIFFTAG_PREDICTOR, 2); +#endif + if (img->i.dpi) { + float dpi = img->i.dpi; + TIFFSetField(TiffHndl, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH); + TIFFSetField(TiffHndl, TIFFTAG_XRESOLUTION, dpi); + TIFFSetField(TiffHndl, TIFFTAG_YRESOLUTION, dpi); + } + + for (y = 0; y < img->i.height; y++) { + buf = img->data + 3*img->i.width*y; + TIFFWriteScanline(TiffHndl, buf, y, 0); + } + TIFFClose(TiffHndl); + return 0; +} + +static struct ida_writer tiff_writer = { + /* label:*/ "TIFF", + /* ext:*/ { "tif", "tiff", FIM_NULL}, + /* write:*/ tiff_write, +}; + +static void __init init_wr(void) +{ + fim_write_register(&tiff_writer); +} + +#endif /* USE_X11 */ +} + diff --git a/src/FbiStuffXyz.cpp b/src/FbiStuffXyz.cpp new file mode 100644 index 0000000..1918f4e --- /dev/null +++ b/src/FbiStuffXyz.cpp @@ -0,0 +1,222 @@ +/* $LastChangedDate: 2015-12-19 01:44:41 +0100 (Sat, 19 Dec 2015) $ */ +/* + FbiStuffXyz.cpp : An example file for reading new file types with hypothetical library libxyz. + + (c) 2014-2015 Michele Martone + based on code (c) 1998-2006 Gerd Knorr + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "fim.h" + +/* + If you want to include a new file format reader in fim, use this file as a playground. + This is an example file decoder for our test ".xyz" file format. + An *.xyz file may look like the quoted text that follows: + "xyz 255 255 1 This is a sample file to be opened by the sample decoder in FbiStuffXyz.cpp." + + Set FIM_WITH_LIBXYZ to 1 to enable this sample decoder and be able to open *.xyz files. + Then do: + echo "xyz 255 255 1 This is a sample file to be opened by the sample decoder in FbiStuffXyz.cpp." > file.xyz + src/fim file.xyz + */ +#if FIM_WITH_LIBXYZ + +#include +#include +#include +#include +#ifdef HAVE_ENDIAN_H +# include +#endif /* HAVE_ENDIAN_H */ + +namespace fim +{ + +extern CommandConsole cc; + + +/* ---------------------------------------------------------------------- */ +/* hypothetic libxyz routines */ +static fim_err_t xyz_load_image_info_fp(FILE *fp, int * numpagesp, unsigned int *wp, unsigned int *hp) +{ + /* gives width and height and number of pages (assuming each page same size) */ + fseek(fp,3,SEEK_SET); + fscanf(fp,"%d %d %d",wp,hp,numpagesp); + std::cout << "Identified a " << *wp << " x " << *hp << " file with " << *numpagesp << " pages.\n"; + return FIM_ERR_NO_ERROR; +} + +static fim_err_t xyz_load_image_fp(FILE *fp, unsigned int page, unsigned char * rgb, int bytes_per_line) +{ + int l,c,w,h,numpages; /* page starts at 0 */ + fseek(fp,3,SEEK_SET); + fscanf(fp,"%d %d %d",&w,&h,&numpages); + std::cout << "Will read page "<< page << " of " << w << " x " << h << " file with " << numpages << " pages.\n"; + + if(bytes_per_line < w*3) + goto err; + + for (l=0;lfp = fp; + + if(fseek(h->fp,0,SEEK_END)!=0) + goto oops; + + fo = ftell(h->fp); + h->flen = fo; /* FIXME: evil conversion */ + if( fo == -1 ) + goto oops; + + errval = xyz_load_image_info_fp(h->fp, &h->np, &i->width, &i->height); + if(errval != FIM_ERR_NO_ERROR) + { + std::cout << "Failed xyz_load_image_info_fp !\n"; + goto oops; + } + + i->npages = 1; + h->w = i->width; + h->h = i->height; + h->bytes_per_line = i->width * 3; + h->rgb = (fim_byte_t*)fim_malloc(i->height * h->bytes_per_line ); + if(!h->rgb) + { + std::cout << "Failed fim_malloc!\n"; + goto oops; + } + + errval = xyz_load_image_fp(h->fp, page, h->rgb, h->bytes_per_line); + if(errval != FIM_ERR_NO_ERROR) + { + std::cout << "Failed xyz_load_image_fp!\n"; + goto oops; + } + + return h; +oops: + if(h) + { + if(h->rgb) + fim_free(h->rgb); + fim_free(h); + } + return FIM_NULL; +} + +static void +xyz_read(fim_byte_t *dst, unsigned int line, void *data) +{ + /* this gets called every line. can be left empty if useless. */ + struct xyz_state *h = (struct xyz_state *) data; + int c; + + /* + * In this example, we copy back from a buffer. + * A particular file format may require a call to e.g. xyz_read_line(). + * */ + if(line == 0) + std::cout << "Reading first line of the file..\n"; + for (c=0;cw;++c) + { + dst[c*3+0] = h->rgb[h->bytes_per_line*line+c*3+0]; + dst[c*3+1] = h->rgb[h->bytes_per_line*line+c*3+1]; + dst[c*3+2] = h->rgb[h->bytes_per_line*line+c*3+2]; + } + if(line==h->h/2) + std::cout << "Read half of the file\n"; + if(line == h->h-1) + std::cout << "Read the entire file\n"; +} + +static void +xyz_done(void *data) +{ + struct xyz_state *h = (struct xyz_state *) data; + + std::cout << "Done! Closing the file.\n"; + fclose(h->fp); + fim_free(h->rgb); + fim_free(h); +} + +struct ida_loader xyz_loader = { +/* + * 0000000: 7879 7a2e 2e2e 202e 0a xyz... .. + */ + /*magic:*/ "xyz", + /*moff:*/ 0, + /*mlen:*/ 3, + /*name:*/ "xyz", + /*init:*/ xyz_init, + /*read:*/ xyz_read, + /*done:*/ xyz_done, +}; + +static void __init init_rd(void) +{ + fim_load_register(&xyz_loader); +} + +} +#endif /* FIM_WITH_LIBXYZ */ diff --git a/src/FimWindow.cpp b/src/FimWindow.cpp new file mode 100644 index 0000000..2d5184f --- /dev/null +++ b/src/FimWindow.cpp @@ -0,0 +1,1302 @@ +/* $LastChangedDate: 2016-09-15 18:20:27 +0200 (Thu, 15 Sep 2016) $ */ +/* + FimWindow.cpp : Fim's own windowing system + + (c) 2007-2016 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/* + * This code is still experimental and programmed in great hurry. + * FIXME : there are bugs. + */ + +#include "fim.h" + +#ifdef FIM_WINDOWS + +namespace fim +{ + fim::string FimWindow::fcmd_cmd(const std::vector &args) + { + unsigned int i=0; + fim_err_t rc=0;/*return code*/ +#if FIM_DISABLE_WINDOW_SPLITTING + return "Warning: window control (splitting, etc.) is disabled. It shall be re-enabled in a future version.\n"; +#endif /* FIM_DISABLE_WINDOW_SPLITTING */ +#ifdef FIM_AUTOCMDS + fim::string c=getGlobalIntVariable(FIM_VID_FILENAME); + // note that an autocommand on a transient object is lethal + if(amroot_) + { FIM_AUTOCMD_EXEC(FIM_ACM_PREWINDOW,c); } +#endif /* FIM_AUTOCMDS */ + try + { + while(ireassignWindow(this); + + } + else + viewport_=new Viewport( commandConsole_, corners_ ); + + if( viewport_ == FIM_NULL ) + throw FIM_E_NO_MEM; + } + +//#ifdef FIM_UNDEFINED + FimWindow::FimWindow(const FimWindow & root): +#ifdef FIM_NAMESPACES + Namespace(root), +#endif /* FIM_NAMESPACES */ + corners_(root.corners_),focus_(root.focus_),first_(root.first_),second_(root.second_),amroot_(false), viewport_(FIM_NULL),commandConsole_(root.commandConsole_) + { + /* + * A new leave FimWindow is created with a specified geometry. + * An exception is launched upon memory errors. + * + * Note : this member function is useless, and should be kept private :D + */ + viewport_=new Viewport( commandConsole_, corners_ ); + + if( viewport_ == FIM_NULL ) + throw FIM_E_NO_MEM; + } +//#endif + + bool FimWindow::issplit(void)const + { + /* + * return whether this window is split in some way + * */ + return ( first_ && second_ ) ; + } + + bool FimWindow::isleaf(void)const + { + /* + * +----------+ + * |____|_____| + * |+--+| | + * ||L || | + * |+--+| | + * +----------+ + * NON LEAF + * +----------+ + * + * +----------+ + * | | + * | LEAF | + * | | + * | | + * +----------+ + */ + return ( ! first_ && ! second_ ) ; + } + + bool FimWindow::isvalid(void)const + { + /* + * return whether this window is split right, if it is + * */ + return !(( first_ && ! second_ ) || ( ! first_ && second_ ) ); + } + + bool FimWindow::ishsplit(void)const + { + /* + * +----------+ + * | | + * |__________| + * | | + * | | + * +----------+ + */ + return ( issplit() && focused().corners_.x_==shadowed().corners_.x_ ) ; + } + + bool FimWindow::isvsplit(void)const + { + /* + * +----------+ + * | | | + * | | | + * | | | + * | | | + * +----------+ + */ + return ( issplit() && focused().corners_.y_==shadowed().corners_.y_ ) ; + } + + const FimWindow & FimWindow::c_focused(void)const + { + /* + * return a const reference to the focused window + * throws an exception in case the window is not split! + * */ + if(isleaf())/* temporarily, for security reasons */throw FIM_E_WINDOW_ERROR; + + if(focus_==false) + return first_->c_focused(); + else return second_->c_focused(); + } + + FimWindow & FimWindow::focused(void)const + { + /* + * return a reference to the focused window + * throws an exception in case the window is not split! + * */ + if(isleaf())/* temporarily, for security reasons */throw FIM_E_WINDOW_ERROR; + + if(focus_==false) + return *first_; + else return *second_; + } + + FimWindow & FimWindow::upper(void) + { + /* + * return a reference to the upper window + * throws an exception in case the window is not split! + * */ + if(!ishsplit())/* temporarily, for security reasons */throw FIM_E_WINDOW_ERROR; + return *first_; + } + + FimWindow & FimWindow::lower(void) + { + /* + * return a reference to the lower window + * throws an exception in case the window is not split! + * */ + if(!ishsplit())/* temporarily, for security reasons */throw FIM_E_WINDOW_ERROR; + return *second_; + } + + FimWindow & FimWindow::left(void) + { + /* + * return a reference to the left window + * throws an exception in case the window is not split! + * */ + if(!isvsplit())/* temporarily, for security reasons */throw FIM_E_WINDOW_ERROR; + return *first_; + } + + FimWindow & FimWindow::right(void) + { + /* + * return a reference to the right window + * throws an exception in case the window is not split! + * */ + if(!isvsplit())/* temporarily, for security reasons */throw FIM_E_WINDOW_ERROR; + return *second_; + } + + FimWindow & FimWindow::shadowed(void)const + { + /* + * return a const reference to the right window + * throws an exception in case the window is not split! + * */ + if(isleaf())/* temporarily, for security reasons */throw FIM_E_WINDOW_ERROR; + + if(focus_!=false) + return *first_; + else return *second_; + } + + const FimWindow & FimWindow::c_shadowed(void)const + { + /* + * return a const reference to the shadowed window + * throws an exception in case the window is not split! + * */ + if(isleaf())/* temporarily, for security reasons */throw FIM_E_WINDOW_ERROR; + + if(focus_!=false) + return first_->c_shadowed(); + else return second_->c_shadowed(); + } + + void FimWindow::setroot(void) + { + /* + * FIXME + * */ + amroot_=true; + } + + void FimWindow::split(void) + { + /* + * an alias for hsplit(void) + * */ + hsplit(); + } + +#if 0 + void FimWindow::print_focused(void) + { + if(isleaf()) + { + std::cout << "F:" ; + corners_.print(); + } + else focused().print_focused(); + } + + void FimWindow::print(void) + { + if(amroot_) + std::cout<<"--\n"; + if(amroot_) + print_focused(); + if(isleaf()) + std::cout<<"L:"; + corners_.print(); + if(!isleaf()) + first_ ->print(); + if(!isleaf()) + second_->print(); + } +#endif + + void FimWindow::hsplit(void) + { + /* + * splits the window with a horizontal separator + * */ + if( ! isvalid() ) + return; + + /* + * we should check if there is still room to split ... + * */ + if(isleaf()) + { + first_ = new FimWindow( commandConsole_, this->corners_.hsplit(Rect::Upper),viewport_); + second_ = new FimWindow( commandConsole_, this->corners_.hsplit(Rect::Lower),viewport_); + if(viewport_ && first_ && second_) + { +#define FIM_COOL_WINDOWS_SPLITTING 0 +#if FIM_COOL_WINDOWS_SPLITTING + first_ ->current_viewport().pan_up ( second_->current_viewport().viewport_height() ); +#endif /* FIM_COOL_WINDOWS_SPLITTING */ + delete viewport_; + viewport_ = FIM_NULL; + } + } + else focused().hsplit(); + } + + void FimWindow::vsplit(void) + { + /* + * splits the window with a vertical separator + * */ + if( !isvalid() ) + return; + + /* + * we should check if there is still room to split ... + * */ + if(isleaf()) + { + first_ = new FimWindow( commandConsole_, this->corners_.vsplit(Rect::Left ),viewport_); + second_ = new FimWindow( commandConsole_, this->corners_.vsplit(Rect::Right),viewport_); + if(viewport_ && first_ && second_) + { +#if FIM_COOL_WINDOWS_SPLITTING + second_->current_viewport().pan_right( first_->current_viewport().viewport_width() ); +#endif /* FIM_COOL_WINDOWS_SPLITTING */ + delete viewport_; + viewport_ = FIM_NULL; + } + } + else focused().vsplit(); + } + + bool FimWindow::swap(void) + { + /* + * swap window content + * + * FIXME : unfinished + * + * +-----+-----+ +-----+-----+ + * | | | | | | + * | S | F |-->| F | S | + * | | | | | | + * |b.jpg|a.jpg| |a.jpg|b.jpg| + * +-----+-----+ +-----+-----+ + */ + if( !isvalid() ) + return false; + + if(isleaf()) + { + // no problem + return false; + } + else if(focused().isleaf()) + { + Viewport *vf,*vs; + vf = focused().viewport_; + vs = shadowed().viewport_; + // WARNING : dangerous + if(vf && vs) + { + ;//vf ->reassignWindow(&(shadowed())); + ;//vs ->reassignWindow(&( focused())); + focused().viewport_ = vs; + shadowed().viewport_ = vf; + } + else + { + // an error should be spawned + // FIXME + return false; + } + } + else return focused().swap(); + return true; + } + + + bool FimWindow::close(void) + { + /* + * closing a leaf window implies its rejoining with the parent one + * + * FIXME : unfinished + * + * +----+-----+ +----------+ + * | | | | | + * | | |-->| | + * | | | | | + * | | | | | + * +----+-----+ +----------+ + */ + if( !isvalid() ) + return false; + + if(isleaf()) + { + // no problem + return false; + } + else if(focused().isleaf()) + { + /*if(ishsplit()) + this->corners_=Rect(focused().corners_.x,focused().corners_.y,shadowed().corners_.w,focused().corners_.h+shadowed().corners_.h); + else if(isvsplit()) + this->corners_=Rect(focused().corners_.x,focused().corners_.y,shadowed().corners_.w+focused().corners_.w,shadowed().corners_.h); + else ;//error + */ + /* + * some inheritance operations needed here! + */ + + // WARNING : dangerous + if(viewport_) + { + cout << "viewport_ should be FIM_NULL!\n"; + // an error should be spawned + } + if( ( viewport_ = focused().viewport_ ) ) + { + ;//viewport_ ->reassignWindow(this); + focused().viewport_=FIM_NULL; + } + else + { + // error action + return false; + } + delete first_; first_ = FIM_NULL; + delete second_; second_ = FIM_NULL; + } + else return focused().close(); +// print(); + return true; + } + + void FimWindow::balance(void) + { + /* + * FIXME + * +---+-------+ +-----+-----+ + * |---+-------+ | | | + * | |-->| | | + * | | +-----+-----+ + * | | | | | + * | | | | | + * +-----------+ +-----+-----+ + */ + } + + FimWindow::Moves FimWindow::reverseMove(Moves move) + { + /* + * returns the complementary window move + * + * ( > )^-1 = < + * ( < )^-1 = > + * ( ^ )^-1 = v + * ( v )^-1 = ^ + * */ + if(move==Left ) + return Right; + if(move==Right) + return Left; + if(move==Up ) + return Down; + if(move==Down ) + return Up; + return move; + } + + FimWindow::Moves FimWindow::move_focus(Moves move) + { + /* + * shifts the focus_ from a window to another, + * unfortunately not always adjacent (a better algorithm would is needed for this) + * + * maybe more abstractions is needed here.. + * */ + Moves m; + if( isleaf() || move==NoMove ) + return NoMove; + else + if( isvsplit() ) + { + if( move != Left && move != Right ) + return focused().move_focus(move); + + if( focused().isleaf() ) + { + if( ( right() == focused() && move == Left ) || ( left() == focused() && move == Right ) ) + { + chfocus(); + return move; + } + else + { + return NoMove; + } + } + else + { + if((m=focused().move_focus(move)) == NoMove) + { + chfocus(); + focused().move_focus(reverseMove(move)); + } + return move; + } + } + else + if( ishsplit() ) + { + if( move != Up && move != Down ) + return focused().move_focus(move); + + if( focused().isleaf() ) + { + if( ( upper() == focused() && move == Down ) || ( lower() == focused() && move == Up ) ) + { + chfocus(); + return move; + } + else + { + return NoMove; + } + } + else + { + if((m=focused().move_focus(move)) == NoMove) + { + chfocus(); + focused().move_focus(reverseMove(move)); + } + return move; + } + } + return move; + } + + bool FimWindow::chfocus(void) + { + /* + * this makes sense if issplit(). + * + * swaps the focus_ only. + * + * +----+----+ +----+----+ + * | | | | | | + * | | | | | | + * | F | S |-->| S | F | + * | | | | | | + * +----+----+ +----+----+ + */ + return focus_ = !focus_; + } + + fim_coo_t Rect::height(void)const + { + /* + * +---+ + + * | | | + * +---+ + + */ + return h_ ; + } + + fim_coo_t Rect::setwidth(fim_coo_t w) + { + /* + * +---+ + * +---+ + * | | + * +---+ + */ + return w_=w; + } + + fim_coo_t Rect::setheight(fim_coo_t h) + { + /* + * +---+ + + * | | | + * +---+ + + */ + return h_=h; + } + + fim_coo_t Rect::width(void)const + { + /* + * +---+ + * +---+ + * | | + * +---+ + */ + return w_ ; + } + + fim_coo_t Rect::setxorigin(fim_coo_t x) + { + /* + * o---+ + * | | + * +---+ + */ + return x_=x ; + } + + fim_coo_t Rect::setyorigin(fim_coo_t y) + { + /* + * o---+ + * | | + * +---+ + */ + return y_=y ; + } + + fim_coo_t Rect::xorigin(void)const + { + /* + * o---+ + * | | + * +---+ + */ + return x_ ; + } + + fim_coo_t Rect::yorigin(void)const + { + /* + * o---+ + * | | + * +---+ + */ + return y_ ; + } + + bool FimWindow::can_vgrow(const FimWindow & window, fim_coo_t howmuch) + { + /* + * Assuming that the argument window is a contained one, + * can this window grow the specified amount and assure the + * minimum spacing is respected ? + * + * +--------+ + * +-^-+this| + * | ? | | + * +-v-+ | + * +--------+ + */ + return window.corners_.height() + howmuch + vspacing < corners_.height(); + } + + bool FimWindow::can_hgrow(const FimWindow & window, fim_coo_t howmuch) + { + /* + * Assuming that the argument window is a contained one, + * can this window grow the specified amount and assure the + * minimum spacing is respected ? + * + * +--------+ + * +---+this| + * || | + * +---+ | + * +--------+ + */ return window.corners_.width() + howmuch + hspacing < corners_.width(); + } + + bool FimWindow::operator==(const FimWindow&window)const + { + /* + * #===# + * # # + * #===# + */ + return corners_==window.corners_; + } + + int FimWindow::count_hdivs(void)const + { + /* + * how many horizontal divisions ? + * + * +----------+ + * | | + * | | hdivs = 3 + * +----------+ + * +----------+ + * +----------+ + * */ + return (isleaf()|| !ishsplit())?1: first_->count_hdivs()+ second_->count_hdivs(); + } + + int FimWindow::count_vdivs(void)const + { + /* + * how many vertical divisions ? + * */ + return (isleaf()|| !isvsplit())?1: first_->count_vdivs()+ second_->count_vdivs(); + } + + bool FimWindow::normalize(void) + { + /* + * FIXME vs balance + * + * +---+-------+ +-----+-----+ + * |---+-------+ | | | + * | |-->| | | + * | | +-----+-----+ + * | | | | | + * | | | | | + * +-----------+ +-----+-----+ + */ + return +// (hnormalize(corners_.xorigin(), corners_.width() )!= -1); + (hnormalize(corners_.xorigin(), corners_.width() )!= -1) && + (vnormalize(corners_.yorigin(), corners_.height())!= -1); + } + + fim_err_t FimWindow::vnormalize(fim_coo_t y, fim_coo_t h) + { + /* + * balances the horizontal divisions height + * + * FIXME + * + * +---+-------+ +---+-------+ + * |---+-------+ | | | + * | |-->| | | + * | | +---+-------+ + * | | | | | + * | | | | | + * +-----------+ +---+-------+ + */ + if(isleaf()) + { + corners_.setyorigin(y); + corners_.setheight(h); + return FIM_ERR_NO_ERROR; + } + else + { + int fhdivs,/*shdivs,*/hdivs,upd; + fhdivs=first_ ->count_hdivs(); + //shdivs=second_->count_hdivs(); + hdivs=count_hdivs(); + upd=h/hdivs; + if(hdivs>h)// no space left + return FIM_ERR_GENERIC; + //... + corners_.setyorigin(y); + corners_.setheight(h); + + if(ishsplit()) + { + first_-> vnormalize(y,upd*fhdivs); + second_->vnormalize(y+upd*fhdivs,h-upd*fhdivs); + } + else + { + first_-> vnormalize(y,h); + second_->vnormalize(y,h); + } + return FIM_ERR_NO_ERROR; + } + } + + fim_err_t FimWindow::hnormalize(fim_coo_t x, fim_coo_t w) + { + /* + * balances the vertical divisions width + * + * FIXME + * + * +---+-------+ +-----+-----+ + * | | | | | | + * | | |-->| | | + * |---+-------+ +-----+-----+ + * | | | | | | + * | | | | | | + * +---+-------+ +-----+-----+ + */ + if(isleaf()) + { + corners_.setxorigin(x); + corners_.setwidth(w); + return FIM_ERR_NO_ERROR; + } + else + { + int fvdivs,/*svdivs,*/vdivs,upd; + fvdivs=first_ ->count_vdivs(); + //svdivs=second_->count_vdivs(); + vdivs=count_vdivs(); + upd=w/vdivs; + if(vdivs>w)// no space left + return FIM_ERR_GENERIC; + //... + corners_.setxorigin(x); + corners_.setwidth(w); + + if(isvsplit()) + { + first_-> hnormalize(x,upd*fvdivs); + second_->hnormalize(x+upd*fvdivs,w-upd*fvdivs); + } + else + { + first_-> hnormalize(x,w); + second_->hnormalize(x,w); + } + return FIM_ERR_NO_ERROR; + } + } + + fim_err_t FimWindow::venlarge(fim_coo_t units=FIM_CNS_WGROW_STEPS_DEFAULT) + { +#if FIM_BUGGED_ENLARGE + return FIM_ERR_GENERIC; +#endif /* FIM_BUGGED_ENLARGE */ + /* + * SEEMS BUGGY: + * */ + // make && src/fim media/* -c 'split;vsplit;6henlarge;wd;7henlarge;wu;4henlarge' + // make && src/fim media/* -c 'split;vsplit;window "venlarge";wd; window "venlarge";' + /* + * +----------+ + * | | | + * | >| | + * | F | S | + * | | | + * +----------+ + */ + if( isleaf() ) + { + should_redraw();// no effect + return FIM_ERR_NO_ERROR; + } + + if(isvsplit()) + { + /* + * +-+-+ + * + | + + * +-+-+ + * */ + if(focused()==left()) + focused().hrgrow(units); + if(focused()==right()) + focused().hlgrow(units); + focused().normalize(); // i think there is a more elegant way to this but hmm.. + + } + focused().venlarge(units); //regardless the split status + if(isvsplit()) + { + if(focused()==left()) + shadowed().hlshrink(units); + if(focused()==right()) + shadowed().hrshrink(units); + shadowed().normalize(); + } + return FIM_ERR_NO_ERROR; + } + + fim_err_t FimWindow::henlarge(fim_coo_t units=FIM_CNS_WGROW_STEPS_DEFAULT) + { + /* + * SEEMS BUGGY: + * */ + // make && src/fim media/* -c 'split;vsplit;6henlarge;wd;7henlarge;wu;4henlarge' +#if FIM_BUGGED_ENLARGE + return FIM_ERR_GENERIC; +#endif /* FIM_BUGGED_ENLARGE */ + /* + * this operation doesn't change the outer bounds of the called window + * + * +----------+ + * | S | + * |__________| + * | ^ | + * | F | + * +----------+ + */ + if( isleaf() ) + { + should_redraw();// no effect + return FIM_ERR_NO_ERROR; + } + + if(ishsplit()) + { + /* + * +---+ + * +---+ + * +---+ + * */ + if(focused()==upper()) + focused().vlgrow(units); + if(focused()==lower()) + focused().vugrow(units); + focused().normalize(); // i think there is a more elegant way to thism but hmm.. + + } + focused().henlarge(units); //regardless the split status + if(ishsplit()) + { + if(focused()==upper()) + shadowed().vushrink(units); + if(focused()==lower()) + shadowed().vlshrink(units); + + shadowed().normalize(); + } + return FIM_ERR_NO_ERROR; + } + + fim_err_t FimWindow::enlarge(fim_coo_t units=FIM_CNS_WGROW_STEPS_DEFAULT) + { + /* + * FIXME : ??? + */ +#if FIM_BUGGED_ENLARGE + return FIM_ERR_GENERIC; +#endif /* FIM_BUGGED_ENLARGE */ + /* + * complicato ... + */ +// std::cout << "enlarge\n"; + if(ishsplit() && can_vgrow(focused(),units)) + { + return henlarge(units); + }else + if(isvsplit() && can_hgrow(focused(),units)) + { + return venlarge(units); + }else + // isleaf(void) + return FIM_ERR_NO_ERROR; + } + + + fim_err_t FimWindow::vlgrow(fim_coo_t units=FIM_CNS_WGROW_STEPS_DEFAULT) { return corners_.vlgrow( units); } + fim_err_t FimWindow::vlshrink(fim_coo_t units=FIM_CNS_WGROW_STEPS_DEFAULT) { return corners_.vlshrink(units); } + fim_err_t FimWindow::vugrow(fim_coo_t units=FIM_CNS_WGROW_STEPS_DEFAULT) { return corners_.vugrow( units); } + fim_err_t FimWindow::vushrink(fim_coo_t units=FIM_CNS_WGROW_STEPS_DEFAULT) { return corners_.vushrink(units); } + + fim_err_t FimWindow::hlgrow(fim_coo_t units=FIM_CNS_WGROW_STEPS_DEFAULT) { return corners_.hlgrow( units); } + fim_err_t FimWindow::hlshrink(fim_coo_t units=FIM_CNS_WGROW_STEPS_DEFAULT) { return corners_.hlshrink(units); } + fim_err_t FimWindow::hrgrow(fim_coo_t units=FIM_CNS_WGROW_STEPS_DEFAULT) { return corners_.hrgrow( units); } + fim_err_t FimWindow::hrshrink(fim_coo_t units=FIM_CNS_WGROW_STEPS_DEFAULT) { return corners_.hrshrink(units); } + +#if 0 + void FimWindow::draw(void)const + { + /* + * + * */ + if(isleaf()) + { + // we draw + int OFF=100,K=4; + OFF=40; + fb_clear_rect(corners_.x+OFF, corners_.x+(corners_.w-OFF)*K, (corners_.y+OFF),(corners_.y+(corners_.h-OFF))); + } + else + { + focused().draw(); + shadowed().draw(); + } + } +#endif + + // WARNING : SHOULD BE SURE VIEWPORT IS CORRECTLY INITIALIZED + bool FimWindow::recursive_redisplay(void)const + { + /* + * whole, deep, window redisplay + * */ + bool re=false;//really redisplayed ? sometimes fim guesses it is not necessary + try + { + if(isleaf()) + { + if(viewport_) + re=viewport_->redisplay(); + } + else + { + re |= focused().recursive_redisplay(); + re |= shadowed().recursive_redisplay(); + } + } + catch(FimException e) + { + if( e != FIM_E_WINDOW_ERROR) ;// this would be bad.. + } + return re; + } + + // WARNING : SHOULD BE SURE VIEWPORT IS CORRECTLY INITIALIZED + bool FimWindow::recursive_display(void)const + { + /* + * whole, deep, window display + * */ + bool re=false;//really displayed ? sometimes fim guesses it is not necessary + try + { + if(isleaf()) + { + if(viewport_) + re=viewport_->display(); + } + else + { + re |= focused().recursive_display(); + re |= shadowed().recursive_display(); + } + } + catch(FimException e) + { + if( e != FIM_E_WINDOW_ERROR) ;// this would be bad.. + } + return re; + } + + Viewport * FimWindow::current_viewportp(void)const + { + /* + * returns a pointer to the current window's viewport_. + * + * +#===#+-----+ + * || || | + * || || | + * ||FVP|| | + * || || | + * +#===#+-----+ + */ + if(!isleaf()) + return focused().current_viewportp(); + + return viewport_; + } + + Viewport & FimWindow::current_viewport(void)const + { + /* + * returns a reference to the current window's viewport_. + * throws an exception if this window is a leaf. + * + * +#===#+-----+ + * || || | + * || || | + * ||FVP|| | + * || || | + * +#===#+-----+ + */ + if(!isleaf()) + return focused().current_viewport(); + + if(!viewport_)/* temporarily, for security reasons throw FIM_E_TRAGIC*/; // isleaf(void) + + return *viewport_; + } + + const Image *FimWindow::getImage(void)const + { + if( current_viewportp() ) + return current_viewportp()->getImage(); + else + return FIM_NULL; + } + + FimWindow::~FimWindow(void) + { + if(viewport_) + delete viewport_; + if(first_) + delete first_; + if(second_) + delete second_; + } + + fim_err_t FimWindow::update(const Rect& corners) + { + corners_=corners; + should_redraw(); + return FIM_ERR_NO_ERROR; + } + + size_t FimWindow::byte_size(void)const + { + size_t bs = 0; + bs += sizeof(*this); + return bs; + } + + FimWindow & FimWindow ::operator= (const FimWindow &w){return *this;/* a disabled assignment */} + + fim_bool_t FimWindow::need_redraw(void)const + { + return ( viewport_ && viewport_->need_redraw() ); + } + + void FimWindow::should_redraw(enum fim_redraw_t sr) + { + if(viewport_) + viewport_->should_redraw(sr); + } + + /* Rect stuff */ + + Rect Rect::hsplit(Splitmode s){return split(s);} + Rect Rect::vsplit(Splitmode s){return split(s);} + Rect Rect::split(Splitmode s) + { + /* + * the default split halves + * */ + switch(s) + { + case Left: + return Rect(x_,y_,w_/2,h_); + case Right: + return Rect(x_+w_/2,y_,w_-w_/2,h_); + case Upper: + return Rect(x_,y_,w_,h_/2); + case Lower: + return Rect(x_,y_+h_/2,w_,h_-h_/2); + break; + } + return Rect(x_,y_,w_,h_); + } + + void Rect::print() + { + std::cout << x_ <<" " << y_ << " "<< w_ << " " << h_ << "\n"; + } + + Rect::Rect(fim_coo_t x,fim_coo_t y,fim_coo_t w,fim_coo_t h): + x_(x), y_(y), w_(w), h_(h) + /* redundant, but not evil */ + { + } + + Rect::Rect(const Rect& rect): x_(rect.x_), y_(rect.y_), w_(rect.w_), h_(rect.h_){} + + bool Rect::operator==(const Rect&rect)const + { + return x_==rect.x_ && + y_==rect.y_ && + w_==rect.w_ && + h_==rect.h_; + } + + fim_err_t Rect::vlgrow(fim_coo_t units) { h_+=units; return FIM_ERR_NO_ERROR; } + fim_err_t Rect::vlshrink(fim_coo_t units) { h_-=units; return FIM_ERR_NO_ERROR; } + fim_err_t Rect::vugrow(fim_coo_t units) { y_-=units; h_+=units ; return FIM_ERR_NO_ERROR; } + fim_err_t Rect::vushrink(fim_coo_t units) { y_+=units; h_-=units ; return FIM_ERR_NO_ERROR; } + + fim_err_t Rect::hlgrow(fim_coo_t units) { x_-=units; w_+=units ; return FIM_ERR_NO_ERROR; } + fim_err_t Rect::hrshrink(fim_coo_t units) { w_-=units; return FIM_ERR_NO_ERROR; } + fim_err_t Rect::hrgrow(fim_coo_t units) { w_+=units; return FIM_ERR_NO_ERROR; } + fim_err_t Rect::hlshrink(fim_coo_t units) { x_+=units; w_-=units ; return FIM_ERR_NO_ERROR; } +} +#if 0 +/* + * A test main program. + */ +int main(void) +{ + FimWindow w(Rect(0,0,1024,768)); + w.setroot(); + w.vsplit(); + w.hsplit(); + w.normalize(); + w.print(); + std::cout << "move_focus:\n"; + w.move_focus(FimWindow::Down); + w.move_focus(FimWindow::Right); + w.move_focus(FimWindow::Left); + w.move_focus(FimWindow::Down); + w.print(); + std::cout << "move_focus:\n"; + w.move_focus(FimWindow::Up); + w.print(); +/* w.enlarge(); + w.enlarge(); + w.enlarge(); + w.enlarge(); + w.enlarge(); + std::cout << "normalized:\n"; + + w.print(); + std::cout << "enlarged:\n";*/ +// w.hnormalize(w.corners_.xorigin(),w.corners_.width()); + w.close(); + w.close(); + w.close(); +} +#endif +#endif /* FIM_WINDOWS */ + diff --git a/src/FimWindow.h b/src/FimWindow.h new file mode 100644 index 0000000..a7fb229 --- /dev/null +++ b/src/FimWindow.h @@ -0,0 +1,239 @@ +/* $LastChangedDate: 2015-12-19 01:58:26 +0100 (Sat, 19 Dec 2015) $ */ +/* + FimWindow.h : Fim's own windowing system header file + + (c) 2007-2015 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef FIM_WINDOW_H +#define FIM_WINDOW_H + +#include "fim.h" + +#ifdef FIM_WINDOWS + +#include +#include + + +#ifndef FIM_NULL + #define FIM_NULL 0 +#endif /* FIM_NULL */ +#define FIM_DISABLE_WINDOW_SPLITTING 1 + +/* + * This code is still experimental and programmed in great hurry. + * FIXME + */ + +namespace fim +{ + +/* + * temporarily disabled window enlarge functionality + * */ +#define FIM_BUGGED_ENLARGE 0 + +/* + + The window class should model the behaviour of a binary splitting window + in a portable manner. + It should not be tied to a particular window system or graphical environment, + but it should mimic the behaviour of Vim's windowing system. + + (x,y) : upper left point in + +--------------+ + | | + | | + | | + +--------------+ + | | + +--------------+ + (x+w,y+h) : lower right point out + +*/ +class Rect +{ + public: + fim_coo_t x_,y_,w_,h_; // units, not pixels + void print(void); + + Rect(fim_coo_t x,fim_coo_t y,fim_coo_t w,fim_coo_t h); + + Rect(const Rect& rect); + + public: + + enum Splitmode{ Left,Right,Upper,Lower}; + + Rect hsplit(Splitmode s); + Rect vsplit(Splitmode s); + Rect split(Splitmode s); + + /* todo : to unsigned integer ! */ + fim_err_t vlgrow(fim_coo_t units=FIM_CNS_WGROW_STEPS_DEFAULT); + fim_err_t vlshrink(fim_coo_t units=FIM_CNS_WGROW_STEPS_DEFAULT); + fim_err_t vugrow(fim_coo_t units=FIM_CNS_WGROW_STEPS_DEFAULT); + fim_err_t vushrink(fim_coo_t units=FIM_CNS_WGROW_STEPS_DEFAULT); + + fim_err_t hlgrow(fim_coo_t units=FIM_CNS_WGROW_STEPS_DEFAULT); + fim_err_t hrshrink(fim_coo_t units=FIM_CNS_WGROW_STEPS_DEFAULT); + fim_err_t hrgrow(fim_coo_t units=FIM_CNS_WGROW_STEPS_DEFAULT); + fim_err_t hlshrink(fim_coo_t units=FIM_CNS_WGROW_STEPS_DEFAULT); + bool operator==(const Rect&rect)const; + + fim_coo_t setwidth(fim_coo_t w); + fim_coo_t setheight(fim_coo_t h); + fim_coo_t setxorigin(fim_coo_t x); + fim_coo_t setyorigin(fim_coo_t y); + fim_coo_t height(void)const; + fim_coo_t width(void)const; + fim_coo_t xorigin(void)const; + fim_coo_t yorigin(void)const; +}; + +#ifdef FIM_NAMESPACES +class FimWindow:public Namespace +#else /* FIM_NAMESPACES */ +class FimWindow +#endif /* FIM_NAMESPACES */ +{ + + private: + + enum Spacings{ hspacing=0, vspacing=0}; + enum Moves{Up,Down,Left,Right,NoMove}; + + /* FIXME : temporary : this will be a Viewport ! */ +/* + * should we model some status bar here ? + * + * note that status could also be located elsewhere.. it is + * not in the corners box coordinate system. + * + * */ + public: + Rect corners_;//,status,canvas; + private: + bool focus_; // if 0 left/up ; otherwise right/lower + + FimWindow *first_,*second_; + bool amroot_; + + void split(void); + void hsplit(void); + void vsplit(void); + bool close(void); + bool swap(void); // new + void balance(void); + bool chfocus(void); + Moves move_focus(Moves move); + Moves reverseMove(Moves move); + bool normalize(void); + fim_err_t enlarge(fim_coo_t units); + fim_err_t henlarge(fim_coo_t units); + fim_err_t venlarge(fim_coo_t units); + + bool can_vgrow(const FimWindow & window, fim_coo_t howmuch); + bool can_hgrow(const FimWindow & window, fim_coo_t howmuch); + + + + private: +//#ifdef FIM_UNDEFINED + /* + seems useless, who knows ? + throws FIM_E_NO_MEM exception + it is hust defined to make -Weffc++ happy + so keep this private! + */ + FimWindow(const FimWindow & root); +//#endif /* FIM_UNDEFINED */ + bool isleaf(void)const; + bool isvalid(void)const; + bool issplit(void)const; + bool ishsplit(void)const; + bool isvsplit(void)const; + fim_err_t hnormalize(fim_coo_t x, fim_coo_t w); + fim_err_t vnormalize(fim_coo_t y, fim_coo_t h); + int count_hdivs(void)const; + int count_vdivs(void)const; + + fim_err_t vlgrow(fim_coo_t units); + fim_err_t vugrow(fim_coo_t units); + fim_err_t vushrink(fim_coo_t units); + fim_err_t vlshrink(fim_coo_t units); + + fim_err_t hlgrow(fim_coo_t units); + fim_err_t hrgrow(fim_coo_t units); + fim_err_t hlshrink(fim_coo_t units); + fim_err_t hrshrink(fim_coo_t units); + + FimWindow & focused(void)const; + FimWindow & shadowed(void)const; + + FimWindow & upper(void); + FimWindow & lower(void); + FimWindow & left(void); + FimWindow & right(void); + + bool operator==(const FimWindow&window)const; + + Viewport *viewport_; + + /* + * DANGER : nearly each of these methods launches some exception! + * */ + const FimWindow & c_focused(void)const; + const FimWindow & c_shadowed(void)const; + + Viewport & current_viewport(void)const; + CommandConsole &commandConsole_; + + FimWindow & operator= (const FimWindow &w); + + public: + void setroot(void); // only one root window should exist + + /* The only public member function launching exceptions is the constructor now. + * */ + FimWindow(CommandConsole &c, const Rect& corners, Viewport* vp=FIM_NULL); // throws FIM_E_NO_MEM exception + fim_err_t update(const Rect& corners); + + Viewport * current_viewportp(void)const; + fim::string fcmd_cmd(const std::vector &args); + bool recursive_redisplay(void)const; //exception safe + bool recursive_display(void)const; //exception safe + + const Image *getImage(void)const; //exception safe + +#if 0 + void print(void); + void print_focused(void); + void draw(void)const; +#endif + + ~FimWindow(void); + virtual size_t byte_size(void)const; + void should_redraw(enum fim_redraw_t sr = FIM_REDRAW_NECESSARY); /* FIXME: this is a wrapper to Viewport's, until multiple windows get introduced again. */ + fim_bool_t need_redraw(void)const; +}; + +} +#endif /* FIM_WINDOWS */ +#endif /* FIM_WINDOW_H */ + diff --git a/src/FontServer.cpp b/src/FontServer.cpp new file mode 100644 index 0000000..3eb72df --- /dev/null +++ b/src/FontServer.cpp @@ -0,0 +1,351 @@ +/* $LastChangedDate: 2015-12-19 01:44:41 +0100 (Sat, 19 Dec 2015) $ */ +/* + FontServer.cpp : Font Server code from fbi, adapted for fim. + + (c) 2007-2015 Michele Martone + (c) 1998-2006 Gerd Knorr + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +/* + * This file comes from fbi, and will undergo severe reorganization. + * */ + + + +#include +#include "fim.h" + +#define FIM_FONT_DEBUG 0 +//#define ff_stderr stdout +#define ff_stderr stderr +#define FIM_PSF1_MAGIC0 0x36 +#define FIM_PSF1_MAGIC1 0x04 +#define FIM_PSF2_MAGIC0 0x72 +#define FIM_PSF2_MAGIC1 0xb5 +#define FIM_PSF2_MAGIC2 0x4a +#define FIM_PSF2_MAGIC3 0x86 +#define FIM_MAX_FONT_HEIGHT 256 +#define FIM_SAVE_CONSOLEFONTNAME(CFN) cc.setVariable(FIM_VID_FBFONT,CFN); +namespace fim +{ + + FontServer::FontServer( ) + { + } + + +#if 1 +void FontServer::fb_text_init1(const fim_char_t *font_, struct fs_font **_f) +{ + const fim_char_t*font=(fim_char_t*)font_; + const fim_char_t *fonts[2] = { font, FIM_NULL }; +#if FIM_FONT_DEBUG + std::cout << "before consolefont:" << "(0x"<<((void*)*_f) <<")\n"; +#endif /* FIM_FONT_DEBUG */ + if (FIM_NULL == *_f) + *_f = fs_consolefont(font ? fonts : FIM_NULL); +#if FIM_FONT_DEBUG + std::cout << "after consolefont :" << "(0x"<<((void*)*_f) <<")\n"; +#endif /* FIM_FONT_DEBUG */ +#ifdef FIM_USE_X11_FONTS + if (FIM_NULL == *_f && 0 == fs_connect(FIM_NULL)) + *_f = fs_open(font ? font : x11_font); +#endif /* FIM_USE_X11_FONTS */ +#if FIM_FONT_DEBUG + std::cout << "after fs_open :" << "(0x"<<((void*)*_f) <<")\n"; +#endif /* FIM_FONT_DEBUG */ + if (FIM_NULL == *_f) { + FIM_FPRINTF(ff_stderr, "font \"%s\" is not available\n",font); + exit(1); + } +} + +#if 1 +static const fim_char_t *default_font[] = { + /* why the heck every f*cking distribution picks another + location for these fonts ??? (GK) + +1 (MM) */ +#ifdef FIM_DEFAULT_CONSOLEFONT + FIM_DEFAULT_CONSOLEFONT, +#endif /* FIM_DEFAULT_CONSOLEFONT */ + "/usr/share/consolefonts/Uni3-TerminusBoldVGA14.psf.gz", + "/usr/lib/kbd/consolefonts/lat9-16.psf.gz",/* added for a Mandriva backport */ + "/usr/share/consolefonts/lat1-16.psf", + "/usr/share/consolefonts/lat1-16.psf.gz", + "/usr/share/consolefonts/lat1-16.psfu.gz", + "/usr/share/kbd/consolefonts/lat1-16.psf", + "/usr/share/kbd/consolefonts/lat1-16.psf.gz", + "/usr/share/kbd/consolefonts/lat1-16.psfu.gz", + "/usr/lib/kbd/consolefonts/lat1-16.psf", + "/usr/lib/kbd/consolefonts/lat1-16.psf.gz", + "/usr/lib/kbd/consolefonts/lat1-16.psfu.gz", + "/lib/kbd/consolefonts/lat1-16.psf", + "/lib/kbd/consolefonts/lat1-16.psf.gz", + "/lib/kbd/consolefonts/lat1-16.psfu.gz", + /* added for Ubuntu 10, but a search mechanism or a fim user variable would be wiser */ + "/lib/kbd/consolefonts/Lat2-VGA14.psf.gz", + "/lib/kbd/consolefonts/Lat2-VGA16.psf.gz", + "/lib/kbd/consolefonts/Lat2-VGA8.psf.gz", + "/lib/kbd/consolefonts/Uni2-VGA16.psf.gz", + /* end ubuntu add */ + /* begin debian squeeze add */ + "/usr/share/consolefonts/default8x16.psf.gz", + "/usr/share/consolefonts/default8x9.psf.gz", + "/usr/share/consolefonts/Lat15-Fixed16.psf.gz", + "/usr/share/consolefonts/default.psf.gz", + /* end debian squeeze add */ +#if FIM_WANT_HARDCODED_FONT + FIM_DEFAULT_HARDCODEDFONT_STRING, +#endif /* FIM_WANT_HARDCODED_FONT */ + FIM_NULL +}; + +fim::string get_default_font_list(void) +{ + fim::string dfl; + const fim_char_t ** filename=default_font; + for(int i = 0; filename[i] != FIM_NULL; i++) + { + dfl+=filename[i]; + dfl+="\n"; + } + return dfl; +} +#endif + +static int probe_font_file(const fim_char_t *fontfilename) +{ + FILE *fp=FIM_NULL; + if ( strlen(fontfilename)>3 && 0 == strcmp(fontfilename+strlen(fontfilename)-3,".gz")) + { + #ifdef FIM_USE_ZCAT + /* FIXME */ + fp = FbiStuff::fim_execlp(FIM_EPR_ZCAT,FIM_EPR_ZCAT,fontfilename,FIM_NULL); + #endif /* FIM_USE_ZCAT */ + } + else + { + fp = fopen(fontfilename, "r"); + } + + if (FIM_NULL == fp) + goto no; + + if (fgetc(fp) != 0x36 || fgetc(fp) != 0x04) + goto no; + + /* this is enough */ + if(fp) + fclose(fp); + return 0; +no: + if(fp)fclose(fp); + return -1; +} + +void fim_free_fs_font(struct fs_font *f_) +{ + if(f_) + { + if(f_->eindex) fim_free(f_->eindex); + if(f_->gindex) fim_free(f_->gindex); + if(f_->glyphs) fim_free(f_->glyphs); + if(f_->extents) fim_free(f_->extents); + fim_free(f_); + } +} + +struct fs_font* FontServer::fs_consolefont(const fim_char_t **filename) +{ + /* this function is too much involved: it shall be split in pieces */ + int i=0; + int fr; + const fim_char_t *h=FIM_NULL; + struct fs_font *f_ = FIM_NULL; + const fim_char_t *fontfilename=FIM_NULL; + FILE *fp=FIM_NULL; + fim_char_t fontfilenameb[FIM_PATH_MAX]; + bool robmn=true;/* retry on bad magic numbers */ +#if FIM_WANT_HARDCODED_FONT + unsigned char dfontdata[] = +#include "default_font_byte_array.h"/* FIXME: this is horrible practice */ +#endif /* FIM_WANT_HARDCODED_FONT */ + +#if FIM_WANT_HARDCODED_FONT + /* shortcut: no access() call required */ + if (filename && *filename && 0 == strcmp(filename[0],FIM_DEFAULT_HARDCODEDFONT_STRING)) + goto openhardcodedfont; +#endif /* FIM_WANT_HARDCODED_FONT */ + + if (FIM_NULL == filename) + filename = fim::default_font; + +scanlistforafontfile: + for(i = 0; filename[i] != FIM_NULL; i++) { + if (-1 == access(filename[i],R_OK)) + { +#if FIM_WANT_HARDCODED_FONT + if (0 == strcmp(filename[i],FIM_DEFAULT_HARDCODEDFONT_STRING)) + goto openhardcodedfont; +#endif /* FIM_WANT_HARDCODED_FONT */ +#if FIM_FONT_DEBUG + std::cout << "no access to " << filename[i] << "\n"; +#endif /* FIM_FONT_DEBUG */ + fim_perror(FIM_NULL); + continue; + } + break; + } + fontfilename=filename[i]; + filename+=i;//new +#if FIM_FONT_DEBUG + std::cout << "probing :" << fontfilename << "\n"; +#endif /* FIM_FONT_DEBUG */ + +#if FIM_LINUX_CONSOLEFONTS_DIR_SCAN + if(FIM_NULL == fontfilename) + { + /* will scan FIM_LINUX_CONSOLEFONTS_DIR directory for console fonts */ + fim::string nf = FIM_LINUX_CONSOLEFONTS_DIR; + DIR *dir=FIM_NULL; + struct dirent *de=FIM_NULL; + + if( !is_dir( nf.c_str() )) + goto oops; + if ( ! ( dir = opendir(nf.c_str() ) )) + goto oops; + + while( ( de = readdir(dir) ) != FIM_NULL ) + { + if(is_file(de->d_name) && regexp_match(de->d_name,"8x.*\\.psf") && access(de->d_name,R_OK)) + { + nf = FIM_LINUX_CONSOLEFONTS_DIR; + nf+="/"; + nf+=de->d_name; + strncpy(fontfilenameb,nf.c_str(),FIM_PATH_MAX-1); + fontfilename=fontfilenameb; + if(probe_font_file(fontfilename)==0) + break; + /* FIXME */ + } + } + closedir(dir); + } +#endif /* FIM_LINUX_CONSOLEFONTS_DIR_SCAN */ + +#if FIM_WANT_HARDCODED_FONT +openhardcodedfont: + if (FIM_NULL == fontfilename) + { + FIM_SAVE_CONSOLEFONTNAME(FIM_DEFAULT_HARDCODEDFONT_STRING); + fp=fmemopen(dfontdata,sizeof(dfontdata),"r"); + if(fp) + goto gotafp; + } +#endif /* FIM_WANT_HARDCODED_FONT */ + if (FIM_NULL == fontfilename) { + FIM_FPRINTF(ff_stderr, "can't find console font file\n"); + goto oops; + } + + h = fontfilename+strlen(fontfilename)-3; + if ( h>fontfilename && 0 == strcmp(h,".gz")) { + #ifdef FIM_USE_ZCAT + /* FIXME */ + fp = FbiStuff::fim_execlp(FIM_EPR_ZCAT,FIM_EPR_ZCAT,fontfilename,FIM_NULL); + #else /* FIM_USE_ZCAT */ + FIM_FPRINTF(ff_stderr, "built with no gzip decoder!\n"); + #endif /* FIM_USE_ZCAT */ + } else { + fp = fopen(fontfilename, "r"); + } + if (FIM_NULL == fp) { + FIM_FPRINTF(ff_stderr, "can't open %s: %s\n",fontfilename,strerror(errno)); + goto oops; + } + FIM_SAVE_CONSOLEFONTNAME(fontfilename); +gotafp: +{ + int m0=0,m1=0; + m0=fgetc(fp); + m1=fgetc(fp); + if (m0 == EOF || m1 == EOF ) { + FIM_FPRINTF(ff_stderr, "problems reading two first bytes from %s.\n",fontfilename); + goto oops; + } + if (m0 == FIM_PSF2_MAGIC0 && m1 == FIM_PSF2_MAGIC1 ) { + FIM_FPRINTF(ff_stderr, "can't use font %s: first two magic bytes (0x%x 0x%x) conform to PSF version 2, which is unsupported.\n",fontfilename,m0,m1); + goto oops; + } + if (m0 != FIM_PSF1_MAGIC0 || m1 != FIM_PSF1_MAGIC1 ) { + FIM_FPRINTF(ff_stderr, "can't use font %s: first two magic bytes (0x%x 0x%x) not conforming to PSF version 1\n",fontfilename,m0,m1); + goto oops; + } +} +// FIM_FPRINTF(ff_stderr, "using linux console font \"%s\"\n",filename[i]); + + f_ =(struct fs_font*) fim_calloc(1,sizeof(*f_)); + if(!f_)goto aoops; + + fgetc(fp); + f_->maxenc = 256; + f_->width = 8; /* FIXME */ + f_->height = fgetc(fp); + if(f_->height<0 || f_->height>FIM_MAX_FONT_HEIGHT) goto oops; + f_->fontHeader.min_bounds.left = 0; + f_->fontHeader.max_bounds.right = f_->width; + f_->fontHeader.max_bounds.descent = 0; + f_->fontHeader.max_bounds.ascent = f_->height; + + f_->glyphs =(fim_byte_t*) fim_malloc(f_->height * 256); + if(!f_->glyphs) goto aoops; + f_->extents = (FSXCharInfo*)fim_malloc(sizeof(FSXCharInfo)*256); + if(!f_->extents) goto aoops; + fr=fread(f_->glyphs, 256, f_->height, fp); + if(!fr)goto aoops;/* new */ + fclose(fp);fp=FIM_NULL; + + f_->eindex =(FSXCharInfo**) fim_malloc(sizeof(FSXCharInfo*) * 256); + if(!f_->eindex) goto aoops; + f_->gindex = (fim_byte_t**)fim_malloc(sizeof(fim_byte_t*) * 256); + if(!f_->gindex) goto aoops; + for (i = 0; i < 256; i++) { + f_->eindex[i] = f_->extents +i; + f_->gindex[i] = f_->glyphs +i * f_->height; + f_->eindex[i]->left = 0; + f_->eindex[i]->right = 7; + f_->eindex[i]->width = 8;/* FIXME */ + f_->eindex[i]->descent = 0; + f_->eindex[i]->ascent = f_->height; + } + return f_; +aoops: + robmn=false;/* no retry: this is a allocation-related oops */ + if(f_) + fim_free_fs_font(f_); +oops: + if(fp){fclose(fp);fp=FIM_NULL;} + if(robmn && filename[0] && filename[1]){++filename;goto scanlistforafontfile;}else robmn=false; + return FIM_NULL; +} +#endif + + + + +} + + diff --git a/src/FontServer.h b/src/FontServer.h new file mode 100644 index 0000000..5a40643 --- /dev/null +++ b/src/FontServer.h @@ -0,0 +1,135 @@ +/* $LastChangedDate: 2016-01-12 18:49:21 +0100 (Tue, 12 Jan 2016) $ */ +/* + FontServer.h : Font Server code from fbi, adapted for fim. + + (c) 2008-2016 Michele Martone + (c) 1998-2006 Gerd Knorr + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +/* + * This file comes from fbi, and will undergo severe reorganization. + * */ + + +#ifndef FIM_FONT_SERVER_H +#define FIM_FONT_SERVER_H + +#include "fim.h" + +# include +# include //for FIM_NULL +# include //for stderr.. +# include //for exit.. +# include //for strlen.. +namespace fim +{ + + +#ifdef FIM_USE_X11_FONTS +# include + +struct fs_font { + Font font; + FSXFontInfoHeader fontHeader; + FSPropInfo propInfo; + FSPropOffset *propOffsets; + fim_byte_t *propData; + + FSXCharInfo *extents; + FSOffset *offsets; + fim_byte_t *glyphs; + + int maxenc,width,height; + FSXCharInfo **eindex; + fim_byte_t **gindex; +}; + +#else /* FIM_USE_X11_FONTS */ + +#define fim_fmf FIM_FONT_MAGNIFY_FACTOR + +typedef struct _FSXCharInfo { + short left; + short right; + short width; + short ascent; + short descent; + /*unsigned short attributes;*/ + int swidth(void)const{return fim_fmf*width;} +} FSXCharInfo; + +typedef struct _FSXFontInfoHeader { + /*int flags; + //FSRange char_range; + //unsigned draw_direction; + //FSChar2b default_char; + */ + FSXCharInfo min_bounds; + FSXCharInfo max_bounds; + short font_ascent; + short font_descent; +} FSXFontInfoHeader; + +struct fs_font { + FSXFontInfoHeader fontHeader; + /*fim_byte_t *propData;*/ + FSXCharInfo *extents; + fim_byte_t *glyphs; + int maxenc,width,height; + FSXCharInfo **eindex; + fim_byte_t **gindex; + int swidth(void)const{return fim_fmf*width;} + int sheight(void)const{return fim_fmf*height;} +}; + +#endif /* FIM_USE_X11_FONTS */ + + + + + +static const unsigned fs_masktab[] = { + (1 << 7), (1 << 6), (1 << 5), (1 << 4), + (1 << 3), (1 << 2), (1 << 1), (1 << 0), +}; + + + +fim::string get_default_font_list(void); + +class FontServer +{ + + +public: + FontServer( ); + +#if 1 +/* 20080507 unused, as default_font ? */ +static void fb_text_init1(const fim_char_t *font, struct fs_font **_f); + +static struct fs_font* fs_consolefont(const fim_char_t **filename); +#endif + + + +}; +void fim_free_fs_font(struct fs_font *f_); /* FIXME: temporarily here */ + +} + +#endif /* FIM_FONT_SERVER_H */ + diff --git a/src/FramebufferDevice.cpp b/src/FramebufferDevice.cpp new file mode 100644 index 0000000..116ffc0 --- /dev/null +++ b/src/FramebufferDevice.cpp @@ -0,0 +1,1929 @@ +/* $LastChangedDate: 2015-12-19 01:44:41 +0100 (Sat, 19 Dec 2015) $ */ +/* + FramebufferDevice.cpp : Linux Framebuffer functions from fbi, adapted for fim + + (c) 2007-2015 Michele Martone + (c) 1998-2006 Gerd Knorr + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +/* + * This file comes from fbi, and will undergo severe reorganization. + * */ + +#include "FbiStuffFbtools.h" +#include "FramebufferDevice.h" + +#ifdef FIM_WITH_NO_FRAMEBUFFER +static void foo(){} /* let's make our compiler happy */ +#else /* FIM_WITH_NO_FRAMEBUFFER */ + +#if HAVE_LINUX_KD_H +# include // KDGETMODE, KDSETMODE, KD_GRAPHICS, ... +#endif /* HAVE_LINUX_KD_H */ +#if HAVE_LINUX_VT_H +# include // VT_GETSTATE, .. +#endif /* HAVE_LINUX_VT_H */ +#ifdef HAVE_SYS_USER_H +# include // for PAGE_MASK (sometimes it is needed to include it here explicitly) +#else /* HAVE_SYS_USER_H */ +# error missing ! +#endif /* HAVE_SYS_USER_H */ +#ifdef HAVE_SYS_MMAN_H +# include // PROT_READ, PROT_WRITE, MAP_SHARED +#else /* HAVE_SYS_MMAN_H */ +# error missing ! +#endif /* HAVE_SYS_MMAN_H */ +#include +#ifdef HAVE_SYS_IOCTL_H +# include +#else /* HAVE_SYS_IOCTL_H */ +# error missing ! +#endif /* HAVE_SYS_IOCTL_H */ + +//#include +//#include +//#include +//#include +//#include + +/*#include */ /* seems like this gives problems */ +#if 0 +#include /* added by dez. missing when compiling with -ansi */ +#include /* added by dez. missing when compiling with -ansi */ +#endif + + +namespace fim +{ + +#define FIM_DEBUGGING_FOR_ARM_WITH_VITALY 0 +#define FIM_FBI_FB_MODES_LINE_BUFSIZE 80 +#define FIM_FBI_FB_MODES_LABEL_BUFSIZE 32 +#define FIM_FBI_FB_MODES_VALUE_BUFSIZE 16 +/* + this code will be enabled by default if we can make sure it + won't break often with kernel updates */ +#if FIM_DEBUGGING_FOR_ARM_WITH_VITALY + +static void print_vinfo(struct fb_var_screeninfo *vinfo) +{ + FIM_FPRINTF(stderr, "Printing vinfo:\n"); + FIM_FPRINTF(stderr, "\txres: %d\n", vinfo->xres); + FIM_FPRINTF(stderr, "\tyres: %d\n", vinfo->yres); + FIM_FPRINTF(stderr, "\txres_virtual: %d\n", vinfo->xres_virtual); + FIM_FPRINTF(stderr, "\tyres_virtual: %d\n", vinfo->yres_virtual); + FIM_FPRINTF(stderr, "\txoffset: %d\n", vinfo->xoffset); + FIM_FPRINTF(stderr, "\tyoffset: %d\n", vinfo->yoffset); + FIM_FPRINTF(stderr, "\tbits_per_pixel: %d\n", vinfo->bits_per_pixel); + FIM_FPRINTF(stderr, "\tgrayscale: %d\n", vinfo->grayscale); + FIM_FPRINTF(stderr, "\tnonstd: %d\n", vinfo->nonstd); + FIM_FPRINTF(stderr, "\tactivate: %d\n", vinfo->activate); + FIM_FPRINTF(stderr, "\theight: %d\n", vinfo->height); + FIM_FPRINTF(stderr, "\twidth: %d\n", vinfo->width); + FIM_FPRINTF(stderr, "\taccel_flags: %d\n", vinfo->accel_flags); + FIM_FPRINTF(stderr, "\tpixclock: %d\n", vinfo->pixclock); + FIM_FPRINTF(stderr, "\tleft_margin: %d\n", vinfo->left_margin); + FIM_FPRINTF(stderr, "\tright_margin: %d\n", vinfo->right_margin); + FIM_FPRINTF(stderr, "\tupper_margin: %d\n", vinfo->upper_margin); + FIM_FPRINTF(stderr, "\tlower_margin: %d\n", vinfo->lower_margin); + FIM_FPRINTF(stderr, "\thsync_len: %d\n", vinfo->hsync_len); + FIM_FPRINTF(stderr, "\tvsync_len: %d\n", vinfo->vsync_len); + FIM_FPRINTF(stderr, "\tsync: %d\n", vinfo->sync); + FIM_FPRINTF(stderr, "\tvmode: %d\n", vinfo->vmode); + FIM_FPRINTF(stderr, "\tred: %d/%d\n", vinfo->red.length, vinfo->red.offset); + FIM_FPRINTF(stderr, "\tgreen: %d/%d\n", vinfo->green.length, vinfo->green.offset); + FIM_FPRINTF(stderr, "\tblue: %d/%d\n", vinfo->blue.length, vinfo->blue.offset); + FIM_FPRINTF(stderr, "\talpha: %d/%d\n", vinfo->transp.length, vinfo->transp.offset); +} + +static void print_finfo(struct fb_fix_screeninfo *finfo) +{ + FIM_FPRINTF(stderr, "Printing finfo:\n"); + FIM_FPRINTF(stderr, "\tsmem_start = %p\n", (void *)finfo->smem_start); + FIM_FPRINTF(stderr, "\tsmem_len = %d\n", finfo->smem_len); + FIM_FPRINTF(stderr, "\ttype = %d\n", finfo->type); + FIM_FPRINTF(stderr, "\ttype_aux = %d\n", finfo->type_aux); + FIM_FPRINTF(stderr, "\tvisual = %d\n", finfo->visual); + FIM_FPRINTF(stderr, "\txpanstep = %d\n", finfo->xpanstep); + FIM_FPRINTF(stderr, "\typanstep = %d\n", finfo->ypanstep); + FIM_FPRINTF(stderr, "\tywrapstep = %d\n", finfo->ywrapstep); + FIM_FPRINTF(stderr, "\tline_length = %d\n", finfo->line_length); + FIM_FPRINTF(stderr, "\tmmio_start = %p\n", (void *)finfo->mmio_start); + FIM_FPRINTF(stderr, "\tmmio_len = %d\n", finfo->mmio_len); + FIM_FPRINTF(stderr, "\taccel = %d\n", finfo->accel); +} +#endif /* FIM_DEBUGGING_FOR_ARM_WITH_VITALY */ + +#define DITHER_LEVEL 8 + +typedef unsigned long vector[DITHER_LEVEL]; +typedef vector matrix[DITHER_LEVEL]; + +//#if DITHER_LEVEL == 8 || DITHER_LEVEL == 4 +//static int matrix DM ; +//#endif +#if DITHER_LEVEL == 8 +#define DITHER_MASK 7 +static matrix DM = +{ + {0, 32, 8, 40, 2, 34, 10, 42}, + {48, 16, 56, 24, 50, 18, 58, 26}, + {12, 44, 4, 36, 14, 46, 6, 38}, + {60, 28, 52, 20, 62, 30, 54, 22}, + {3, 35, 11, 43, 1, 33, 9, 41}, + {51, 19, 59, 27, 49, 17, 57, 25}, + {15, 47, 7, 39, 13, 45, 5, 37}, + {63, 31, 55, 23, 61, 29, 53, 21} +}; + +#endif /* DITHER_LEVEL */ + +#if DITHER_LEVEL == 4 +#define DITHER_MASK 3 +static matrix DM = +{ + {0, 8, 2, 10}, + {12, 4, 14, 6}, + {3, 11, 1, 9}, + {15, 7, 13, 5} +}; + +#endif /* DITHER_LEVEL */ + + + + +static FramebufferDevice *ffdp; + +static void _fb_switch_signal(int signal) +{ + // WARNING : THIS IS A DIRTY HACK + // necessary to enable framebuffer console switching + ffdp->fb_switch_signal(signal); +} + +fim_err_t FramebufferDevice::fs_puts(struct fs_font *f_, fim_coo_t x, fim_coo_t y, const fim_char_t *str) +{ + fim_byte_t *pos,*start; + int i,c,j,w; + + pos = fb_mem_+fb_mem_offset_; + pos += fb_fix_.line_length * y; + for (i = 0; str[i] != '\0'; i++) { + c = (fim_byte_t)str[i]; + if (FIM_NULL == f_->eindex[c]) + continue; + /* clear with bg color */ + start = pos + x*fs_bpp_ + f_->fontHeader.max_bounds.descent * fb_fix_.line_length; + w = (f_->eindex[c]->width+1)*fs_bpp_; +#ifdef FIM_IS_SLOWER_THAN_FBI + for (j = 0; j < f_->height; j++) { +///// memset_combine(start,0x20,w); + fim_bzero(start,w); + start += fb_fix_.line_length; + } +#else /* FIM_IS_SLOWER_THAN_FBI */ + //sometimes we can gather multiple calls.. + if(fb_fix_.line_length==(unsigned int)w) + { + //contiguous case + fim_bzero(start,w*f_->height); + start += fb_fix_.line_length*f_->height; + } + else + for (j = 0; j < f_->height; j++) { + fim_bzero(start,w); + start += fb_fix_.line_length; + } +#endif /* FIM_IS_SLOWER_THAN_FBI */ + /* draw character */ + start = pos + x*fs_bpp_ + fb_fix_.line_length * (f_->height-f_->eindex[c]->ascent); + fs_render_fb(start,fb_fix_.line_length,f_->eindex[c],f_->gindex[c]); + x += f_->eindex[c]->width; + if (x > fb_var_.xres - f_->width) + return FIM_ERR_GENERIC; + } + //return x;//FIXME + return FIM_ERR_NO_ERROR; +} + +void FramebufferDevice::fs_render_fb(fim_byte_t *ptr, int pitch, FSXCharInfo *charInfo, fim_byte_t *data) +{ + +/* + * These preprocessor macros should serve *only* for font handling purposes. + * */ +#define BIT_ORDER BitmapFormatBitOrderMSB +#ifdef BYTE_ORDER +#undef BYTE_ORDER +#endif /* BYTE_ORDER */ +#define BYTE_ORDER BitmapFormatByteOrderMSB +#define SCANLINE_UNIT BitmapFormatScanlineUnit8 +#define SCANLINE_PAD BitmapFormatScanlinePad8 +#define EXTENTS BitmapFormatImageRectMin + +#define SCANLINE_PAD_BYTES 1 +#define GLWIDTHBYTESPADDED(bits, nBytes) \ + ((nBytes) == 1 ? (((bits) + 7) >> 3) /* pad to 1 byte */\ + :(nBytes) == 2 ? ((((bits) + 15) >> 3) & ~1) /* pad to 2 bytes */\ + :(nBytes) == 4 ? ((((bits) + 31) >> 3) & ~3) /* pad to 4 bytes */\ + :(nBytes) == 8 ? ((((bits) + 63) >> 3) & ~7) /* pad to 8 bytes */\ + : 0) + + int row,bit,bpr,x; + + bpr = GLWIDTHBYTESPADDED((charInfo->right - charInfo->left), + SCANLINE_PAD_BYTES); + for (row = 0; row < (charInfo->ascent + charInfo->descent); row++) { + for (x = 0, bit = 0; bit < (charInfo->right - charInfo->left); bit++) { + if (data[bit>>3] & fs_masktab[bit&7]) + // WARNING ! + fs_setpixel(ptr+x,fs_white_); + x += fs_bpp_; + } + data += bpr; + ptr += pitch; + } + +#undef BIT_ORDER +#undef BYTE_ORDER +#undef SCANLINE_UNIT +#undef SCANLINE_PAD +#undef EXTENTS +#undef SCANLINE_PAD_BYTES +#undef GLWIDTHBYTESPADDED +} + + + fim_err_t FramebufferDevice::framebuffer_init(void) + { + int rc=0; + + //initialization of the framebuffer text + FontServer::fb_text_init1(fontname_,&f_); // FIXME : move this outta here + /* + * will initialize with the user set (or default ones) + * - framebuffer device + * - framebuffer mode + * - virtual terminal + * */ + fd_ = fb_init(fbdev_, fbmode_, vt_); + if(fd_==-1) + fd_ = fb_init(fbdev_, fbmode_, vt_,0xbabebabe==0xbabebabe);//maybe we are under screen.. + if(fd_==-1) + exit(1); + //return -1;//this is a TEMPORARY and DEAF,DUMB, AND BLIND bug noted by iam + //setting signals to handle in the right ways signals + fb_catch_exit_signals(); + fb_switch_init(); + /* + * C-z is inhibited now (for framebuffer's screen safety!) + */ + signal(SIGTSTP,SIG_IGN); + //signal(SIGSEGV,cleanup(); + //set text color to white ? + + //initialization of the framebuffer device handlers + if((rc=fb_text_init2()))return rc; + + switch (fb_var_.bits_per_pixel) { + case 8: + svga_dither_palette(8, 8, 4); + dither_ = FIM_FBI_TRUE; + init_dither(8, 8, 4, 2); + break; + case 15: + case 16: + if (fb_fix_.visual == FB_VISUAL_DIRECTCOLOR) + linear_palette(5); + if (fb_var_.green.length == 5) { + lut_init(15); + } else { + lut_init(16); + } + break; + case 24: + if (fb_fix_.visual == FB_VISUAL_DIRECTCOLOR) + linear_palette(8); + break; + case 32: + if (fb_fix_.visual == FB_VISUAL_DIRECTCOLOR) + linear_palette(8); + lut_init(24); + break; + default: + FIM_FPRINTF(stderr, "Oops: %i bit/pixel ???\n", + fb_var_.bits_per_pixel); + std::exit(1); + } + if (fb_fix_.visual == FB_VISUAL_DIRECTCOLOR || + fb_var_.bits_per_pixel == 8) + { + if (-1 == ioctl(fd_,FBIOPUTCMAP,&cmap_)) { + fim_perror("ioctl FBIOPUTCMAP"); + std::exit(1); + } + } + return FIM_ERR_NO_ERROR; + } + +void FramebufferDevice::dev_init(void) +{ + struct stat dummy; + + if (FIM_NULL != devices_) + return; + if (0 == stat("/dev/.devfsd",&dummy)) + devices_ = &devs_devfs_; + else + devices_ = &devs_default_; + +} + + +void FramebufferDevice::console_switch(fim_bool_t is_busy) +{ + //FIXME + switch (fb_switch_state_) { + case FB_REL_REQ: + fb_switch_release(); + case FB_INACTIVE: + visible_ = 0; + break; + case FB_ACQ_REQ: + fb_switch_acquire(); + case FB_ACTIVE: + //when stepping in console.. + visible_ = 1; + ioctl(fd_,FBIOPAN_DISPLAY,&fb_var_); + redraw_ = FIM_REDRAW_NECESSARY; + /* + * thanks to the next line, the image is redrawn each time + * the console is switched! + */ +#ifndef FIM_WANT_NO_OUTPUT_CONSOLE + mc_.cc_.redisplay(); +#endif /* FIM_WANT_NO_OUTPUT_CONSOLE */ + //if (is_busy) status("busy, please wait ...", FIM_NULL); + break; + default: + break; + } + switch_last_ = fb_switch_state_; + return; +} + +//void FramebufferDevice::svga_display_image_new(struct ida_image *img, int xoff, int yoff,unsigned int bx,unsigned int bw,unsigned int by,unsigned int bh,int mirror,int flip) +void FramebufferDevice::svga_display_image_new( + struct ida_image *img, + int yoff, + int xoff, + int irows,int icols,// rows and columns in the input image + int icskip, // input columns to skip for each line + unsigned int by, + unsigned int bx, + unsigned int bh, + unsigned int bw, + int ocskip,// output columns to skip for each line + int flags) +{ +/* bx is the box's x origin + * by is the box's y origin + * bw is the box's width + * bh is the box's heigth + * */ + + /* + * WARNING : SHOULD ASSeRT BX+BW < FB_VAR.XReS ..!! + * */ + unsigned int dwidth = FIM_MIN(img->i.width, bw); + unsigned int dheight = FIM_MIN(img->i.height, bh); + unsigned int data, video, bank, offset, bytes, y; + int yo=(bh-dheight)/2; + int xo=(bw-dwidth )/2; + int cxo=bw-dwidth-xo; + //int cyo=bh-yo; + int mirror=flags&FIM_FLAG_MIRROR, flip=flags&FIM_FLAG_FLIP; + + if (!visible_)/*COMMENT THIS IF svga_display_image IS NOT IN A CYCLE*/ + return; + /*fb_clear_screen();//EXPERIMENTAL + if(xoff&&yoff)clear_rect(0,xoff,0,yoff);*/ + + bytes = FB_BPP; + + /* offset for image data (image > screen, select visible area) */ + offset = (yoff * img->i.width + xoff) * 3; + + /* offset for video memory (image < screen, center image) */ + video = 0, bank = 0; + video += FB_BPP * (bx); + if (img->i.width < bw) + { + video += FB_BPP * (xo); + } + + video += fb_fix_.line_length * (by); + if (img->i.height < bh ) + { + video += fb_fix_.line_length * (yo); + } + + if (dheight < bh ) + { + /* clear by lines */ +#ifdef FIM_FASTER_CLEARLINES + if(bw==fb_var_.xres && bx==0) + { + /* + * +------------------------------+ + * | whole screen line clear join | + * +------------------------------+ + */ + // wide screen clear + { clear_line(FB_BPP, by, bw*(bh), FB_MEM(bx,by)); } + + //top and bottom lines clear : maybe better + //{ clear_line(FB_BPP, by, bw*(yo), FB_MEM(bx,by)); } + //{ clear_line(FB_BPP, by+yo, bw*(dheight), FB_MEM(bx,by+yo)); } + //{ clear_line(FB_BPP, by+dheight+yo, bw*(bh-yo-dheight), FB_MEM(bx,by+yo+dheight)); } + } + else +#endif /* FIM_FASTER_CLEARLINES */ + { + for ( y = by; y < by+yo;++y) { clear_line(FB_BPP, y, bw, FB_MEM(bx,y)); } + for ( y = by+dheight+yo; y < by+bh;++y) { clear_line(FB_BPP, y, bw, FB_MEM(bx,y)); } + } + } + + if (dwidth < bw ) + { +#ifdef FIM_FASTER_CLEARLINES + if(bw==fb_var_.xres && bx==0) + { + if (dheight >= bh ) + clear_line(FB_BPP, by, bw*(bh), FB_MEM(bx,by)); + } + else +#endif /* FIM_FASTER_CLEARLINES */ + for ( y = by; y < by+bh;++y) + { + clear_line(FB_BPP, y, xo, FB_MEM(bx,y)); + clear_line(FB_BPP, y, cxo,FB_MEM(bx+xo+dwidth,y)); + } + } + /*for ( y = 0; y < fb_var_.yres;y+=100)fb_line(0, fb_var_.xres, y, y);*/ + + /* go ! */ + /*flip patch*/ +#ifndef min +#define min(x,y) ((x)<(y)?(x):(y)) +#endif /* min */ + //int fb_fix_line_length=FB_MEM_LINE_OFFSET; + int fb_fix_line_length=fb_fix_.line_length; + if(flip) { fb_fix_line_length*=-1; video += (min(img->i.height,dheight)-1)*(fb_fix_.line_length);} + /*flip patch*/ + /* FIXME : COMPLETE ME ... */ + +#ifndef FIM_IS_SLOWER_THAN_FBI + fim_byte_t *(FramebufferDevice::*convert_line_f)(int , int , int , fim_byte_t *, fim_byte_t *, int ); + if(fb_var_.bits_per_pixel==8) + convert_line_f=&fim::FramebufferDevice::convert_line_8; + else + convert_line_f=&fim::FramebufferDevice::convert_line; +#endif /* FIM_IS_SLOWER_THAN_FBI */ + + for (data = 0, y = by; + data < img->i.width * img->i.height * 3 + && data / img->i.width / 3 < dheight; + data += img->i.width * 3, video += fb_fix_line_length) + { +#ifndef FIM_IS_SLOWER_THAN_FBI + (this->*convert_line_f) +#else + convert_line +#endif /* FIM_IS_SLOWER_THAN_FBI */ + (fb_var_.bits_per_pixel, y++, dwidth, + fb_mem_+video, img->data + data + offset,mirror);/*<- mirror patch*/ + } +} + +int FramebufferDevice::fb_init(const fim_char_t *device, fim_char_t *mode, int vt_, int try_boz_patch) +{ + /* + * This member function will probe for a valid framebuffer device. + * + * The try_boz_patch will make fim go straight ahead ignoring lots of errors. + * Like the ones when running fim under screen. + * Like the ones when running fim under X. :) + * */ + fim_char_t fbdev_[FIM_FBDEV_FILE_MAX_CHARS]; + struct vt_stat vts; + + dev_init(); + tty_ = 0; + if (vt_ != 0) + fb_setvt(vt_); + +#ifdef FIM_BOZ_PATCH + if(!try_boz_patch) +#endif /* FIM_BOZ_PATCH */ + if (-1 == ioctl(tty_,VT_GETSTATE, &vts)) { + FIM_FPRINTF(stderr, "ioctl VT_GETSTATE: %s (not a linux console?)\n", + strerror(errno)); + return -1; +// exit(1); + } + + /* no device supplied ? we will probe for one */ + if (FIM_NULL == device) { + device = fim_getenv(FIM_ENV_FRAMEBUFFER); + /* no environment - supplied device ? */ + if (FIM_NULL == device) { + struct fb_con2fbmap c2m; + if (-1 == (fb_ = open(devices_->fb0,O_RDWR /* O_WRONLY */,0))) { + FIM_FPRINTF(stderr, "open %s: %s\n",devices_->fb0,strerror(errno)); + fim_perror(FIM_NULL); + exit(1); + } + c2m.console = vts.v_active; +#ifdef FIM_BOZ_PATCH + if(!try_boz_patch){ +#endif /* FIM_BOZ_PATCH */ + if (-1 == ioctl(fb_, FBIOGET_CON2FBMAP, &c2m)) { + fim_perror("ioctl FBIOGET_CON2FBMAP"); + exit(1); + } + close(fb_); +/* FIM_FPRINTF(stderr, "map: vt%02d => fb%d\n", + c2m.console,c2m.framebuffer);*/ + sprintf(fbdev_,devices_->fbnr,c2m.framebuffer); + device = fbdev_; +#ifdef FIM_BOZ_PATCH + } + else + device = "/dev/fb0"; +#endif /* FIM_BOZ_PATCH */ + } + } + + /* get current settings (which we have to restore) */ + if (-1 == (fb_ = open(device,O_RDWR /* O_WRONLY */))) { + FIM_FPRINTF(stderr, "open %s: %s\n",device,strerror(errno)); + fim_perror(FIM_NULL); + exit(1); + } + if (-1 == ioctl(fb_,FBIOGET_VSCREENINFO,&fb_ovar_)) { + fim_perror("ioctl FBIOGET_VSCREENINFO"); + exit(1); + } +#if FIM_DEBUGGING_FOR_ARM_WITH_VITALY + print_vinfo(&fb_ovar_); +#endif /* FIM_DEBUGGING_FOR_ARM_WITH_VITALY */ + if (-1 == ioctl(fb_,FBIOGET_FSCREENINFO,&fb_fix_)) { + fim_perror("ioctl FBIOGET_FSCREENINFO"); + exit(1); + } +#if FIM_DEBUGGING_FOR_ARM_WITH_VITALY + print_finfo(&fb_fix_); +#endif /* FIM_DEBUGGING_FOR_ARM_WITH_VITALY */ + if (fb_ovar_.bits_per_pixel == 8 || + fb_fix_.visual == FB_VISUAL_DIRECTCOLOR) { + if (-1 == ioctl(fb_,FBIOGETCMAP,&ocmap_)) { + fim_perror("ioctl FBIOGETCMAP"); + exit(1); + } + } +#ifdef FIM_BOZ_PATCH + if(!try_boz_patch) +#endif /* FIM_BOZ_PATCH */ + if (-1 == ioctl(tty_,KDGETMODE, &kd_mode_)) { + fim_perror("ioctl KDGETMODE"); + exit(1); + } +#ifdef FIM_BOZ_PATCH + if(!try_boz_patch) +#endif /* FIM_BOZ_PATCH */ + if (-1 == ioctl(tty_,VT_GETMODE, &vt_omode_)) { + fim_perror("ioctl VT_GETMODE"); + exit(1); + } + tcgetattr(tty_, &term_); + + /* switch mode */ + if(-1 == fb_setmode(mode)){ +#if 0 + /* + * FIXME: + * mm's strict mode ckecking (right now, this function triggers an exit() but things should change) */ +#ifdef FIM_BOZ_PATCH + if(!try_boz_patch) +#endif /* FIM_BOZ_PATCH */ + { + fim_perror("failed setting mode"); + exit(1); + } +#endif + } + + + /* checks & initialisation */ + if (-1 == ioctl(fb_,FBIOGET_FSCREENINFO,&fb_fix_)) { + fim_perror("ioctl FBIOGET_FSCREENINFO"); + exit(1); + } + if (fb_fix_.type != FB_TYPE_PACKED_PIXELS) { + FIM_FPRINTF(stderr, "can handle only packed pixel frame buffers\n"); + goto err; + } +#if 0 + switch (fb_var_.bits_per_pixel) { + case 8: + white = 255; black = 0; bpp = 1; + break; + case 15: + case 16: + if (fb_var_.green.length == 6) + white = 0xffff; + else + white = 0x7fff; + black = 0; bpp = 2; + break; + case 24: + white = 0xffffff; black = 0; bpp = fb_var_.bits_per_pixel/8; + break; + case 32: + white = 0xffffff; black = 0; bpp = fb_var_.bits_per_pixel/8; + fb_setpixels = fb_setpixels4; + break; + default: + FIM_FPRINTF(stderr, "Oops: %i bit/pixel ???\n", + fb_var_.bits_per_pixel); + goto err; + } +#endif +#ifdef PAGE_MASK + fb_mem_offset_ = (unsigned int)(fb_fix_.smem_start) & (~PAGE_MASK); +#else /* PAGE_MASK */ + /* some systems don't have this symbol outside their kernel headers - will do any harm ? */ + /* FIXME : what are the wider implications of this ? */ + fb_mem_offset_ = 0; +#endif /* PAGE_MASK */ + fb_mem_ = (fim_byte_t*) mmap(FIM_NULL,fb_fix_.smem_len+fb_mem_offset_, + PROT_READ|PROT_WRITE,MAP_SHARED,fb_,0); +#ifdef MAP_FAILED + if (fb_mem_ == MAP_FAILED) +#else + if (-1L == (long)fb_mem_) /* TODO: remove this */ +#endif + { + fim_perror("mmap failed"); + goto err; + } + /* move viewport to upper left corner */ + if (fb_var_.xoffset != 0 || fb_var_.yoffset != 0) { + fb_var_.xoffset = 0; + fb_var_.yoffset = 0; + if (-1 == ioctl(fb_,FBIOPAN_DISPLAY,&fb_var_)) { + fim_perror("ioctl FBIOPAN_DISPLAY"); + goto err; + } + } +#ifdef FIM_BOZ_PATCH + if(!try_boz_patch) +#endif /* FIM_BOZ_PATCH */ + if (-1 == ioctl(tty_,KDSETMODE, KD_GRAPHICS)) { + fim_perror("ioctl KDSETMODE"); + goto err; + } + fb_activate_current(tty_); + + /* cls */ + fb_memset(fb_mem_+fb_mem_offset_,0,fb_fix_.smem_len); + +#ifdef FIM_BOZ_PATCH + with_boz_patch_=try_boz_patch; +#endif /* FIM_BOZ_PATCH */ + return fb_; + + err: + cleanup(); + exit(1); + return -1; +} + +void FramebufferDevice::fb_memset (void *addr, int c, size_t len) +{ +#if 1 /* defined(__powerpc__) */ + unsigned int i; + + i = (c & 0xff) << 8; + i |= i << 16; + len >>= 2; /* FIXME : WHY ? */ +#ifdef FIM_IS_SLOWER_THAN_FBI + unsigned int *p; + for (p = (unsigned int*) addr; len--; p++) + *p = i; +#else /* FIM_IS_SLOWER_THAN_FBI */ + fim_memset(addr, i, len ); +#endif /* FIM_IS_SLOWER_THAN_FBI */ +#else + fim_memset(addr, c, len); +#endif +} + +void FramebufferDevice::fb_setvt(int vtno) +{ + struct vt_stat vts; + fim_char_t vtname[12]; + + if (vtno < 0) { + if (-1 == ioctl(tty_,VT_OPENQRY, &vtno) || vtno == -1) { + fim_perror("ioctl VT_OPENQRY"); + exit(1); + } + } + + vtno &= 0xff; + sprintf(vtname, devices_->ttynr, vtno); + if ( chown(vtname, getuid(), getgid())){ + FIM_FPRINTF(stderr, "chown %s: %s\n",vtname,strerror(errno)); + exit(1); + } + if (-1 == access(vtname, R_OK | W_OK)) { + FIM_FPRINTF(stderr, "access %s: %s\n",vtname,strerror(errno)); + exit(1); + } + switch (fork()) { + case 0: + break; + case -1: + fim_perror("fork"); + exit(1); + default: + exit(0); + } + close(tty_); + close(0); + close(1); + close(2); + setsid(); + + if( -1 == open(vtname,O_RDWR) ) + { + fim_perror(FIM_NULL); + } + { + /* on some systems, we get 'int dup(int)', declared with attribute warn_unused_result */ + int ndd; + ndd = dup(0); + ndd = dup(0); + } + +#ifdef FIM_BOZ_PATCH + if(!with_boz_patch_) +#endif /* FIM_BOZ_PATCH */ + if (-1 == ioctl(tty_,VT_GETSTATE, &vts)) { + fim_perror("ioctl VT_GETSTATE"); + exit(1); + } + orig_vt_no_ = vts.v_active; + if (-1 == ioctl(tty_,VT_ACTIVATE, vtno)) { + fim_perror("ioctl VT_ACTIVATE"); + exit(1); + } + if (-1 == ioctl(tty_,VT_WAITACTIVE, vtno)) { + fim_perror("ioctl VT_WAITACTIVE"); + exit(1); + } +} + +int FramebufferDevice::fb_setmode(fim_char_t *name) +{ + FILE *fp; + fim_char_t line[FIM_FBI_FB_MODES_LINE_BUFSIZE], + label[FIM_FBI_FB_MODES_LABEL_BUFSIZE], + value[FIM_FBI_FB_MODES_VALUE_BUFSIZE]; + int geometry=0, timings=0; + int retval = 0; + + /* load current values */ + if (-1 == ioctl(fb_,FBIOGET_VSCREENINFO,&fb_var_)) { + fim_perror("ioctl FBIOGET_VSCREENINFO"); + exit(1); + } + + +#if 0 +#ifdef FIM_WANTS_DOUBLE_BUFFERING + /* FIXME : the page flipping mechanisms missing (unfinished) + * please note that in addition to this code, we should also + * specify timing parameters. + * The following is experimental code only. + * Note that on the developement machine neither fbset does work! + */ + fb_var_.xres_virtual = fb_var_.xres ; + fb_var_.yres_virtual = fb_var_.yres ; + fb_var_.yres_virtual = fb_var_.yres * 2; + //printf("%d %d %d %d\n", fb_var_.xres_virtual,fb_var_.xres, fb_var_.yres_virtual,fb_var_.yres); + fb_var_.activate = FB_ACTIVATE_NOW; + fb_var_.accel_flags = 0; + /* ... */ + if (-1 == ioctl(fb_,FBIOPUT_VSCREENINFO,&fb_var_)) + fim_perror("ioctl FBIOPUT_VSCREENINFO"),printf("!failed\n"); + printf("%d %d %d %d\n", fb_var_.xres_virtual,fb_var_.xres, fb_var_.yres_virtual,fb_var_.yres); +#endif +#endif + /* name="640x480-72"; */ + + if (FIM_NULL == name) + { + goto err; + } + if (FIM_NULL == (fp = fopen("/etc/fb.modes","r"))) + { + goto err; + } + while (FIM_NULL != fgets(line,FIM_FBI_FB_MODES_LINE_BUFSIZE-1,fp)) { + if (1 == sscanf(line, "mode \"%31[^\"]\"",label) && + 0 == strcmp(label,name)) { + /* fill in new values */ + fb_var_.sync = 0; + fb_var_.vmode = 0; + while (FIM_NULL != fgets(line,FIM_FBI_FB_MODES_LINE_BUFSIZE-1,fp) && + FIM_NULL == strstr(line,"endmode")) { +// if (5 == sscanf(line," geometry %d %d %d %d %d", + if (5 == sscanf(line," geometry %u %u %u %u %u", + &fb_var_.xres,&fb_var_.yres, + &fb_var_.xres_virtual,&fb_var_.yres_virtual, + &fb_var_.bits_per_pixel)) + geometry = 1; +// if (7 == sscanf(line," timings %d %d %d %d %d %d %d", + if (7 == sscanf(line," timings %u %u %u %u %u %u %u", + &fb_var_.pixclock, + &fb_var_.left_margin, &fb_var_.right_margin, + &fb_var_.upper_margin, &fb_var_.lower_margin, + &fb_var_.hsync_len, &fb_var_.vsync_len)) + timings = 1; + if (1 == sscanf(line, " hsync %15s",value) && + 0 == strcasecmp(value,"high")) + fb_var_.sync |= FB_SYNC_HOR_HIGH_ACT; + if (1 == sscanf(line, " vsync %15s",value) && + 0 == strcasecmp(value,"high")) + fb_var_.sync |= FB_SYNC_VERT_HIGH_ACT; + if (1 == sscanf(line, " csync %15s",value) && + 0 == strcasecmp(value,"high")) + fb_var_.sync |= FB_SYNC_COMP_HIGH_ACT; + if (1 == sscanf(line, " extsync %15s",value) && + 0 == strcasecmp(value,"true")) + fb_var_.sync |= FB_SYNC_EXT; + if (1 == sscanf(line, " laced %15s",value) && + 0 == strcasecmp(value,"true")) + fb_var_.vmode |= FB_VMODE_INTERLACED; + if (1 == sscanf(line, " double %15s",value) && + 0 == strcasecmp(value,"true")) + fb_var_.vmode |= FB_VMODE_DOUBLE; + } + /* ok ? */ + if (!geometry || !timings) + goto err; + /* set */ + fb_var_.xoffset = 0; + fb_var_.yoffset = 0; + +#if 0 +#ifdef FIM_WANTS_DOUBLE_BUFFERING + // FIXME : the page flipping mechanisms missing (unfinished) + fb_var_.xres_virtual = fb_var_.xres; + fb_var_.yres_virtual = fb_var_.yres * 2; +#endif +#endif + + if (-1 == ioctl(fb_,FBIOPUT_VSCREENINFO,&fb_var_)) + fim_perror("ioctl FBIOPUT_VSCREENINFO"); + + /* + * FIXME + * mm : this should be placed here and uncommented : */ + /* + if (-1 == ioctl(fb_,FBIOGET_FSCREENINFO,&fb_fix_)) { + fim_perror("ioctl FBIOGET_VSCREENINFO"); + exit(1); + }*/ + /* look what we have now ... */ + if (-1 == ioctl(fb_,FBIOGET_VSCREENINFO,&fb_var_)) { + fim_perror("ioctl FBIOGET_VSCREENINFO"); + exit(1); + } + goto ret; + } + } +err: + return -1; +ret: + return 0; +} + +int FramebufferDevice::fb_activate_current(int tty_) +{ +/* Hmm. radeonfb needs this. matroxfb doesn't. (<- fbi comment) */ + struct vt_stat vts; + +#ifdef FIM_BOZ_PATCH + if(!with_boz_patch_) +#endif /* FIM_BOZ_PATCH */ + if (-1 == ioctl(tty_,VT_GETSTATE, &vts)) { + fim_perror("ioctl VT_GETSTATE"); + goto err; + } +#ifdef FIM_BOZ_PATCH + if(!with_boz_patch_) +#endif /* FIM_BOZ_PATCH */ + if (-1 == ioctl(tty_,VT_ACTIVATE, vts.v_active)) { + fim_perror("ioctl VT_ACTIVATE"); + goto err; + } +#ifdef FIM_BOZ_PATCH + if(!with_boz_patch_) +#endif /* FIM_BOZ_PATCH */ + if (-1 == ioctl(tty_,VT_WAITACTIVE, vts.v_active)) { + fim_perror("ioctl VT_WAITACTIVE"); + goto err; + } + return 0; +err: + return -1; +} + +fim_err_t FramebufferDevice::status_line(const fim_char_t *msg) +{ + int y; + + if (!visible_) + goto ret; + + if(fb_var_.yres< 1 + f_->height + ys_) + /* we need enough pixels, and have no assumptions on weird visualization devices_ */ + goto rerr; + + y = fb_var_.yres -1 - f_->height - ys_; +// fb_memset(fb_mem_ + fb_fix_.line_length * y, 0, fb_fix_.line_length * (f_->height+ys_)); + clear_rect(0, fb_var_.xres-1, y+1,y+f_->height+ys_); + + fb_line(0, fb_var_.xres, y, y); + fs_puts(f_, 0, y+ys_, msg); +ret: + return FIM_ERR_NO_ERROR; +rerr: + return FIM_ERR_GENERIC; +} + +#if 0 +/* 20110909 FIXME: unused */ +void FramebufferDevice::fb_edit_line(fim_byte_t *str, int pos) +{ + int x,y; + + if (!visible_) + return; + + y = fb_var_.yres - f_->height - ys_; + x = pos * f_->width; + fb_memset(fb_mem_ + fb_fix_.line_length * y, 0, + fb_fix_.line_length * (f_->height+ys_)); + fb_line(0, fb_var_.xres, y, y); + fs_puts(f_, 0, y+ys_, (const fim_char_t*)str); + fb_line(x, x + f_->width, fb_var_.yres-1, fb_var_.yres-1); + fb_line(x, x + f_->width, fb_var_.yres-2, fb_var_.yres-2); +} +#endif + +void FramebufferDevice::fb_text_box(int x, int y, fim_char_t *lines[], unsigned int count) +{ + unsigned int i,len,max, x1, x2, y1, y2; + + if (!visible_) + goto err; + + max = 0; + for (i = 0; i < count; i++) { + len = strlen(lines[i]); + if (max < len) + max = len; + } + x1 = x; + x2 = x + max * f_->width; + y1 = y; + y2 = y + count * f_->height; + + x += xs_; x2 += 2*xs_; + y += ys_; y2 += 2*ys_; + + clear_rect(x1, x2, y1, y2); + fb_rect(x1, x2, y1, y2); + for (i = 0; i < count; i++) { + fs_puts(f_,x,y,(const fim_char_t*)lines[i]); + y += f_->height; + } +err: + return; +} + +void FramebufferDevice::fb_line(int x1, int x2, int y1,int y2) +{ +/*static void fb_line(int x1, int x2, int y1,int y2)*/ + int x,y,h; + float inc; + + if (x2 < x1) + h = x2, x2 = x1, x1 = h; + if (y2 < y1) + h = y2, y2 = y1, y1 = h; + if (x2 - x1 < y2 - y1) { + inc = (float)(x2-x1)/(float)(y2-y1); + for (y = y1; y <= y2; y++) { + x = x1 + (int)(inc * (float)(y - y1)); + fb_setpixel(x,y,fs_white_); + } + } else { + inc = (float)(y2-y1)/(float)(x2-x1); + for (x = x1; x <= x2; x++) { + y = y1 + (int)(inc * (float)(x - x1)); + fb_setpixel(x,y,fs_white_); + } + } +} + + +void FramebufferDevice::fb_rect(int x1, int x2, int y1,int y2) +{ + fb_line(x1, x2, y1, y1); + fb_line(x1, x2, y2, y2); + fb_line(x1, x1, y1, y2); + fb_line(x2, x2, y1, y2); +} + +void FramebufferDevice::fb_setpixel(int x, int y, unsigned int color) +{ + fim_byte_t *ptr; + + ptr = fb_mem_; + ptr += y * fb_fix_.line_length; + ptr += x * fs_bpp_; + fs_setpixel(ptr, color); +} + +void FramebufferDevice::fb_clear_rect(int x1, int x2, int y1,int y2) +{ + fim_byte_t *ptr; + int y,h; + + if (!visible_) + goto ret; + + if (x2 < x1) + h = x2, x2 = x1, x1 = h; + if (y2 < y1) + h = y2, y2 = y1, y1 = h; + ptr = fb_mem_; + ptr += y1 * fb_fix_.line_length; + ptr += x1 * fs_bpp_; + + for (y = y1; y <= y2; y++) { + fb_memset(ptr, 0, (x2 - x1 + 1) * fs_bpp_ * 4 /* FIXME : 4 */); + ptr += fb_fix_.line_length; + } +ret: + return; +} + +void FramebufferDevice::clear_screen(void) +{ + if (visible_) + fb_memset(fb_mem_,0,fb_fix_.smem_len); +} + +void FramebufferDevice::cleanup(void) +{ + /* restore console */ + if (-1 == ioctl(fb_,FBIOPUT_VSCREENINFO,&fb_ovar_)) + fim_perror("ioctl FBIOPUT_VSCREENINFO"); + if (-1 == ioctl(fb_,FBIOGET_FSCREENINFO,&fb_fix_)) + fim_perror("ioctl FBIOGET_FSCREENINFO"); +#if 0 + printf("id:%s\t%ld\t%ld\t%ld\t\n",fb_fix_.id,fb_fix_.accel,fb_fix_.xpanstep,fb_fix_.xpanstep); +#endif + if (fb_ovar_.bits_per_pixel == 8 || + fb_fix_.visual == FB_VISUAL_DIRECTCOLOR) { + if (-1 == ioctl(fb_,FBIOPUTCMAP,&ocmap_)) + fim_perror("ioctl FBIOPUTCMAP"); + } + close(fb_); + +#ifdef FIM_BOZ_PATCH + if(!with_boz_patch_) +#endif /* FIM_BOZ_PATCH */ + if (-1 == ioctl(tty_,KDSETMODE, kd_mode_)) + fim_perror("ioctl KDSETMODE"); +#ifdef FIM_BOZ_PATCH + if(!with_boz_patch_) +#endif /* FIM_BOZ_PATCH */ + if (-1 == ioctl(tty_,VT_SETMODE, &vt_omode_)) + fim_perror("ioctl VT_SETMODE"); + if (orig_vt_no_ && -1 == ioctl(tty_, VT_ACTIVATE, orig_vt_no_)) + fim_perror("ioctl VT_ACTIVATE"); + if (orig_vt_no_ && -1 == ioctl(tty_, VT_WAITACTIVE, orig_vt_no_)) + fim_perror("ioctl VT_WAITACTIVE"); + + // there's no need to restore the tty : this is performed outside ( 20081221 ) + //tcsetattr(tty_, TCSANOW, &term_); + //close(tty_); +} + +fim_byte_t * FramebufferDevice::convert_line_8(int bpp, int line, int owidth, fim_byte_t *dst, fim_byte_t *buffer, int mirror)/*dez's mirror patch*/ +{ + fim_byte_t *ptr = (fim_byte_t *)dst; + dither_line(buffer, ptr, line, owidth, mirror); + ptr += owidth; + return ptr; +} + +fim_byte_t * FramebufferDevice::convert_line(int bpp, int line, int owidth, fim_byte_t *dst, fim_byte_t *buffer, int mirror)/*dez's mirror patch*/ +{ + fim_byte_t *ptr = (fim_byte_t *)dst; + unsigned short *ptr2 = (unsigned short*)dst; + unsigned int *ptr4 = (unsigned int *)dst; + int x; + int xm;/*mirror patch*/ + + switch (fb_var_.bits_per_pixel) { + case 8: + dither_line(buffer, ptr, line, owidth, mirror); + ptr += owidth; + return ptr; + case 15: + case 16: +#ifdef FIM_IS_SLOWER_THAN_FBI + /*swapped RGB patch*/ + for (x = 0; x < owidth; x++) { + xm=mirror?owidth-1-x:x; + ptr2[xm] = lut_red_[buffer[x*3]] | + lut_green_[buffer[x*3+1]] | + lut_blue_[buffer[x*3+2]]; + } +#else /* FIM_IS_SLOWER_THAN_FBI */ + if(FIM_LIKELY(!mirror)) + for (x = 0; x < owidth; x++) { + ptr2[x] = lut_red_[buffer[x*3+2]] | + lut_green_[buffer[x*3+1]] | + lut_blue_[buffer[x*3]]; + } + else + for (x = 0,xm=owidth; x < owidth; x++) { + xm--; + ptr2[xm] = lut_red_[buffer[x*3+2]] | + lut_green_[buffer[x*3+1]] | + lut_blue_[buffer[x*3]]; + } +#endif /* FIM_IS_SLOWER_THAN_FBI */ + ptr2 += owidth; + return (fim_byte_t*)ptr2; + case 24: +#ifdef FIM_IS_SLOWER_THAN_FBI + for (x = 0; x < owidth; x++) { + xm=mirror?owidth-1-x:x; + ptr[3*xm+2] = buffer[3*x+0]; + ptr[3*xm+1] = buffer[3*x+1]; + ptr[3*xm+0] = buffer[3*x+2]; + } +#else /* FIM_IS_SLOWER_THAN_FBI */ + /*swapped RGB patch*/ + if(FIM_LIKELY(!mirror)) + { + /* + * this code could be faster if using processor specific routines.. + * ... or maybe even not ? + */ + //owidth*=3; +#if 0 + for (x = 0; x < owidth; x+=3) + { + ptr[x+2] = buffer[x+0]; + ptr[x+1] = buffer[x+1]; + ptr[x+0] = buffer[x+2]; + } +#else + /* + * this is far worse than the preceding ! + */ + memcpy(ptr,buffer,owidth*3); + //register fim_char_t t; + //register i=x; + /*since RGB and GBR swap already done, this is not necessary*/ + /*for (i = 0; i < owidth; i+=3) + { + t=ptr[i]; + ptr[i]=ptr[i+2]; + ptr[i+2]=t; + }*/ +#endif + //owidth/=3; + }else +/*this is still slow ... FIXME*/ +#if 0 + for (x = 0; x < owidth; x++) { + x*=3; + xm=3*owidth-x-3; + ptr[xm+2] = buffer[x+0]; + ptr[xm+1] = buffer[x+1]; + ptr[xm+0] = buffer[x+2]; + x/=3; + } +#else + for (x = 0; x < owidth; x++) { + x*=3; + xm=3*owidth-x-3; + ptr[xm+2] = buffer[x+2]; + ptr[xm+1] = buffer[x+1]; + ptr[xm+0] = buffer[x+0]; + x/=3; + } +#endif +#endif + ptr += owidth * 3; + return ptr; + case 32: +#ifndef FIM_IS_SLOWER_THAN_FBI + /*swapped RGB patch*/ + for (x = 0; x < owidth; x++) { + xm=mirror?owidth-1-x:x; + ptr4[xm] = lut_red_[buffer[x*3+2]] | + lut_green_[buffer[x*3+1]] | + lut_blue_[buffer[x*3]]; + } +#else /* FIM_IS_SLOWER_THAN_FBI */ + if(FIM_LIKELY(!mirror)) + for (x = 0; x < owidth; x++) { + ptr4[x] = lut_red_[buffer[x*3]] | + lut_green_[buffer[x*3+1]] | + lut_blue_[buffer[x*3+2]]; + } + else + for (x = 0; x < owidth; x++) { + ptr4[owidth-1-x] = lut_red_[buffer[x*3]] | + lut_green_[buffer[x*3+1]] | + lut_blue_[buffer[x*3+2]]; + } +#endif /* FIM_IS_SLOWER_THAN_FBI */ + ptr4 += owidth; + return (fim_byte_t*)ptr4; + default: + /* keep compiler happy */ + return FIM_NULL; + } +} + +/*dez's*/ +/*fim_byte_t * FramebufferDevice::clear_lines(int bpp, int lines, int owidth, fim_byte_t *dst) +{ + +}*/ + +fim_byte_t * FramebufferDevice::clear_line(int bpp, int line, int owidth, fim_byte_t *dst) +{ + fim_byte_t *ptr = (fim_byte_t*)dst; + unsigned short *ptr2 = (unsigned short*)dst; + unsigned int *ptr4 = (unsigned int*)dst; + unsigned clear_byte=0x00; +#ifdef FIM_IS_SLOWER_THAN_FBI + int x; +#endif /* FIM_IS_SLOWER_THAN_FBI */ + + switch (fb_var_.bits_per_pixel) { + case 8: + fim_bzero(ptr, owidth); + ptr += owidth; + return ptr; + case 15: + case 16: +#ifdef FIM_IS_SLOWER_THAN_FBI + for (x = 0; x < owidth; x++) { + ptr2[x] = 0x0; + } +#else /* FIM_IS_SLOWER_THAN_FBI */ + fim_memset(ptr,clear_byte,2*owidth); +#endif /* FIM_IS_SLOWER_THAN_FBI */ + ptr2 += owidth; + return (fim_byte_t*)ptr2; + case 24: +#ifdef FIM_IS_SLOWER_THAN_FBI + for (x = 0; x < owidth; x++) { + ptr[3*x+2] = 0x0; + ptr[3*x+1] = 0x0; + ptr[3*x+0] = 0x0; + } +#else /* FIM_IS_SLOWER_THAN_FBI */ + fim_memset(ptr,clear_byte,3*owidth); +#endif /* FIM_IS_SLOWER_THAN_FBI */ + ptr += owidth * 3; + return ptr; + case 32: +#ifdef FIM_IS_SLOWER_THAN_FBI + for (x = 0; x < owidth; x++) { + ptr4[x] = 0x0; + } +#else /* FIM_IS_SLOWER_THAN_FBI */ + fim_memset(ptr,clear_byte,4*owidth); +#endif /* FIM_IS_SLOWER_THAN_FBI */ + ptr4 += owidth; + return (fim_byte_t*)ptr4; + default: + /* keep compiler happy */ + return FIM_NULL; + } +} + +void FramebufferDevice::init_dither(int shades_r, int shades_g, int shades_b, int shades_gray) +{ + int i, j; + fim_byte_t low_shade, high_shade; + unsigned short index; + float red_colors_per_shade; + float green_colors_per_shade; + float blue_colors_per_shade; + float gray_colors_per_shade; + + red_mult_ = shades_g * shades_b; + green_mult_ = shades_b; + + red_colors_per_shade = 256.0 / (shades_r - 1); + green_colors_per_shade = 256.0 / (shades_g - 1); + blue_colors_per_shade = 256.0 / (shades_b - 1); + gray_colors_per_shade = 256.0 / (shades_gray - 1); + + /* this avoids a shift when checking these values */ + for (i = 0; i < DITHER_LEVEL; i++) + for (j = 0; j < DITHER_LEVEL; j++) + DM[i][j] *= 0x10000; + + /* setup arrays containing three bytes of information for red, green, & blue */ + /* the arrays contain : + * 1st byte: low end shade value + * 2nd byte: high end shade value + * 3rd & 4th bytes: ordered dither matrix index + */ + + for (i = 0; i < 256; i++) { + + /* setup the red information */ + { + low_shade = (fim_byte_t) (i / red_colors_per_shade); + high_shade = low_shade + 1; + + index = (unsigned short) + (((i - low_shade * red_colors_per_shade) / red_colors_per_shade) * + (DITHER_LEVEL * DITHER_LEVEL + 1)); + + low_shade *= red_mult_; + high_shade *= red_mult_; + + red_dither_[i] = (index << 16) + (high_shade << 8) + (low_shade); + } + + /* setup the green information */ + { + low_shade = (fim_byte_t) (i / green_colors_per_shade); + high_shade = low_shade + 1; + + index = (unsigned short) + (((i - low_shade * green_colors_per_shade) / green_colors_per_shade) * + (DITHER_LEVEL * DITHER_LEVEL + 1)); + + low_shade *= green_mult_; + high_shade *= green_mult_; + + green_dither_[i] = (index << 16) + (high_shade << 8) + (low_shade); + } + + /* setup the blue information */ + { + low_shade = (fim_byte_t) (i / blue_colors_per_shade); + high_shade = low_shade + 1; + + index = (unsigned short) + (((i - low_shade * blue_colors_per_shade) / blue_colors_per_shade) * + (DITHER_LEVEL * DITHER_LEVEL + 1)); + + blue_dither_[i] = (index << 16) + (high_shade << 8) + (low_shade); + } + + /* setup the gray information */ + { + low_shade = (fim_byte_t) (i / gray_colors_per_shade); + high_shade = low_shade + 1; + + index = (unsigned short) + (((i - low_shade * gray_colors_per_shade) / gray_colors_per_shade) * + (DITHER_LEVEL * DITHER_LEVEL + 1)); + + gray_dither_[i] = (index << 16) + (high_shade << 8) + (low_shade); + } + } +} + +void inline FramebufferDevice::dither_line(fim_byte_t *src, fim_byte_t *dst, int y, int width,int mirror) +{ + register long a, b +#ifndef FIM_IS_SLOWER_THAN_FBI + __attribute((aligned(16))) +#endif /* FIM_IS_SLOWER_THAN_FBI */ + ; + + long *ymod, xmod; + + ymod = (long int*) DM[y & DITHER_MASK]; + /* mirror patch by dez */ + register const int inc=mirror?-1:1; + dst=mirror?dst+width-1:dst; + /* mirror patch by dez */ + if(FIM_UNLIKELY(width<1)) + goto nodither; //who knows + +#ifndef FIM_IS_SLOWER_THAN_FBI + switch(width%8){ + case 0: goto dither0; break ; + case 1: goto dither1; break ; + case 2: goto dither2; break ; + case 3: goto dither3; break ; + case 4: goto dither4; break ; + case 5: goto dither5; break ; + case 6: goto dither6; break ; + case 7: goto dither7; break ; + } +#endif /* FIM_IS_SLOWER_THAN_FBI */ + + while (FIM_LIKELY(width)) { + +#if 0 + + #define DITHER_CORE \ + xmod = --width & DITHER_MASK; \ +\ + b = blue_dither_[*(src++)]; \ + b >>= (ymod[xmod] < b)?8:0; \ + a = green_dither_[*(src++)]; \ + a >>= (ymod[xmod] < a)?8:0; \ + b += a; \ + a = red_dither_[*(src++)]; \ + a >>= (ymod[xmod] < a)?8:0; \ + *(dst) = b+a & 0xff; \ + /* mirror patch by dez */ \ + dst+=inc; + +#else + #define DITHER_CORE \ + { \ + width--; \ + xmod = width & DITHER_MASK; \ + const long ymod_xmod=ymod[xmod]; \ +\ + b = blue_dither_[*(src++)]; \ + if (ymod_xmod < b) \ + b >>= 8; \ +\ + a = green_dither_[*(src++)]; \ + if (ymod_xmod < a) \ + a >>= 8; \ + b += a; \ +\ + a = red_dither_[*(src++)]; \ + if (ymod_xmod < a) \ + a >>= 8; \ + b += a; \ + *(dst) = b & 0xff; \ + /* mirror patch by dez */ \ + dst+=inc; \ + } \ + /* *(dst++) = b & 0xff;*/ +#endif + +#ifndef FIM_IS_SLOWER_THAN_FBI +dither0: + DITHER_CORE +dither7: + DITHER_CORE +dither6: + DITHER_CORE +dither5: + DITHER_CORE +dither4: + DITHER_CORE +dither3: + DITHER_CORE +dither2: + DITHER_CORE +#endif /* FIM_IS_SLOWER_THAN_FBI */ +dither1: + DITHER_CORE + } +nodither: + return; +} +void FramebufferDevice::dither_line_gray(fim_byte_t *src, fim_byte_t *dst, int y, int width) +{ + long *ymod, xmod; + register long a; + + ymod = (long int*) DM[y & DITHER_MASK]; + + while (width--) { + xmod = width & DITHER_MASK; + + a = gray_dither_[*(src++)]; + if (ymod[xmod] < a) + a >>= 8; + + *(dst++) = a & 0xff; + } +} +void FramebufferDevice::fb_switch_release(void) +{ + ioctl(tty_, VT_RELDISP, 1); + fb_switch_state_ = FB_INACTIVE; + if (debug_) + FIM_FPRINTF(stderr, "vt: release\n"); +} +void FramebufferDevice::fb_switch_acquire(void) +{ + ioctl(tty_, VT_RELDISP, VT_ACKACQ); + fb_switch_state_ = FB_ACTIVE; + if (debug_) + FIM_FPRINTF(stderr, "vt: acquire\n"); +} +int FramebufferDevice::fb_switch_init(void) +{ + struct sigaction act,old; + + fim_bzero(&act,sizeof(act)); + + ffdp=this;// WARNING : A DIRTY HACK + act.sa_handler = _fb_switch_signal; + sigemptyset(&act.sa_mask); + sigaction(SIGUSR1,&act,&old); + sigaction(SIGUSR2,&act,&old); +#ifdef FIM_BOZ_PATCH + if(!with_boz_patch_) +#endif /* FIM_BOZ_PATCH */ + if (-1 == ioctl(tty_,VT_GETMODE, &vt_mode_)) { + fim_perror("ioctl VT_GETMODE"); + exit(1); + } + vt_mode_.mode = VT_PROCESS; + vt_mode_.waitv = 0; + vt_mode_.relsig = SIGUSR1; + vt_mode_.acqsig = SIGUSR2; + +#ifdef FIM_BOZ_PATCH + if(!with_boz_patch_) +#endif /* FIM_BOZ_PATCH */ + if (-1 == ioctl(tty_,VT_SETMODE, &vt_mode_)) { + fim_perror("ioctl VT_SETMODE"); + exit(1); + } + return 0; +} + +void FramebufferDevice::fb_switch_signal(int signal) +{ + if (signal == SIGUSR1) { + /* release */ + fb_switch_state_ = FB_REL_REQ; + if (debug_) + FIM_FPRINTF(stderr, "vt: SIGUSR1\n"); + } + if (signal == SIGUSR2) { + /* acquisition */ + fb_switch_state_ = FB_ACQ_REQ; + if (debug_) + FIM_FPRINTF(stderr, "vt: SIGUSR2\n"); + } +} + + +int FramebufferDevice::fb_text_init2(void) +{ + return fs_init_fb(255); +} + int FramebufferDevice::fb_font_width(void) { return f_->width; } + int FramebufferDevice::fb_font_height(void) { return f_->height; } + +int FramebufferDevice::fs_init_fb(int white8) +{ + switch (fb_var_.bits_per_pixel) { + case 8: + fs_white_ = white8; fs_black_ = 0; fs_bpp_ = 1; + fs_setpixel = setpixel1; + break; + case 15: + case 16: + if (fb_var_.green.length == 6) + fs_white_ = 0xffff; + else + fs_white_ = 0x7fff; + fs_black_ = 0; fs_bpp_ = 2; + fs_setpixel = setpixel2; + break; + case 24: + fs_white_ = 0xffffff; fs_black_ = 0; fs_bpp_ = fb_var_.bits_per_pixel/8; + fs_setpixel = setpixel3; + break; + case 32: + fs_white_ = 0xffffff; fs_black_ = 0; fs_bpp_ = fb_var_.bits_per_pixel/8; + fs_setpixel = setpixel4; + break; + default: + FIM_FPRINTF(stderr, "Oops: %i bit/pixel ???\n", + fb_var_.bits_per_pixel); + return -1; + } + return 0; +} + +/* + * This function treats the framebuffer screen as a text outout terminal. + * So it prints all the contents of its buffer on screen.. + * if noDraw is set, the screen will be not refreshed. + * FIM_NULL,FIM_NULL is the clearing combination !! + + //FIX ME : move this functionality to some new class and add ways to scroll and manipulate it + dez's + */ +#if 0 +#ifndef FIM_KEEP_BROKEN_CONSOLE +void FramebufferDevice::status_screen(const fim_char_t *msg, int draw) +{ + /* current code */ + return fb_status_screen_new(msg, (fim_bool_t)draw,0); +} +#else /* FIM_KEEP_BROKEN_CONSOLE */ +void FramebufferDevice::status_screen(const fim_char_t *msg, int draw) +{ + /* dead code */ + + /* WARNING */ + //noDraw=0; + /* WARNING */ + int y,i,j,l,w; + // R rows, C columns + int R=(fb_var_.yres/fb_font_height())/2,/* half screen : more seems evil */ + C=(fb_var_.xres/fb_font_width()); + static fim_char_t **columns=FIM_NULL; + static fim_char_t *columns_data=FIM_NULL; + if(R<1 || C < 1)return; /* sa finimm'acca', nun ce sta nient'a fa! */ + /* R rows and C columns; the last one for string terminators.. + */ + if(!columns)columns=(fim_char_t**)fim_calloc(1,sizeof(fim_char_t**)*R); + if(!columns_data)columns_data=fim_stralloc(sizeof(fim_char_t)*(R*(C+1))); + /* + * seems tricky : we allocate one single buffer and use it as console + * storage and console pointers storage ... + * + * note that we don't deallocate this area until program termination. + * it is because we keep the framebuffer... + * */ + if(!columns || !columns_data) + { + if(columns)fim_free(columns); + if(columns_data)fim_free(columns_data); + return; + } + + for(i=0;i0) //line processing + { + //w is the number of writable characters on this line ( w in [0,C-ccol] ) + w=min(C-ccol,l); + //there remains l-=w non '\n' characters yet to process in the first substring + l-=w; + //we place the characters on the line (not padded,though) + strncpy(columns[cline]+ccol,p,w); + sanitize_string_from_nongraph(columns[cline]+ccol,w); + //the current column index is updated,too + ccol+=w; + //we blank the rest of the line (SHOULD BE UNNECESSARY) + for(i=ccol;i=C+1){cleanup();return;} //ehm.. who knows +#else + if(ccol>=C+1)return; +#endif /* CERCO_GRANE */ + if(ccol==C) + { + //So if we are at the end of the line, we prepare + //for a new line + ccol=0; + cline=(cline+1)%(R); + if(cline==0) + for(i=0;iheight : 0; +} +#endif //ifdef FIM_WITH_NO_FRAMEBUFFER, else + + diff --git a/src/FramebufferDevice.h b/src/FramebufferDevice.h new file mode 100644 index 0000000..3cf679a --- /dev/null +++ b/src/FramebufferDevice.h @@ -0,0 +1,544 @@ +/* $LastChangedDate: 2017-04-15 16:03:56 +0200 (Sat, 15 Apr 2017) $ */ +/* + FramebufferDevice.h : Linux Framebuffer functions from fbi, adapted for fim + + (c) 2008-2017 Michele Martone + (c) 1998-2006 Gerd Knorr + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +/* + * This file comes from fbi, and will undergo severe reorganization. + * */ + +#ifndef FIM_FRAMEBUFFER_DEVICE_H +#define FIM_FRAMEBUFFER_DEVICE_H + +/* + * These are fbi's internals adapted to C++ and adapting to a loose OOP. + * */ + + + +#include "fim.h" +#include "FontServer.h" +#include "DisplayDevice.h" + +/* these are required by FbiStuffJpeg.cpp */ +#define FIM_FBI_TRUE 1 +#define FIM_FBI_FALSE 0 + +#ifndef FIM_WITH_NO_FRAMEBUFFER + +#include +#include +#include //pow + +#if HAVE_LINUX_VT_H +#include +#endif /* HAVE_LINUX_VT_H */ +#if HAVE_LINUX_FB_H +#include // fb_fix_screeninfo +#endif /* HAVE_LINUX_FB_H */ + + +/* from fbtools.h */ +#define FB_ACTIVE 0 +#define FB_REL_REQ 1 +#define FB_INACTIVE 2 +#define FB_ACQ_REQ 3 + + +namespace fim +{ +struct DEVS { + const fim_char_t *fb0; + const fim_char_t *fbnr; + const fim_char_t *ttynr; +}; + + + +//void _fb_switch_signal(int signal); + + + + + + + + +class FramebufferDevice:public DisplayDevice +{ + + + long red_mult_, green_mult_; + long red_dither_[256] FIM_ALIGNED; + long green_dither_[256]FIM_ALIGNED; + long blue_dither_[256] FIM_ALIGNED; + long gray_dither_[256] FIM_ALIGNED; + + /* + * A class providing access to a single framebuffer device. + * + * Let's say in future we want to be able to manage multiple framebuffer devices. + * Then framebuffer variables should be incapsulated well in separate objects. + * We are heading forward on this road, slowly. + * */ +#if 0 + void fb_text_init1(fim_char_t *font) + { + fim_char_t *fonts[2] = { font, FIM_NULL }; + + if (FIM_NULL == f_) + f_ = fs_consolefont(font ? fonts : FIM_NULL); + #ifdef FIM_USE_X11_FONTS + if (FIM_NULL == f_ && 0 == fs_connect(FIM_NULL)) + f_ = fs_open(font ? font : x11_font_); + #endif /* FIM_USE_X11_FONTS */ + if (FIM_NULL == f_) { + fprintf(stderr,"font \"%s\" is not available\n",font); + exit(1); + } + } +#endif + private: + static const fim_coo_t border_height_=1; + + int vt_ ; + //public: + int32_t lut_red_[256], lut_green_[256], lut_blue_[256]; + int dither_ , pcd_res_ /*, steps_*/ ; + private: + float fbgamma_ ; + + /*static float fbgamma_ = 1;*/ + //public: + + + // FS.C + unsigned int fs_bpp_, fs_black_, fs_white_;//STILL UNINITIALIZED + int fs_init_fb(int white8); + private: + /* public */ + int visible_ ; + + /* private */ + //fim_char_t *x11_font_ ; + + int ys_ ; + int xs_ ; + + //public: + void (*fs_setpixel)(void *ptr, unsigned int color); + private: + + static void setpixel1(void *ptr, unsigned int color) + { + fim_byte_t *p = (fim_byte_t *) ptr; + *p = color; + } + + static void setpixel2(void *ptr, unsigned int color) + { + short unsigned int *p = (short unsigned int*) ptr; + *p = color; + } + + static void setpixel3(void *ptr, unsigned int color) + { + fim_byte_t *p = (fim_byte_t *) ptr; + *(p++) = (color >> 16) & 0xff; + *(p++) = (color >> 8) & 0xff; + *(p++) = color & 0xff; + } + + static void setpixel4(void *ptr, unsigned int color) + { + unsigned int *p = (unsigned int*) ptr; + *p = color; + } + + /* framebuffer */ + fim_char_t *fbdev_; + fim_char_t *fbmode_; + + public: + /* + * FIXME : should be a static string, or troubles will come! + * */ + fim_err_t set_fbdev(fim_char_t *fbdev_) + { + /* only possible before init() */ + if(fb_mem_) + return FIM_ERR_GENERIC; + if(fbdev_) + this->fbdev_=fbdev_; + return FIM_ERR_NO_ERROR; + } + + /* + * FIXME : should be a static string, or troubles will come! + * */ + fim_err_t set_fbmode(fim_char_t *fbmode_) + { + /* only possible before init() */ + if(fb_mem_) + return FIM_ERR_GENERIC; + if(fbmode_) + this->fbmode_=fbmode_; + return FIM_ERR_NO_ERROR; + } + + int set_default_vt(int default_vt) + { + /* only possible before init() */ + if(fb_mem_) + return FIM_ERR_GENERIC; + if(default_vt) + this->vt_=default_vt; + return FIM_ERR_NO_ERROR; + } + + int set_default_fbgamma(float fbgamma_) + { + /* only possible before init() */ + if(fb_mem_) + return FIM_ERR_GENERIC; + if(fbgamma_) + this->fbgamma_=fbgamma_; + return FIM_ERR_NO_ERROR; + } + + //private: + int fd_, switch_last_; + + unsigned short red_[256], green_[256], blue_[256]; + struct fb_cmap cmap_; + + + //were static .. + struct fb_cmap ocmap_; + unsigned short ored_[256], ogreen_[256], oblue_[256]; + + + struct DEVS devs_default_; + struct DEVS devs_devfs_; + +#ifdef FIM_BOZ_PATCH + int with_boz_patch_; +#endif /* FIM_BOZ_PATCH */ + +#ifndef FIM_WANT_NO_OUTPUT_CONSOLE + FramebufferDevice(MiniConsole & mc_); +#else /* FIM_WANT_NO_OUTPUT_CONSOLE */ + FramebufferDevice(void); +#endif /* FIM_WANT_NO_OUTPUT_CONSOLE */ + + +/* -------------------------------------------------------------------- */ + /* exported stuff */ + public: + struct fb_fix_screeninfo fb_fix_; + struct fb_var_screeninfo fb_var_; + //private: + fim_byte_t *fb_mem_; + int fb_mem_offset_; + int fb_switch_state_; + +/* -------------------------------------------------------------------- */ + /* internal variables */ + + int fb_,tty_; + #if 0 + static int bpp,black,white; + #endif + private: + + int orig_vt_no_; + struct vt_mode vt_mode_; + int kd_mode_; + struct vt_mode vt_omode_; + struct termios term_; + struct fb_var_screeninfo fb_ovar_; + + + public: + fim_err_t framebuffer_init(void); + + struct DEVS *devices_; + + + + void dev_init(void); + private: + int fb_init(const fim_char_t *device, fim_char_t *mode, int vt_ + , int try_boz_patch=0 + ); + public: + + void fb_memset (void *addr, int c, size_t len); + void fb_setcolor(int c) { fb_memset(fb_mem_+fb_mem_offset_,c,fb_fix_.smem_len); } + + + + void fb_setvt(int vtno); + int fb_setmode(fim_char_t *name); + int fb_activate_current(int tty_); + + void console_switch(fim_bool_t is_busy); + + int fb_font_width(void); + int fb_font_height(void); + + int status_line(const fim_char_t *msg); + + //void fb_edit_line(fim_char_t *str, int pos); + + void fb_text_box(int x, int y, fim_char_t *lines[], unsigned int count); + + void fb_line(int x1, int x2, int y1,int y2); + + + void fb_rect(int x1, int x2, int y1,int y2); + + void fb_setpixel(int x, int y, unsigned int color); + fim_err_t fs_puts(struct fs_font *f, fim_coo_t x, fim_coo_t y, const fim_char_t *str); + + void fb_clear_rect(int x1, int x2, int y1,int y2); + fim_err_t clear_rect(fim_coo_t x1, fim_coo_t x2, fim_coo_t y1,fim_coo_t y2) + { + fb_clear_rect(x1, x2, y1,y2); + return 0; + } + fim_err_t fill_rect(fim_coo_t x1, fim_coo_t x2, fim_coo_t y1,fim_coo_t y2, fim_color_t color) {/* FIXME: bogus implementation */ return clear_rect(x1,x2,y1,y2); } + + void clear_screen(void); + void cleanup(void); + + fim_err_t initialize (sym_keys_t &sym_keys){/*still unused : FIXME */ ;return FIM_ERR_NO_ERROR;} + void finalize (void); + struct fs_font * fb_font_get_current_font(void) + { + return f_; + } + + void switch_if_needed(void) + { + //fim's + if (switch_last_ != fb_switch_state_) + console_switch(true); + } + +#define FIM_FBI_TRUE 1 +#define FIM_FBI_FALSE 0 +#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) + +/* + * framebuffer memory offset for x pixels left and y right from the screen + * (by dez) + */ +#define FB_BPP (((fb_var_.bits_per_pixel+7)/8)) +#define FB_MEM_LINE_LENGTH ((fb_fix_.line_length)) +#define FB_MEM_OFFSET(x,y) (( FB_BPP*(x) + FB_MEM_LINE_LENGTH * (y) )) +#define FB_MEM(x,y) ((fb_mem_+FB_MEM_OFFSET((x),(y)))) + + + +//void svga_display_image_new(struct ida_image *img, int xoff, int yoff,unsigned int bx,unsigned int bw,unsigned int by,unsigned int bh,int mirror,int flip); +//void svga_display_image_new(struct ida_image *img, int xoff, int yoff,unsigned int bx,unsigned int bw,unsigned int by,unsigned int bh,int mirror,int flip); + +fim_err_t display( + //struct ida_image *img, + void *ida_image_img, // source image structure + fim_coo_t yoff, + fim_coo_t xoff, + fim_coo_t irows,fim_coo_t icols,// rows and columns in the input image + fim_coo_t icskip, // input columns to skip for each line + fim_coo_t by, + fim_coo_t bx, + fim_coo_t bh, + fim_coo_t bw, + fim_coo_t ocskip,// output columns to skip for each line + fim_flags_t flags); + + +void svga_display_image_new( + struct ida_image *img, + int yoff, + int xoff, + int irows,int icols,// rows and columns in the input image + int icskip, // input columns to skip for each line + unsigned int by, + unsigned int bx, + unsigned int bh, + unsigned int bw, + int ocskip,// output columns to skip for each line + int flags); + +/* ---------------------------------------------------------------------- */ +/* by dez + */ +inline fim_byte_t * clear_line(int bpp, int line, int owidth, fim_byte_t *dst); +fim_byte_t * convert_line(int bpp, int line, int owidth, fim_byte_t *dst, fim_byte_t *buffer, int mirror);/*dez's mirror patch*/ +fim_byte_t * convert_line_8(int bpp, int line, int owidth, fim_byte_t *dst, fim_byte_t *buffer, int mirror);/*dez's mirror patch*/ + + + + + + + +void init_dither(int shades_r, int shades_g, int shades_b, int shades_gray); +inline void dither_line(fim_byte_t *src, fim_byte_t *dst, int y, int width,int mirror); + +void dither_line_gray(fim_byte_t *src, fim_byte_t *dst, int y, int width); + + +void fb_switch_release(void); + +void fb_switch_acquire(void); + +int fb_switch_init(void); + +void fb_switch_signal(int signal); + +int fb_text_init2(void); + + +/*static void*/ +void svga_dither_palette(int r, int g, int b) +{ + int rs, gs, bs, i; + + rs = 256 / (r - 1); + gs = 256 / (g - 1); + bs = 256 / (b - 1); + for (i = 0; i < 256; i++) { + red_[i] = calc_gamma(rs * ((i / (g * b)) % r), 255); + green_[i] = calc_gamma(gs * ((i / b) % g), 255); + blue_[i] = calc_gamma(bs * ((i) % b), 255); + } +} + + +unsigned short calc_gamma(int n, int max) +{ + int ret =(int)(65535.0 * pow((float)n/(max), 1 / fbgamma_)); + if (ret > 65535) ret = 65535; + if (ret < 0) ret = 0; + return ret; +} + +void linear_palette(int bit) +{ + int i, size = 256 >> (8 - bit); + + for (i = 0; i < size; i++) + red_[i] = green_[i] = blue_[i] = calc_gamma(i,size); +} + +void lut_init(int depth) +{ + if (fb_var_.red.length && + fb_var_.green.length && + fb_var_.blue.length) { + /* fb_var_.{red|green|blue} looks sane, use it */ + init_one(lut_red_, fb_var_.red.length, fb_var_.red.offset); + init_one(lut_green_, fb_var_.green.length, fb_var_.green.offset); + init_one(lut_blue_, fb_var_.blue.length, fb_var_.blue.offset); + } else { + /* fallback */ + int i; + switch (depth) { + case 15: + for (i = 0; i < 256; i++) { + lut_red_[i] = (i & 0xf8) << 7; /* bits -rrrrr-- -------- */ + lut_green_[i] = (i & 0xf8) << 2; /* bits ------gg ggg----- */ + lut_blue_[i] = (i & 0xf8) >> 3; /* bits -------- ---bbbbb */ + } + break; + case 16: + for (i = 0; i < 256; i++) { + lut_red_[i] = (i & 0xf8) << 8; /* bits rrrrr--- -------- */ + lut_green_[i] = (i & 0xfc) << 3; /* bits -----ggg ggg----- */ + lut_blue_[i] = (i & 0xf8) >> 3; /* bits -------- ---bbbbb */ + } + break; + case 24: + for (i = 0; i < 256; i++) { + lut_red_[i] = i << 16; /* byte -r-- */ + lut_green_[i] = i << 8; /* byte --g- */ + lut_blue_[i] = i; /* byte ---b */ + } + break; + } + } +} + +void init_one(int32_t *lut, int bits, int shift) +{ + int i; + + if (bits > 8) + for (i = 0; i < 256; i++) + lut[i] = (i << (bits + shift - 8)); + else + for (i = 0; i < 256; i++) + lut[i] = (i >> (8 - bits)) << shift; +} + + int width(void) + { + return fb_var_.xres; + } + + int height(void) + { + return fb_var_.yres; + } + + int get_chars_per_column(void) + { + return fb_var_.yres / fb_font_height(); + } + + int get_chars_per_line(void) + { + return fb_var_.xres / fb_font_width(); + } + + fim_bool_t handle_console_switch(void) + { + if (switch_last_ == fb_switch_state_)return false; + + console_switch(true); + return true; + } + + //void status_screen(const fim_char_t *msg, int draw); + void fs_render_fb(fim_byte_t *ptr, int pitch, FSXCharInfo *charInfo, fim_byte_t *data); + fim_bpp_t get_bpp(void){return fb_var_.bits_per_pixel; }; + virtual ~FramebufferDevice(void); + virtual fim_coo_t status_line_height(void)const; +}; + +} + + + +#endif /* FIM_WITH_NO_FRAMEBUFFER */ +#endif /* FIM_FRAMEBUFFER_DEVICE_H */ + diff --git a/src/Image.cpp b/src/Image.cpp new file mode 100644 index 0000000..5e36a6e --- /dev/null +++ b/src/Image.cpp @@ -0,0 +1,1456 @@ +/* $LastChangedDate: 2017-04-09 15:39:39 +0200 (Sun, 09 Apr 2017) $ */ +/* + Image.cpp : Image manipulation and display + + (c) 2007-2017 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +//#include "Image.h" +#include "fim.h" + +#if FIM_WANT_EXIFTOOL +#include "ExifTool.h" +#endif /* FIM_WANT_EXIFTOOL */ + +#define FIM_WANT_BACKGROUND_LOAD 0 + +#if FIM_WANT_BACKGROUND_LOAD +#include +#endif /* FIM_WANT_BACKGROUND_LOAD */ + +#define FIM_IMAGE_INSPECT 0 +#if FIM_IMAGE_INSPECT +#define FIM_PR(X) printf("IMAGE:%c:%20s: f:%d/%d p:%d/%d %s\n",X,__func__,(int)getGlobalIntVariable(FIM_VID_FILEINDEX),(int)getGlobalIntVariable(FIM_VID_FILELISTLEN),(int)getGlobalIntVariable(FIM_VID_PAGE),(int)getIntVariable(FIM_VID_PAGES),(cacheable()?"cacheable":"uncacheable")); +#else /* FIM_IMAGE_INSPECT */ +#define FIM_PR(X) +#endif /* FIM_IMAGE_INSPECT */ + +#define FIM_WANT_ASCALE_FRIENDLY_ROTATION 1 + +#if FIM_WANT_PIC_CMTS + std::ostream& operator<<(std::ostream &os, const ImgDscs & id) + { + return id.print(os); + } +#endif /* FIM_WANT_PIC_CMTS */ + +/* + * TODO : + * Windowing related problems: + * + * Implement a mechanism such that each Image instance owns + * one only copy of the original image, and zero or more rescaled versions, + * for display use only. + * Once freed, an image could free all of its buffers, depending on the caching policy. + * + * When windowing will be implemented, note that redisplay will be also affected + * after window geometry change. Update mechanisms are needed.. + */ +namespace fim +{ +/* + * There is a general rule here: + * Public functions should be safe when called in + * any internal state from the outside. + * Private ones are stricter. + * + */ + static void fim_desaturate_rgb(fim_byte_t * data, int howmany) + { + register int avg; + for( fim_byte_t * p = data; p < data + howmany ;p+=3) + { avg=p[0]+p[1]+p[2]; p[0]=p[1]=p[2]=(fim_byte_t) (avg/3); } + } + + static void fim_negate_rgb(fim_byte_t * data, int howmany) + { + register int avg; + for( fim_byte_t * p = data; p < data + howmany ;p++) + *p = ~ *p; + } + + fim_coo_t Image::original_width(void)const + { + fim_coo_t ow; + assert(fimg_); + if(orientation_%2) + ow = fimg_->i.height; + else + ow = fimg_->i.width; + return ow; + } + + fim_coo_t Image::original_height(void)const + { + fim_coo_t ow; + assert(fimg_); + if(orientation_%2) + ow = fimg_->i.width; + else + ow = fimg_->i.height; + return ow; + } + + int Image::width(void)const + { + assert(img_); + return img_->i.width; + } + + int Image::height(void)const + { + assert(img_); + return img_->i.height; + } + + void Image::desc_update() + { +#if FIM_WANT_PIC_CMTS + fim_fn_t key(fim_basename_of(fname_.c_str())); + if(cc.id_.find(key) != cc.id_.end() ) + setVariable(FIM_VID_COMMENT,(cc.id_[key]).c_str()); +#if FIM_WANT_PIC_LVDN + assign_ns(cc.id_.vd_[key]); +#endif /* FIM_WANT_PIC_LVDN */ +#endif /* FIM_WANT_PIC_CMTS */ + } + + Image::Image(const fim_char_t *fname, FILE*fd, fim_page_t page): + scale_(0.0), + ascale_(0.0), + newscale_(0.0), + angle_(0.0), + newangle_(0.0), + page_(0), + img_ (FIM_NULL), + fimg_ (FIM_NULL), + orientation_(FIM_NO_ROT), + invalid_(false), + no_file_(true), + fs_(0), ms_(0), +#ifdef FIM_NAMESPACES + Namespace(&cc,FIM_SYM_NAMESPACE_IMAGE_CHAR), +#endif /* FIM_NAMESPACES */ + fis_(fim::string(fname)==fim::string(FIM_STDIN_IMAGE_NAME)?FIM_E_STDIN:FIM_E_FILE), + fname_ (FIM_CNS_DEFAULT_IFNAME) + + { + /* + * an image object is created from an image filename + */ + reset(); // pointers blank + if( !load(fname,fd,/*getGlobalIntVariable(FIM_VID_PAGE)*/page) || check_invalid() || (!fimg_) ) + { + FIM_PR('e'); + // FIXME: sometimes load() intentionally skips a file. an appropriate message shall be printed out + cout << "warning : invalid loading "<i),EXTRA_COMMENT); + + if(ie) + setVariable(FIM_VID_COMMENT,(fim_char_t*)(ie->data)); + + if(fname) + desc_update(); +#endif /* FIM_WANT_PIC_CMTS */ + +#if FIM_WANT_EXIFTOOL +if(fname && getGlobalIntVariable(FIM_VID_EXIFTOOL) != 0) +{ + fim_int ue = getGlobalIntVariable(FIM_VID_EXIFTOOL); + /* FIXME: one shall execute this code in a separate thread */ + /* std::cout << "will try exiftool on : " << fname << "\n"; */ + fim::string etc; + ExifTool *et = new ExifTool(); + TagInfo *info = et->ImageInfo(fname,FIM_NULL,2); + + if (info) + { + for (TagInfo *i=info; i; i=i->next) + { + etc+=i->name; + etc+=" = "; + etc+=i->value; + etc+=";"; + etc+="\n"; + //std::cout << "reading " << i->name << "...\n"; + } + delete info; + } + else if (et->LastComplete() <= 0) + { + std::cerr << "Error executing exiftool!" << std::endl; + } + char *err = et->GetError(); + if (err) std::cerr << err; + delete et; // delete our ExifTool object + //std::cout << "setting: " << etc << "\n", + if(ue == 1) + setVariable(FIM_VID_COMMENT,getVariable(FIM_VID_COMMENT)+(etc.c_str())); + if(ue == 2) + setVariable(FIM_VID_EXIFTOOL_COMMENT,etc.c_str()); +} +#endif /* FIM_WANT_EXIFTOOL */ + } + } + + void Image::reset(void) + { + /* + * pointers are blanked and values set to default + * */ + fimg_ = FIM_NULL; + img_ = FIM_NULL; + reset_scale_flags(); + } + + void Image::reset_scale_flags(void) + { + /* + * pointers are blanked and values set to default + * */ + scale_ = 1.0; + newscale_= 1.0; + ascale_ = 1.0; + angle_ = 0.0; + setVariable(FIM_VID_SCALE ,scale_*100); + setVariable(FIM_VID_ASCALE ,ascale_); + setVariable(FIM_VID_ANGLE ,angle_); + no_file_ =true; //reloading allowed + invalid_ =false; + orientation_=FIM_NO_ROT; + setVariable(FIM_VID_ORIENTATION, (fim_int)FIM_NO_ROT); + } + + bool Image::reload(void) + { + /* + reloads the file (no hope for streams, therefore) + FIXME : still unused + */ + bool b=false; + FILE *fd=fim_fopen(fname_.c_str(),"r"); + if(!fd) + return b; + b=load(fname_.c_str(),fd,page_); + fclose(fd);// FIXME : the fd could already be closed ! + return b; + } + +#if FIM_WANT_BACKGROUND_LOAD +void fim_background_load() +{ + std::cout << "background loading\n"; +} +#endif /* FIM_WANT_BACKGROUND_LOAD */ + +static void ers(const char*value, Image *image) +{ + // EXIF orientation value can be of the form "X - Y", with X and Y in + // {top,bottom,left,right} + // + // from http://sylvana.net/jpegcrop/exif_orientation.html + // we got the following combinations: + // Value 0th Row 0th Column + // 1 top left side + // 2 top right side + // 3 bottom right side + // 4 bottom left side + // 5 left side top + // 6 right side top + // 7 right side bottom + // 8 left side bottom + // + // neatly depicted in an F letter example: + // + // 1 2 3 4 5 6 7 8 + // + // 888888 888888 88 88 8888888888 88 88 8888888888 + // 88 88 88 88 88 88 88 88 88 88 88 88 + // 8888 8888 8888 8888 88 8888888888 8888888888 88 + // 88 88 88 88 + // 88 88 888888 888888 + // + // note that (in this order): + // 2,3,5,7 want a mirror transformation + // 4,3 want a flip transformation + // 7,8 want a cw rotation + // 5,6 want a ccw rotation + // + bool shouldmirror,shouldflip; + fim_int shouldrotate = 0; + fim_char_t r,c; + const fim_char_t *p = FIM_NULL; + fim_char_t f; + + if(!value || FIM_NULL == strchr(value,'-')) + goto uhmpf; + + p = strchr(value,'-')+1; + r=tolower(value[0]); + c=tolower(p[0]); + switch(r) + { + case 't': + switch(c){ + case 'l':f=1; break; + case 'r':f=2; break; + default: f=0; + } break; + case 'b': + switch(c){ + case 'r':f=3; break; + case 'l':f=4; break; + default: f=0; + } break; + case 'l': + switch(c){ + case 't':f=5; break; + case 'b':f=8; break; + default: f=0; + } break; + case 'r': + switch(c){ + case 't':f=6; break; + case 'b':f=7; break; + default: f=0; + } break; + default: f=0; + } + if(f==0) + goto uhmpf; + shouldmirror=(f==2 || f==3 || f==5 || f==7); + shouldflip=(f==4 || f==3); + if (f==5 || f==6) shouldrotate = Image::FIM_ROT_R; // cw + if (f==7 || f==8) shouldrotate = Image::FIM_ROT_L; // ccw + //std::cout << "EXIF_TAG_ORIENTATION FOUND !\n", + //std::cout << "VALUE: " <<(int)f << r<< c<< + //shouldmirror << shouldrotate << shouldflip, + //std::cout << "\n"; + if(shouldmirror && shouldflip && !shouldrotate) + shouldmirror = false, + shouldflip = false, + shouldrotate = Image::FIM_ROT_U; + if( shouldrotate ) + image->setVariable(FIM_VID_EXIF_ORIENTATION,shouldrotate); + if(shouldmirror) + image->setVariable(FIM_VID_EXIF_MIRRORED,(fim_int)1); + if(shouldflip) + image->setVariable(FIM_VID_EXIF_FLIPPED,(fim_int)1); +uhmpf: + return; + } + + bool Image::load(const fim_char_t *fname, FILE* fd, int want_page) + { + /* + * an image is loaded and initializes this image. + * returns false if the image does not load + */ + bool retval = false; + FIM_PR('*'); + if(fname==FIM_NULL && fname_==FIM_CNS_EMPTY_STRING) + { + FIM_PR('e'); + goto ret;//no loading = no state change + } + this->free(); + fname_=fname; + if( getGlobalIntVariable(FIM_VID_DISPLAY_STATUS_BAR)||getGlobalIntVariable(FIM_VID_DISPLAY_BUSY)) + { + if( getGlobalIntVariable(FIM_VID_WANT_PREFETCH) == 1) + cc.set_status_bar("please wait while prefetching...", "*"); + else + cc.set_status_bar("please wait while reloading...", "*"); + } + +#if FIM_WANT_BACKGROUND_LOAD + /* this would be a hypothetical starting point for a background running loader */ + std::thread t(&fim_background_load); + std::cout << "foreground running\n"; + t.join(); + std::cout << "loaded!\n"; +#endif /* FIM_WANT_BACKGROUND_LOAD */ + fimg_ = FbiStuff::read_image(fname,fd,want_page,this); +#if 0 + if(fimg_) + { + // fim_free(fimg_->data); + /* Such dimensions break SDL */ + fimg_->i.width = 100*1000*1000; + fimg_->i.height = 1; + fimg_->data = fim_pm_alloc(fimg_->i.width, fimg_->i.height); + for(int i=0;ii.width*fimg_->i.height;++i) + fimg_->data[i*3+0]=i%256, + fimg_->data[i*3+1]=i%256, + fimg_->data[i*3+2]=i%256; + } +#endif + +#if FIM_WANT_EXPERIMENTAL_MIPMAPS + if(fimg_) + if(getGlobalIntVariable(FIM_VID_WANT_MIPMAPS)>0) + mm_make(); +#endif /* FIM_WANT_EXPERIMENTAL_MIPMAPS */ + + if(strcmp(FIM_STDIN_IMAGE_NAME,fname)==0) + { + no_file_=true; //no file is associated to this image (to prevent reloading) + fis_ = FIM_E_STDIN; // yes, it seems redundant but it is necessary + } + else + { +#if FIM_WANT_KEEP_FILESIZE + struct stat stat_s; + if(-1!=stat(fname,&stat_s)) + { + fs_=stat_s.st_size; + } +#endif /* FIM_WANT_KEEP_FILESIZE */ + no_file_=false; //reloading allowed + } + + img_=fimg_; /* no scaling : one copy only */ + should_redraw(); + + if(! img_) + { + FIM_PR('!'); + cout<<"warning : image loading error!\n" ; + invalid_=true; + goto ret; + } + else + page_=want_page; + //cout<<"loaded page "<< want_page<<" to "<<((int*)this)<<"\n"; + +#ifdef FIM_NAMESPACES + setVariable(FIM_VID_PAGES ,(fim_int)fimg_->i.npages); + setVariable(FIM_VID_HEIGHT ,(fim_int)fimg_->i.height); + setVariable(FIM_VID_WIDTH ,(fim_int)fimg_->i.width ); + setVariable(FIM_VID_SHEIGHT,(fim_int) img_->i.height); + setVariable(FIM_VID_SWIDTH,(fim_int) img_->i.width ); + setVariable(FIM_VID_FIM_BPP, getGlobalIntVariable(FIM_VID_FIM_BPP) ); + setVariable(FIM_VID_SCALE ,newscale_*100); + setVariable(FIM_VID_ASCALE,ascale_); + setVariable(FIM_VID_ANGLE , angle_); + setVariable(FIM_VID_NEGATED , (fim_int)0); + setVariable(FIM_VID_DESATURATED, (fim_int)0); + setVariable(FIM_VID_FILENAME,fname_.c_str()); +#endif /* FIM_NAMESPACES */ + + setGlobalVariable(FIM_VID_HEIGHT ,(fim_int)fimg_->i.height); + setGlobalVariable(FIM_VID_WIDTH ,(fim_int)fimg_->i.width ); + setGlobalVariable(FIM_VID_SHEIGHT,(fim_int) img_->i.height); + setGlobalVariable(FIM_VID_SWIDTH ,(fim_int) img_->i.width ); + //setGlobalVariable(FIM_VID_SCALE ,newscale_*100); + //setGlobalVariable(FIM_VID_ASCALE ,ascale_); + + if( getGlobalIntVariable(FIM_VID_DISPLAY_STATUS_BAR)||getGlobalIntVariable(FIM_VID_DISPLAY_BUSY)) + cc.browser_.display_status(cc.browser_.current().c_str()); /* FIXME: an ugly way to force the proper status display */ + if(isSetVar("EXIF_Orientation")) + ers(getStringVariable("EXIF_Orientation").c_str(),this); + + FIM_PR('.'); + retval = true; +ret: + return retval; + } + + Image::~Image(void) + { + /* + * buffers are freed + * */ + FIM_PR('*'); +#ifdef FIM_CACHE_DEBUG + std::cout << "freeing Image " << this << "\n"; +#endif /* FIM_CACHE_DEBUG */ + this->free(); + FIM_PR('.'); + } + + bool Image::tiny(void)const + { + /* + * image width or height is <= 1 + * */ + if(!img_) + return true; + return ( img_->i.width<=1 || img_->i.height<=1 )?true:false; + } + + fim_err_t Image::scale_multiply(fim_scale_t sm) + { + /* + * current scale_ is multiplied by a factor + * */ + if(scale_*sm>0.0) + newscale_=scale_*sm, + rescale(); + return FIM_ERR_NO_ERROR; + } + + fim_err_t Image::setscale(fim_scale_t ns) + { + /* + * a new scale_ is set + * */ + newscale_=ns, + rescale(); + return FIM_ERR_NO_ERROR; + } + + bool Image::check_valid(void) + { + /* + * well,why not ? + * */ + return ! check_invalid(); + } + + bool Image::check_invalid(void) + { + /* + * the image is declared invalid if the image structures are not loaded. + */ + + //ACHTUNG! + if(!img_) + img_ = fimg_; + if(!img_) + invalid_ = true; + else + invalid_ = false; + return invalid_; + } + + void Image::free(void) + { + FIM_PR('*'); + /* + * the image descriptors are freed if necessary and pointers blanked + * */ + const bool shred = false; /* this is only for debug purposes */ + if(fimg_!=img_ && img_ ) + { + if(shred) + fim_desaturate_rgb( img_->data, 3* img_->i.width* img_->i.height), + fim_negate_rgb( img_->data, 3* img_->i.width* img_->i.height); + FbiStuff::free_image(img_ ); + } + if(fimg_ ) + { + if(shred) + fim_desaturate_rgb(fimg_->data, 3*fimg_->i.width*fimg_->i.height), + fim_negate_rgb( fimg_->data, 3*fimg_->i.width*fimg_->i.height); + FbiStuff::free_image(fimg_); + } +#if FIM_WANT_EXPERIMENTAL_MIPMAPS + mm_free(); +#endif /* FIM_WANT_EXPERIMENTAL_MIPMAPS */ + reset(); + FIM_PR('.'); + } + +// if the image rescaling mechanism is suspected of bugs, this will inhibit its use. +#define FIM_BUGGED_RESCALE 0 + + fim_err_t Image::rescale( fim_scale_t ns ) + { + /* + * effective image rescaling + * TODO: should rather be called "apply" + * */ + fim_pgor_t neworientation; + fim_angle_t gascale; + fim_scale_t newascale; + fim_angle_t gangle; + +#if FIM_BUGGED_RESCALE + goto ret; +#endif /* FIM_BUGGED_RESCALE */ + if(ns>0.0) + newscale_=ns;//patch + + if( check_invalid() ) + goto err; + if(tiny() && newscale_0.0 && newascale!=1.0)?newascale:((gascale>0.0 && gascale!=1.0)?gascale:1.0); + + //float newascale=getFloatVariable(FIM_VID_ASCALE); if(newascale<=0.0) newascale=1.0; + /* + * The global angle_ variable value will override the local if not 0 and the local unset + * */ + gangle =getGlobalFloatVariable(FIM_VID_ANGLE), + newangle_=getFloatVariable(FIM_VID_ANGLE); + newangle_=angle_?newangle_:((gangle!=0.0)?gangle:newangle_); + + if( newscale_ == scale_ + && newascale == ascale_ + && neworientation == orientation_ + //&& newangle_ == angle_ + && ( !newangle_ && !angle_ ) + ) + { + goto ret;/*no need to rescale*/ + } + orientation_ = FIM_MOD(neworientation,FIM_ROT_ROUND); + + setGlobalVariable(FIM_VID_SCALE,newscale_*100); + if(fimg_) + { + /* + * In case of memory allocation failure, we would + * like to recover the current image :) . + * + * Here it would be nice to add some sort of memory manager + * keeping score of copies and ... too complicated ... + */ + struct ida_image *backup_img=img_; + + if(getGlobalIntVariable(FIM_VID_DISPLAY_STATUS_BAR)||getGlobalIntVariable(FIM_VID_DISPLAY_BUSY)) + cc.set_status_bar("please wait while rescaling...", "*"); + + +#if FIM_WANT_ASCALE_FRIENDLY_ROTATION + if( img_ && ( orientation_==FIM_ROT_L || orientation_ == FIM_ROT_R )) + if( newascale != 1.0 ) + newascale = 1.0 / newascale; +#endif /* FIM_WANT_ASCALE_FRIENDLY_ROTATION */ +#define FIM_PROGRESSIVE_RESCALING 0 +#if FIM_PROGRESSIVE_RESCALING + /* + * progressive rescaling is computationally convenient in when newscale_scale_ && scale_ > 1.0) || + ( newscale_0)?(&mm_):FIM_NULL +#endif /* FIM_WANT_EXPERIMENTAL_MIPMAPS */ + ); +#endif /* FIM_PROGRESSIVE_RESCALING */ +#if FIM_WANT_ASCALE_FRIENDLY_ROTATION + if( img_ && ( orientation_==FIM_ROT_L || orientation_ == FIM_ROT_R )) + if( newascale != 1.0 ) + newascale = 1.0 / newascale; +#endif /* FIM_WANT_ASCALE_FRIENDLY_ROTATION */ + /* orientation_ can be 0,1,2,3 */ + if( img_ && ( orientation_==FIM_ROT_L || orientation_ == FIM_ROT_R )) + { + // we make a backup.. who knows! + // FIXME: should use a faster and memory-smarter member function : in-place + struct ida_image *rb=img_; + rb = FbiStuff::rotate_image90(rb,orientation_==FIM_ROT_L?FIM_I_ROT_L:FIM_I_ROT_R); + if(rb) + { + FbiStuff::free_image(img_); + img_=rb; + } + } + if( img_ && orientation_ == FIM_ROT_U) + { + // we make a backup.. who knows! + struct ida_image *rbb=FIM_NULL,*rb=FIM_NULL; + // FIXME: should use a faster and memory-smarter member function : in-place + rb = FbiStuff::rotate_image90(img_,FIM_I_ROT_L); + if(rb) + rbb = FbiStuff::rotate_image90(rb,FIM_I_ROT_L); + if(rbb) + { + FbiStuff::free_image(img_); + FbiStuff::free_image(rb); + img_=rbb; + } + else + { + if(rbb) + FbiStuff::free_image(rbb); + if(rb ) + FbiStuff::free_image(rb); + } + } + + /* we rotate only in case there is the need to do so */ + if( img_ && ( angle_ != newangle_ || newangle_) ) + { + // we make a backup.. who knows! + struct ida_image *rbb=FIM_NULL,*rb=FIM_NULL; + rb = FbiStuff::rotate_image(img_,newangle_); + if(rb) + rbb = FbiStuff::rotate_image(rb,0); + if(rbb) + { + FbiStuff::free_image(img_); + FbiStuff::free_image(rb); + img_=rbb; + } + else + { + if(rbb) + FbiStuff::free_image(rbb); + if(rb ) + FbiStuff::free_image(rb); + } + } + + if(!img_) + { + img_=backup_img; + if(getGlobalIntVariable(FIM_VID_DISPLAY_BUSY)) + cc.set_status_bar( "rescaling failed (insufficient memory?!)", getInfo().c_str()); + sleep(1); //just to give a glimpse.. + } + else + { + /* reallocation succeeded */ + if( backup_img && backup_img!=fimg_ ) + FbiStuff::free_image(backup_img); + scale_=newscale_; + ascale_=newascale; + angle_ =newangle_; + should_redraw(); + } + + /* + * it is important to set these values after rotation, too! + * */ + setVariable(FIM_VID_HEIGHT ,(fim_int)fimg_->i.height); + setVariable(FIM_VID_WIDTH ,(fim_int)fimg_->i.width ); + setVariable(FIM_VID_SHEIGHT,(fim_int) img_->i.height); + setVariable(FIM_VID_SWIDTH ,(fim_int) img_->i.width ); + setVariable(FIM_VID_ASCALE , ascale_ ); + //setGlobalVariable(FIM_VID_ANGLE , angle_ ); + } + else + should_redraw(); /* FIXME: here shall not really redraw */ + orientation_=neworientation; +ret: + return FIM_ERR_NO_ERROR; +err: + return FIM_ERR_GENERIC; + } + + void Image::reduce(fim_scale_t factor) + { + /* + * scale_ is adjusted by a dividing factor + * */ + newscale_ = scale_ / factor; + rescale(); + } + + void Image::magnify(fim_scale_t factor) + { + /* + * scale_ is adjusted by a multiplying factor + * */ + newscale_ = scale_ * factor; + rescale(); + } + + /* + void Image::resize(int nw, int nh) + { + //fixme + if(check_invalid()) + return; + }*/ + + Image::Image(const Image& image): + scale_(image.scale_), + ascale_(image.ascale_), + newscale_(image.newscale_), + angle_(image.angle_), + newangle_(image.newangle_), + page_(image.page_), + img_ (FIM_NULL), + fimg_ (FIM_NULL), + orientation_(image.orientation_), + //invalid_(0), + invalid_(image.invalid_), + no_file_(true), + fis_(image.fis_), + fs_(0), ms_(0), +#ifdef FIM_NAMESPACES + Namespace(image.rnsp_,FIM_SYM_NAMESPACE_IMAGE_CHAR), +#endif /* FIM_NAMESPACES */ + fname_ (image.fname_) + { + /* + * builds a clone of this image. + * it should be completely independent from this object. + * */ + reset(); + img_ = fbi_image_clone(image.img_ ); + fimg_ = fbi_image_clone(image.fimg_); + + /* an exception is launched immediately */ + if(!img_ || !fimg_) +#if 0 + ///* temporarily, for security reasons : throw FIM_E_NO_IMAGE*/; + { + std::cerr << "fatal error : " << __FILE__ << ":" << __LINE__ << " ( are you sure you gave an image file in standard input, uh ?)\n"; + throw FimException(); + std::exit(*(int*)FIM_NULL);// FIXME + } +#else + invalid_=true; +#endif + } + + Image * Image::getClone(void) + { + /* + * returns a clone of this image. + * it should be an object completely independent from this. + * */ + return new Image(*this); + } + +fim::string Image::getInfoCustom(const fim_char_t * ifsp)const +{ + static fim_char_t linebuffer[FIM_STATUSLINE_BUF_SIZE]; + fim_char_t pagesinfobuffer[FIM_STATUSLINE_BUF_SIZE]; + fim_char_t imagemode[4],*imp; + int n=getGlobalIntVariable(FIM_VID_FILEINDEX); +#if FIM_WANT_CUSTOM_INFO_STATUS_BAR + fim::string ifs; +#endif /* FIM_WANT_CUSTOM_INFO_STATUS_BAR */ + imp=imagemode; + + //if(getGlobalIntVariable(FIM_VID_AUTOFLIP))*(imp++)='F'; + //if(getGlobalIntVariable(FIM_VID_AUTOMIRROR))*(imp++)='M'; + + // should flip ? should mirror ? + int flip = + (((getGlobalIntVariable(FIM_VID_AUTOFLIP)== 1)|(getGlobalIntVariable("v:" FIM_VID_FLIPPED)== 1)|(is_flipped()))&& + !((getGlobalIntVariable(FIM_VID_AUTOFLIP)==-1)|(getGlobalIntVariable("v:" FIM_VID_FLIPPED)==-1)|(getIntVariable(FIM_VID_FLIPPED)==-1))); + int mirror = + (((getGlobalIntVariable(FIM_VID_AUTOMIRROR)== 1)|(getGlobalIntVariable("v:" FIM_VID_MIRRORED)== 1)|(is_mirrored()))&& + !((getGlobalIntVariable(FIM_VID_AUTOMIRROR)==-1)|(getGlobalIntVariable("v:" FIM_VID_MIRRORED)==-1)|(getIntVariable(FIM_VID_MIRRORED)==-1))); + + if(flip )*(imp++)=FIM_SYM_FLIPCHAR; + if(mirror)*(imp++)=FIM_SYM_MIRRCHAR; + if(orientation_!=FIM_NO_ROT) + { + if(orientation_==FIM_ROT_L) *(imp++)=FIM_ROT_L_C; + else + if(orientation_==FIM_ROT_U) *(imp++)=FIM_ROT_U_C; + else + if(orientation_==FIM_ROT_R) *(imp++)=FIM_ROT_R_C; + } + *imp=FIM_SYM_CHAR_NUL; + + if(fimg_ && fimg_->i.npages>1) + snprintf(pagesinfobuffer,sizeof(pagesinfobuffer)," [%d/%d]",(int)page_+1,(int)fimg_->i.npages); + else + *pagesinfobuffer='\0'; + +/* #if FIM_WANT_DISPLAY_MEMSIZE */ + // ms_ = byte_size(); + size_t ms = fimg_ ? ( fimg_->i.height*fimg_->i.width*3 ) : 0; +/* #endif */ /* FIM_WANT_DISPLAY_MEMSIZE */ + + +#if FIM_WANT_CUSTOM_INFO_STATUS_BAR + //if((ifs=getGlobalStringVariable(FIM_VID_INFO_FMT_STR))!="" && ifs.c_str() != FIM_NULL) + { + static fim_char_t clb[FIM_STATUSLINE_BUF_SIZE]; /* FIXME: reasons for having this static ? */ + //char*ifsp=(char*)ifs.c_str(); // FIXME + const char*fp=ifsp; + const char*sp=ifsp; + fim_char_t *clbp = clb; + int rbc = sizeof(clb)/sizeof(clb[0]); + + clb[0]=FIM_SYM_CHAR_NUL; + + while(*sp && *sp!='%') + { + ++sp; + } + goto sbum; + while(*sp=='%' && isprint(sp[1])) + { + + ++sp; + switch(*sp) + { + // "%p %wx%h %i/%l %F %M" + case('p'): + snprintf(clbp, rbc, "%.0f",scale_*100); + break; + case('w'): + snprintf(clbp, rbc, "%d",(int)this->width()); + break; + case('h'): + snprintf(clbp, rbc, "%d",(int)this->height()); + break; + case('i'): + /* browser property. TODO: move outta here */ + snprintf(clbp, rbc, "%d",(int)(n?n:1)); + break; +#if 1 + case('k'): + { + string cv = getStringVariable(FIM_VID_COMMENT); + if( cv.c_str() && *cv.c_str() ) + snprintf(clbp, rbc, "[%s] ",cv.c_str()); /* FIXME: need sanitization */ + } +#endif + break; + case('l'): + /* browser property. TODO: move outta here */ + snprintf(clbp, rbc, "%d",(int)(getGlobalIntVariable(FIM_VID_FILELISTLEN))); + break; + case('L'): + snprintf(clbp, rbc, "%s",imagemode); + break; + case('P'): + snprintf(clbp, rbc, "%s",pagesinfobuffer); + break; + case('F'): + fim_snprintf_XB(clbp, rbc,fs_); + break; + case('M'): + fim_snprintf_XB(clbp, rbc,ms); + break; + case('n'): + snprintf(clbp, rbc, "%s",getStringVariable(FIM_VID_FILENAME).c_str()); + break; + case('N'): + snprintf(clbp, rbc, "%s",fim_basename_of(getStringVariable(FIM_VID_FILENAME).c_str())); + break; + case('T'): + /* console property. TODO: move outta here */ + fim_snprintf_XB(clbp, rbc,cc.byte_size()); + break; + case('R'): + /* console property. TODO: move outta here */ + fim_snprintf_XB(clbp, rbc, fim_maxrss()); + break; +#if FIM_WANT_EXPERIMENTAL_MIPMAPS + case('m'): + fim_snprintf_XB(clbp, rbc,mm_.byte_size()); + break; +#endif /* FIM_WANT_EXPERIMENTAL_MIPMAPS */ + case('C'): + { + fim_char_t buf[2*FIM_PRINTFNUM_BUFSIZE]; + /* cache property. TODO: move outta here */ + fim_snprintf_XB(buf, sizeof(buf),cc.browser_.cache_.img_byte_size()); + snprintf(clbp, rbc, "#%d:%s",(int)cc.browser_.cache_.cached_elements(),buf); + } + break; + case('c'): + /* viewport property. TODO: move outta here */ + cc.current_viewport()->snprintf_centering_info(clbp, rbc); + break; + case('v'): + snprintf(clbp, rbc, "%s",FIM_CNS_FIM_APPTITLE); + break; + case('%'): + snprintf(clbp, rbc, "%c",'%'); + break; +#if FIM_EXPERIMENTAL_VAR_EXPANDOS + case('?'): /* "%?forward_comment?_filename?back_comment?" */ +#if 1 + if(strlen(sp+1)>=4) + { + char *fcp = FIM_NULL, *vip = FIM_NULL; + if( 2 == sscanf(sp,"?%m[A-Z_a-z]?%m[^?]?",&vip,&fcp) ) + if(fcp && vip) + { + char *fcpp = fcp; + + if(*vip && isSetVar(vip) && *fcp ) + { + char *vipp = FIM_NULL; +strdo: + vipp = fcpp; + while(*fcpp && *fcpp != '%') + ++fcpp; + snprintf(clb+strlen(clb), fcpp-vipp+1, "%s", vipp ); + rbc -= strlen(clbp); clbp += strlen(clbp); + + if(!*fcpp) + goto strdone; + ++fcpp; + vipp = fcpp; + if(*fcpp==':') + { + ++fcpp; + while(*fcpp && *fcpp!=':' && ( isalpha(*fcpp) || isdigit(*fcpp) || *fcpp=='_' )) + ++fcpp; + if(*fcpp==':') + { + snprintf(clbp, rbc, "%s",getStringVariable(string(vipp).substr(1,fcpp-vipp-1)).c_str()); + ++fcpp; + } + else + { + //snprintf(clb+strlen(clb), sizeof(clb), "%s",(string(vipp).substr(1,fcpp-vipp-1)).c_str()); + snprintf(clbp, rbc, "%s",""); + } + + } + else + { + //snprintf(clb+strlen(clb), sizeof(clb), "%s",fcpp); + snprintf(clbp, rbc, "%s",""); + } + goto strdo; + } +strdone: + sp += strlen(fcp)+strlen(vip)+2; + } + if(fcp)std::free(fcp); + if(vip)std::free(vip); + } +#else + if(strlen(sp+1)>=3) + { + char *fcp = FIM_NULL, *vip = FIM_NULL, *bcp = FIM_NULL; + if( 3 == sscanf(sp,"?%a[^?%]?%a[A-Z_a-z]?%a[^?%]?",&fcp,&vip,&bcp) ) + if(fcp && bcp && vip) + { + if(*vip && isSetVar(vip)) + snprintf(clbp, rbc, "%s%s%s",fcp,getStringVariable(vip).c_str(),bcp); + sp += strlen(fcp)+strlen(vip)+strlen(bcp)+3; + } + if(fcp)std::free(fcp); + if(bcp)std::free(bcp); + if(vip)std::free(vip); + } +#endif + break; +#endif /* FIM_EXPERIMENTAL_VAR_EXPANDOS */ + // default: + /* rejecting char; may display an error message here */ + } + ++sp; + fp=sp; +sbum: + while(*sp!='%' && sp[0]) + ++sp; + rbc -= strlen(clbp); clbp += strlen(clbp); + snprintf(clbp, FIM_MIN(sp-fp+1,rbc), "%s",fp); + rbc -= strlen(clbp); clbp += strlen(clbp); + } + //std::cout << "Custom format string chosen: "<< ifsp << ", resulting in: "<< clb <<"\n"; + snprintf(linebuffer, sizeof(linebuffer),"%s",clb); + goto labeldone; + } +#endif /* FIM_WANT_CUSTOM_INFO_STATUS_BAR */ +labeldone: + return fim::string(linebuffer); +} + +/* + * Creates a little description of some image, + * and places it in a NUL terminated static buffer. + */ +fim::string Image::getInfo(void) +{ + /* + * a short information about the current image is returned + * + * WARNING: + * the returned info, if not FIM_NULL, belongs to a statical buffer which LIVES with the image! + */ + //FIX ME ! + if(!fimg_) + return FIM_CNS_EMPTY_RESULT; + + static fim_char_t linebuffer[FIM_STATUSLINE_BUF_SIZE]; +#if FIM_WANT_CUSTOM_INFO_STATUS_BAR + fim::string ifs; + + if((ifs=getGlobalStringVariable(FIM_VID_INFO_FMT_STR))!="" && ifs.c_str() != FIM_NULL) + { + fim::string clb = getInfoCustom(ifs.c_str()); + snprintf(linebuffer, sizeof(linebuffer),"%s",clb.c_str()); + goto labeldone; + } + else +#endif /* FIM_WANT_CUSTOM_INFO_STATUS_BAR */ +{ + /* FIXME: for cleanup, shall eliminate this branch and introduce a default string. */ + fim_char_t pagesinfobuffer[FIM_STATUSLINE_BUF_SIZE]; + fim_char_t imagemode[3],*imp; + int n=getGlobalIntVariable(FIM_VID_FILEINDEX); + imp=imagemode; + + //if(getGlobalIntVariable(FIM_VID_AUTOFLIP))*(imp++)='F'; + //if(getGlobalIntVariable(FIM_VID_AUTOMIRROR))*(imp++)='M'; + + // should flip ? should mirror ? + int flip = + (((getGlobalIntVariable(FIM_VID_AUTOFLIP)== 1)|(getGlobalIntVariable("v:" FIM_VID_FLIPPED)== 1)|(is_flipped()))&& + !((getGlobalIntVariable(FIM_VID_AUTOFLIP)==-1)|(getGlobalIntVariable("v:" FIM_VID_FLIPPED)==-1)|(getIntVariable(FIM_VID_FLIPPED)==-1))); + int mirror = + (((getGlobalIntVariable(FIM_VID_AUTOMIRROR)== 1)|(getGlobalIntVariable("v:" FIM_VID_MIRRORED)== 1)|(is_mirrored()))&& + !((getGlobalIntVariable(FIM_VID_AUTOMIRROR)==-1)|(getGlobalIntVariable("v:" FIM_VID_MIRRORED)==-1)|(getIntVariable(FIM_VID_MIRRORED)==-1))); + + if(flip )*(imp++)=FIM_SYM_FLIPCHAR; + if(mirror)*(imp++)=FIM_SYM_MIRRCHAR; + *imp='\0'; + + if(fimg_->i.npages>1) + snprintf(pagesinfobuffer,sizeof(pagesinfobuffer)," [%d/%d]",(int)page_+1,(int)fimg_->i.npages); + else + *pagesinfobuffer='\0'; + +/* #if FIM_WANT_DISPLAY_MEMSIZE */ + // ms_ = byte_size(); + ms_ = fimg_ ? ( fimg_->i.height*fimg_->i.width*3 ) : 0; +/* #endif */ /* FIM_WANT_DISPLAY_MEMSIZE */ + + + snprintf(linebuffer, sizeof(linebuffer), + "[ %s%.0f%% %dx%d%s%s %d/%d ]" +#if FIM_WANT_DISPLAY_FILESIZE + " %dkB" +#endif /* FIM_WANT_DISPLAY_FILESIZE */ +#if FIM_WANT_DISPLAY_MEMSIZE + " %dMB" +#endif /* FIM_WANT_DISPLAY_MEMSIZE */ + , + /*fcurrent->tag*/ 0 ? "* " : "", + (scale_*100), + (int)this->width(), (int)this->height(), + imagemode, + pagesinfobuffer, + (int)(n?n:1), /* ... */ + (int)(getGlobalIntVariable(FIM_VID_FILELISTLEN)) +#if FIM_WANT_DISPLAY_FILESIZE + ,fs_/FIM_CNS_K +#endif /* FIM_WANT_DISPLAY_FILESIZE */ +#if FIM_WANT_DISPLAY_MEMSIZE + ,ms_/FIM_CNS_M +#endif /* FIM_WANT_DISPLAY_MEMSIZE */ + ); +} +labeldone: + return fim::string(linebuffer); +} + + bool Image::update(void) + { + /* + * updates the image according to its variables + * + * FIXME: a temporary member function + * */ + setVariable(FIM_VID_FRESH,(fim_int)0); + if(fimg_) + setVariable(FIM_VID_PAGES,(fim_int)fimg_->i.npages); + + /* + * rotation dispatch + * */ + fim_pgor_t neworientation=getOrientation(); + if( neworientation!=orientation_) + { + rescale(); + orientation_=neworientation; + return true; + } + return false; + } + + fim_pgor_t Image::getOrientation(void)const + { + /* + * warning : this should work more intuitively + * */ + fim_int eo = FIM_NO_ROT, weo = cc.getIntVariable(FIM_VID_WANT_EXIF_ORIENTATION); + eo += getIntVariable(FIM_VID_EXIF_ORIENTATION) * ( weo ? 1 : 0 ); + return (FIM_MOD( + ( eo + + getIntVariable(FIM_VID_ORIENTATION) + +getGlobalIntVariable("v:" FIM_VID_ORIENTATION) + +getGlobalIntVariable(FIM_VID_ORIENTATION) + ) ,4)); + } + + fim_err_t Image::rotate( fim_scale_t angle_ ) + { + /* + * rotates the image the specified amount of degrees + * */ + float newangle_=this->angle_+angle_; + if( check_invalid() ) + return FIM_ERR_GENERIC; + setVariable(FIM_VID_ANGLE,newangle_); + return rescale(); // FIXME : necessary *only* for image update and display + } + + bool Image::prev_page(int j) + { + string s=fname_; + if(have_prevpage(j)) + return load(s.c_str(),FIM_NULL,page_-j); + else + return false; + } + + bool Image::goto_page(fim_page_t j) + { + string s=fname_; + bool retval = false; + // if( j>0 )--j; + FIM_PR('*'); + if( !fimg_ ) + goto ret; + if( j<0 ) + j=fimg_->i.npages-1; + if( j>page_ ? have_nextpage(j-page_) : have_prevpage(page_-j) ) + { + //if(0)cout<<"about to goto page "<i.npages>1 ) ) + return true; + return false; + } + + bool Image::have_nextpage(int j)const + { + /* FIXME : missing overflow check */ + return (is_multipage() && page_+j < fimg_->i.npages); + } + + bool Image::have_prevpage(int j)const + { + /* FIXME : missing overflow check */ + return (is_multipage() && page_-j >= 0); + } + + int Image::is_mirrored(void)const + { + return FIM_XOR( this->getIntVariable(FIM_VID_EXIF_MIRRORED)==1, this->getIntVariable(FIM_VID_MIRRORED)==1 ); + } + + int Image::is_flipped(void)const + { + + return FIM_XOR( this->getIntVariable(FIM_VID_EXIF_FLIPPED) ==1, this->getIntVariable(FIM_VID_FLIPPED)==1 ); + } + +#if 0 + bool Image::gray_negate(void) + { + /* FIXME : NEW, but unused */ + int n; + int th=1;/* 0 ... 256 * 3 * 3 */ + + if(!img_ || !img_->data) + return false; + + if(!fimg_ || !fimg_->data) + return false; + + for( n=0; n< 3*fimg_->i.width*fimg_->i.height ; n+=3 ) + { + int r,g,b,s,d; + r=fimg_->data[n+0]; + g=fimg_->data[n+1]; + b=fimg_->data[n+2]; + s=r+g+b; + d=( s - 3 * r ) * ( s - 3 * g ) * ( s - 3 * b ); + d=d<0?-d:d; + if( d < th ) + { + fimg_->data[n+0]=~fimg_->data[n+0]; + fimg_->data[n+1]=~fimg_->data[n+1]; + fimg_->data[n+2]=~fimg_->data[n+2]; + } + } + + for( n=0; n< 3*img_->i.width*img_->i.height ; n+=3 ) + { + int r,g,b,s,d; + r=img_->data[n+0]; + g=img_->data[n+1]; + b=img_->data[n+2]; + s=r+g+b; + d=( s - 3 * r ) * ( s - 3 * g ) * ( s - 3 * b ); + d=d<0?-d:d; + if( d < th ) + { + img_->data[n+0]=~img_->data[n+0]; + img_->data[n+1]=~img_->data[n+1]; + img_->data[n+2]=~img_->data[n+2]; + } + } + + setGlobalVariable("i:" FIM_VID_NEGATED,1-getGlobalIntVariable("i:" FIM_VID_NEGATED )); + + should_redraw(); + + return true; + } +#endif + + bool Image::desaturate(void) + { +#if 0 + if(! img_ || ! img_->data) + return false; + if(!fimg_ || !fimg_->data) + return false; +#endif + + if( fimg_ && fimg_->data) + fim_desaturate_rgb(fimg_->data, 3*fimg_->i.width*fimg_->i.height); + + if( img_ && img_->data) + fim_desaturate_rgb(img_->data, 3*img_->i.width*img_->i.height); + +#if FIM_WANT_EXPERIMENTAL_MIPMAPS + if( mm_.mdp) + fim_desaturate_rgb(mm_.mdp, mm_.mmb); +#endif /* FIM_WANT_EXPERIMENTAL_MIPMAPS */ + + setGlobalVariable("i:" FIM_VID_DESATURATED ,1-getGlobalIntVariable("i:" FIM_VID_DESATURATED )); + + should_redraw(); + + return true; + } + + bool Image::negate(void) + { + /* NEW */ + + /* FIXME */ + /*return gray_negate();*/ +#if 0 + if(! img_ || ! img_->data) + return false; + if(!fimg_ || !fimg_->data) + return false; +#endif + + if( fimg_ && fimg_->data) + fim_negate_rgb(fimg_->data, 3*fimg_->i.width*fimg_->i.height); + + if( img_ && img_->data) + fim_negate_rgb(img_->data, 3*img_->i.width*img_->i.height); + +#if FIM_WANT_EXPERIMENTAL_MIPMAPS + if( mm_.mdp) + fim_negate_rgb(mm_.mdp, mm_.mmb); +#endif /* FIM_WANT_EXPERIMENTAL_MIPMAPS */ + + setGlobalVariable("i:" FIM_VID_NEGATED ,1-getGlobalIntVariable("i:" FIM_VID_NEGATED )); + + should_redraw(); + + return true; + } + + int Image::n_pages()const{return (fimg_?fimg_->i.npages:0);} + + size_t Image::byte_size(void)const + { + size_t ms = 0; + + if(fimg_) + ms += fimg_->i.height*fimg_->i.width*3; + if(fimg_!=img_ && img_) + ms += img_->i.height* img_->i.width*3; +#if FIM_WANT_EXPERIMENTAL_MIPMAPS + ms += mm_.byte_size(); +#endif /* FIM_WANT_EXPERIMENTAL_MIPMAPS */ + return ms; + } + +#if FIM_WANT_BDI + Image::Image(void) + { + /* although invalid, this image instance should support all operations on it */ + // fim_bzero(this,sizeof(*this)); + reset(); + assert(check_invalid()); + } + + bool Image::can_reload(void)const{return !no_file_;} + const fim_char_t* Image::getName(void)const{return fname_.c_str();} + fim_int Image::c_page(void)const{return page_;} +#endif /* FIM_WANT_BDI */ + +#if FIM_WANT_EXPERIMENTAL_MIPMAPS + void Image::mm_free(void) { mm_.dealloc(); } + void Image::mm_make(void) { mm_.dealloc(); FbiStuff::fim_mipmaps_compute(fimg_,&mm_); } + bool Image::has_mm(void)const { return mm_.ok(); } +#endif /* FIM_WANT_EXPERIMENTAL_MIPMAPS */ + bool Image::cacheable(void)const { return this->n_pages() == 1 ; } +} + diff --git a/src/Image.h b/src/Image.h new file mode 100644 index 0000000..647fdd7 --- /dev/null +++ b/src/Image.h @@ -0,0 +1,392 @@ +/* $LastChangedDate: 2017-04-09 14:42:34 +0200 (Sun, 09 Apr 2017) $ */ +/* + Image.h : Image class headers + + (c) 2007-2016 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef FIM_IMAGE_H +#define FIM_IMAGE_H + +#include "FbiStuff.h" +#include "fim.h" +#if FIM_WANT_PIC_CMTS +/* FIXME: temporarily here */ +#include +#include +#include +#include +#include +#include +#include +#include +#endif /* FIM_WANT_PIC_CMTS */ + +namespace fim +{ +/* + * A general rule in programming the Image member functions is that + * of keeping them minimal. + * Combining them is matter of the invoking function. + * So, there is NO internal triggering here to call ANY + * display function. + * + * + * WARNING : + * + * This class is evolving towards something + * reflecting the content of an image file and + * some rescaled images caches. + * + * Note that the way our code stores image data is device-dependent. + * Therefore the need for a framebufferdevice reference in Image. + * + * TODO : separate Image in a way multiple viewports could use the same image. + */ + +#ifdef FIM_NAMESPACES +class Image:public Namespace +#else /* FIM_NAMESPACES */ +class Image +#endif /* FIM_NAMESPACES */ +{ + public: + + Image(const fim_char_t *fname, FILE *fd=FIM_NULL, fim_page_t page = 0); + Image(const fim_char_t *fname, Foo& foo, FILE *fd=FIM_NULL); + ~Image(void); + + bool prev_page(int j=+1); + bool next_page(int j=+1); + int n_pages(void)const; + bool is_multipage(void)const; + int is_mirrored(void)const; + int is_flipped(void)const; + bool have_nextpage(int j=1)const; + bool have_prevpage(int j=1)const; + + private: + Image& operator= (const Image &i){return *this;/* a nilpotent assignation */} + fim_scale_t scale_; /* viewport variables */ + fim_scale_t ascale_; + fim_scale_t newscale_; + fim_scale_t angle_; + fim_scale_t newangle_; + fim_page_t page_; + + /* virtual stuff */ + public://TMP + enum { FIM_ROT_L=3,FIM_ROT_R=1,FIM_ROT_U=2 }; + struct ida_image *img_ ; /* local (eventually) copy images */ + bool reload(void); + private://TMP +#if FIM_WANT_EXPERIMENTAL_MIPMAPS + fim_mipmap_t mm_; +#endif /* FIM_WANT_EXPERIMENTAL_MIPMAPS */ + struct ida_image *fimg_ ; /* master image */ + + /* image member functions */ + bool load(const fim_char_t *fname, FILE *fd, int want_page); + public: + void should_redraw(enum fim_redraw_t sr = FIM_REDRAW_NECESSARY) { redraw_ = sr; } /* for Viewport after drawing */ + + protected: + fim_redraw_t redraw_; + enum { FIM_NO_ROT=0,FIM_ROT_ROUND=4 }; + enum { FIM_ROT_L_C='L',FIM_ROT_R_C='R',FIM_ROT_U_C='U' }; + enum { FIM_I_ROT_L=0, FIM_I_ROT_R=1}; /* internal */ + fim_pgor_t orientation_; // orthogonal rotation + + fim_bool_t invalid_; //the first time the image is loaded it is set to 1 + fim_bool_t no_file_; //no file is associated to this image (used for reading from /dev/stdin at most once.) + fim_image_source_t fis_; + + string fname_; /* viewport variable, too */ + size_t fs_; /* file size */ + size_t ms_; /* memory size */ + + void free(void); + void reset(void); + + bool tiny(void)const; + public: + void reset_scale_flags(void); + virtual size_t byte_size(void)const; + + bool can_reload(void)const; + bool update(void); + + fim::string getInfo(void); + fim::string getInfoCustom(const fim_char_t * ifsp)const; + Image(const Image& image); // yes, a private constructor (was) +#if FIM_WANT_BDI + Image(void); +#endif /* FIM_WANT_BDI */ + fim_err_t rescale( fim_scale_t ns=0.0 ); + fim_err_t rotate( fim_scale_t angle_=1.0 ); + + const fim_char_t* getName(void)const; + cache_key_t getKey(void)const; + + /* viewport member functions */ + + void reduce( fim_scale_t factor=FIM_CNS_SCALEFACTOR); + void magnify(fim_scale_t factor=FIM_CNS_SCALEFACTOR); + + fim_pgor_t getOrientation(void)const; + + fim_err_t setscale(fim_scale_t ns); + /* viewport member functions ? */ + fim_err_t scale_multiply (fim_scale_t sm); + fim_scale_t ascale()const{ return (ascale_>0.0?ascale_:1.0); } + bool negate (void);/* let's read e-books by consuming less power :) */ + bool desaturate (void); + bool gray_negate(void); + + bool check_invalid(void); + bool check_valid(void); + bool valid(void)const{return !invalid_;} + + int width(void)const; + fim_coo_t original_width(void)const; + int height(void)const; + fim_coo_t original_height(void)const; + bool goto_page(fim_page_t j); + + Image * getClone(void); +// void resize(int nw, int nh); + fim_int c_page(void)const; +#if FIM_WANT_EXPERIMENTAL_MIPMAPS + void mm_free(void); + void mm_make(void); + bool has_mm(void)const; +#endif /* FIM_WANT_EXPERIMENTAL_MIPMAPS */ + bool cacheable(void)const; + void desc_update(); + fim_bool_t need_redraw(void)const{ return (redraw_ != FIM_REDRAW_UNNECESSARY); } +}; +} +#if FIM_WANT_PIC_LVDN + class VNamespace: public Namespace { size_t byte_size(void)const{return 0; /* FIXME */}; }; +#endif /* FIM_WANT_PIC_LVDN */ + +#if FIM_WANT_PIC_CMTS +/* FIXME: temporarily here */ +typedef std::string fim_fn_t; /* file name */ +typedef std::string fim_ds_t; /* file description */ + +class ImgDscs: public std::map +{ + public: +#if FIM_WANT_PIC_LVDN + typedef std::map vd_t; + vd_t vd_; +#endif /* FIM_WANT_PIC_LVDN */ + template struct ImgDscsCmp:public std::binary_function + { + public: + bool operator() (const typename T::value_type &vo, const typename T::mapped_type mo) const + { + return vo.second == mo; + } + }; + ImgDscs::iterator li_; + ImgDscs::iterator fo(const key_type & sk, const ImgDscs::iterator & li) + { + return std::find_if(li,end(),std::bind2nd(ImgDscsCmp(),sk)); + } + ImgDscs::const_iterator fo(const key_type & sk, const ImgDscs::const_iterator & li)const + { + return std::find_if(li,end(),std::bind2nd(ImgDscsCmp(),sk)); + } +public: + ImgDscs::const_iterator fo(const key_type & sk)const + { + return std::find_if(begin(),end(),std::bind2nd(ImgDscsCmp(),sk)); + } +private: + ImgDscs::iterator fi(const key_type & sk) + { + ImgDscs::iterator li; + + if(li_ == end()) + li_ = begin(); + li = li_ = fo(sk,li_); + if(li_ == end()) + li_ = begin(); + else + ++li_; + return li; + } +public: + void reset(void) + { + li_=begin(); + } + ImgDscs(void) + { + reset(); + } + void fetch(const fim_fn_t &dfn, const fim_char_t sc) + { + /* dfn: descriptions file name */ + /* sc: separator char */ + std::ifstream mfs (dfn.c_str(),std::ios::app); + std::string ln; +#if FIM_WANT_PIC_RCMT + std::string ld; // last description +#endif /* FIM_WANT_PIC_RCMT */ +#if FIM_WANT_PIC_LVDN + VNamespace ns; +#endif /* FIM_WANT_PIC_LVDN */ + + while( std::getline(mfs,ln)) + { + std::stringstream ls(ln); + key_type fn; + const fim_char_t nl = '\n'; + fim_fn_t ds; + +#if FIM_WANT_PIC_LVDN + if( ls.peek() == FIM_SYM_PIC_CMT_CHAR ) + { + if( std::getline(ls,fn,nl) ) + { + /* ignoring it: it's a comment line */ + size_t vn = fn.find_first_of("!fim:",1); + if( vn != std::string::npos && fn[vn+=5] ) + { + size_t es = fn.find_first_of("=",vn); + if( es != std::string::npos ) + { + std::string varname = fn.substr(vn,es-vn); + ++es; + if( fn[es] ) + { + std::string varval = fn.substr(es); + ns.setVariable(varname,Var(varval)); + } + else + { + std::string varname = fn.substr(vn,es-1-vn); + ns.unsetVariable(varname); + } + } + } + } + } + else +#endif /* FIM_WANT_PIC_LVDN */ + if(std::getline(ls,fn,sc)) + { + const bool aoec = true; // (propagate i:variables) also on empty commentary + + if( (std::getline(ls,ds,nl) /* non empty commentary */) || aoec) + { + const bool want_basename = true; /* */ +#if FIM_WANT_PIC_RCMT + { + size_t csi = ds.find_first_of("#!fim:",0); + size_t csil = 6; + + if( csi != 0 ) + ld = ds; // cache new description + else + { + // use last (cached) description + char sc = ds[csil]; + + switch(sc) + { + case('='): // #!fim:= + ds = ld; + break; + case('+'): // #!fim:+ + ds = ld + ds.substr(csil+1); + break; + case('^'): // #!fim:^ + ds = ds.substr(csil+1) + ld; + break; + case('s'): // #!fim:s/from/to '/' not allowed in from or to + { + fim::string es = ds.substr(csil); + size_t m = ((es).re_match("s/[^/]+/[^/]+")); + if(m) + { + size_t n = es.find("/",2); + std::string fs = es.substr(2,n-2), ts = es.substr(n+1); + fim::string fds = ld; + fds.substitute(fs.c_str(),ts.c_str()); + ds = fds.c_str(); + } + } + break; + } + } + } +#endif /* FIM_WANT_PIC_RCMT */ + if(! want_basename ) + { + (*this)[fn]=ds; +#if FIM_WANT_PIC_LVDN + vd_[std::string(fn)]=ns; +#endif /* FIM_WANT_PIC_LVDN */ + } + else + { + (*this)[fim_basename_of(fn.c_str())]=ds; +#if FIM_WANT_PIC_LVDN + vd_[fim_basename_of(fn.c_str())]=ns; +#endif /* FIM_WANT_PIC_LVDN */ + } + } + } + } + reset(); + } + key_type fk(const mapped_type & sk) + { + mapped_type v; + if ( fo(sk,li_) != end() ) + { + v = fi(sk)->first; + } + else + { + reset(); + if ( fo(sk,li_) != end() ) + v = fi(sk)->first; + } + return v; + } + size_t byte_size(void)const + { + size_t bs = size() + sizeof(*this); + for( const_iterator it = begin();it != end(); ++it ) + bs += it->first.size() + sizeof(it->first), + bs += it->second.size() + sizeof(it->second); + return bs; + } + std::ostream& print(std::ostream &os)const + { + os << (size()) << " entries in " << byte_size() << " bytes"; + return os; + } +}; + std::ostream& operator<<(std::ostream &os, const ImgDscs & id); +#endif /* FIM_WANT_PIC_CMTS */ +#endif /* FIM_IMAGE_H */ diff --git a/src/Imlib2Device.cpp b/src/Imlib2Device.cpp new file mode 100644 index 0000000..d3e3cc0 --- /dev/null +++ b/src/Imlib2Device.cpp @@ -0,0 +1,654 @@ +/* $LastChangedDate: 2015-12-19 01:44:41 +0100 (Sat, 19 Dec 2015) $ */ +/* + Imlib2.cpp : Imlib2 device Fim driver file + + (c) 2011-2015 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/* + * NOTES : The Imlib2 support here is INCOMPLETE + * This code is horrible, inefficient, and error handling is MISSING. + * Flip/mirror display is missing. + * Fullscreen display is missing. + * Mouse handling is missing. + * TODO: we use so little of imlib2 here that it would be better to use X only, here. + */ +#include "fim.h" + +#ifdef FIM_WITH_LIBIMLIB2 + +#include "Imlib2Device.h" +#include +#include +#define FIM_IL2_PRINTF printf + +#define FIM_IMLIB2_X_INPUT_MASK NoEventMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask | KeyPressMask | KeyReleaseMask +#define FIM_IMLIB2_X_WINDOW_MASK NoEventMask | StructureNotifyMask +#define FIM_IMLIB2_X_MASK FIM_IMLIB2_X_INPUT_MASK | ExposureMask | FIM_IMLIB2_X_WINDOW_MASK + +namespace fim +{ + extern CommandConsole cc; +} + +// FIXME: these shall become Imlib2Device members! +static Display *disp=FIM_NULL; +static Visual *vis=FIM_NULL; +static int depth; +static bool initialized=false; +static Colormap cm; +static Window win; + +#ifndef FIM_WANT_NO_OUTPUT_CONSOLE + Imlib2Device::Imlib2Device(MiniConsole & mc_, fim::string opts):DisplayDevice(mc_), +#else /* FIM_WANT_NO_OUTPUT_CONSOLE */ + Imlib2Device::Imlib2Device( + fim::string opts + ):DisplayDevice(), +#endif /* FIM_WANT_NO_OUTPUT_CONSOLE */ + current_w_(FIM_DEFAULT_WINDOW_HEIGHT), current_h_(FIM_DEFAULT_WINDOW_WIDTH) + ,want_windowed_(false) + { + FontServer::fb_text_init1(fontname_,&f_); // FIXME : move this outta here + const fim_char_t*os=opts.c_str(); + parse_optstring(os); + } + +fim_bpp_t Imlib2Device::get_bpp(){return depth; } + +fim_err_t Imlib2Device::parse_optstring(const fim_char_t *os) +{ + bool want_windowed=want_windowed_; + bool want_mouse_display=want_mouse_display_; + bool want_resize=want_resize_; + fim_coo_t current_w=current_w_; + fim_coo_t current_h=current_h_; + + if(os) + { + while(*os&&!isdigit(*os)) + { + bool tv=true; + if(isupper(*os)) + tv=false; + switch(tolower(*os)){ + case 'w': want_windowed=tv; break; + //case 'm': want_mouse_display=tv; break; + //case 'r': want_resize=tv; break; + default: std::cerr<<"unrecognized specifier character \""<<*os<<"\"\n";goto err; + } + ++os; + } + if(*os) + { + if(2==sscanf(os,"%d:%d",¤t_w,¤t_h)) + + { + // std::cout << w << " : "<< h<<"\n"; + current_w=FIM_MAX(current_w,0); + current_h=FIM_MAX(current_h,0); + if(!allowed_resolution(current_w,current_h)) + goto err; + } + else + { + current_w=current_h=0; + std::cerr << "user specification of resolution (\""<irows ) return -2-3*100 ; + if( icoff>icols ) return -3-5*100; +// if( oroff>orows ) return -7-9*100;//EXP +// if( ocoff>ocols ) return -8-10*100;//EXP + if( oroff>height() ) return -7-9*100;//EXP + if( ocoff>width()) return -8-10*100;//EXP + + if( icskip height() ) return -9 -99*100; + if( ocols > width() ) return -10-99*100; + if( ocskip < width() ) return -11-99*100; + if( icskipdata:FIM_NULL;// source rgb array + + if(initialized==false) goto ret; + + clear_rect( 0, width()-1, 0, height()-1); + if(!img) goto ret; + if(!rgb) goto ret; + ild=imlib_image_get_data(); + for(oi=oroff;FIM_LIKELY(oiheight; + } + + int Imlib2Device::get_chars_per_line(void) + { + return width() / f_->width; + } + + fim_coo_t Imlib2Device::width(void) + { + return current_w_; + } + + fim_coo_t Imlib2Device::height(void) + { + return current_h_; + } + + fim_sys_int Imlib2Device::get_input(fim_key_t * c, bool want_poll) + { + return get_input_i2l(c); + } + +fim_sys_int Imlib2Device::get_input_i2l(fim_key_t * c) +{ + int rc=-1; + fim_key_t pk=0; + + updates_ = imlib_updates_init(); + // if(True==XCheckMaskEvent(disp,FIM_IMLIB2_X_INPUT_MASK /*KeyPressMask,&ev_)) + // if(True==XCheckMaskEvent(disp,FIM_IMLIB2_X_INPUT_MASK,&ev_)) + if(True==XCheckMaskEvent(disp,KeyPressMask,&ev_)) + { + switch (ev_.type) + { + case ConfigureNotify: + case ConfigureRequest: + case ResizeRequest: + case ResizeRedirectMask: + case StructureNotifyMask: + break; + case KeyPress: + { + char buf[FIM_ATOX_BUFSIZE]; + int nc=0; + KeySym ks; + buf[nc]=FIM_SYM_CHAR_NUL; + nc=XLookupString(&ev_.xkey,buf,sizeof(buf),&ks,FIM_NULL); + buf[nc]=FIM_SYM_CHAR_NUL; + //FIM_IL2_PRINTF("PKEY :%d:%s:%d\n",ev_.xkey.keycode,buf,ks); + if( *buf) + rc=1; + else + break; + if(nc==1) + pk=*buf; + else + pk=ks; + //if(ev_.xkey.keycode==23)pk='\t';/* FIXME */ + //FIM_IL2_PRINTF("PRESSED :%d %c\n",pk,pk); + ks=XLookupKeysym(&ev_.xkey,0); + if(ks!=NoSymbol) + ;//FIM_IL2_PRINTF("SYM :%d %c\n",ks,ks); + else + rc=0; + } + break; + case KeyRelease: + //FIM_IL2_PRINTF("KEY RELEASE:%d %c\n",0,0); + break; + case Expose: + updates_=imlib_update_append_rect(updates_,ev_.xexpose.x,ev_.xexpose.y,ev_.xexpose.width,ev_.xexpose.height); + break; + case ButtonPress: + //FIM_IL2_PRINTF("MOUSE PRESSED :%d %d\n",ev_.xbutton.x,ev_.xbutton.y); + break; + case MotionNotify: + // FIM_IL2_PRINTF("MOTION NOTIFY:%d %c\n",0,0); + break; + default: + break; + } + } + updates_=imlib_updates_merge_for_rendering(updates_,current_w_,current_h_); + for (current_update_=updates_; + current_update_; + current_update_ = imlib_updates_get_next(current_update_)) + ; // FIXME; shall restructure the drawing functions sequence to use imlib_updates_merge_for_rendering + + if (updates_) + imlib_updates_free(updates_), + updates_=FIM_NULL; + + if(!c) + rc=0; + else + { + if(rc==1) + *c=pk; + } + + XWindowAttributes attributes; + XGetWindowAttributes(disp,win,&attributes); + if(current_w_!=attributes.width || current_h_!=attributes.height) + { + // FIXME: move outta here this check & resize (shall intercept the event first, though) + current_w_=attributes.width; + current_h_=attributes.height; + cc.resize(current_w_,current_h_); + } + return rc; +} + + fim_err_t Imlib2Device::fill_rect(fim_coo_t x1, fim_coo_t x2, fim_coo_t y1,fim_coo_t y2, fim_color_t color) + { + // FIXME: this code may be not portable + fim_color_t rmask=0xFF000000,gmask=0x00FF0000,bmask=0x0000FF00,amask=0x000000FF; + if(initialized==false) goto ret; + imlib_context_set_color((color&rmask)>>24,(color&gmask)>>16,(color&bmask)>>8,(color&amask)); + imlib_image_fill_rectangle(x1,y1,x2-x1+1,y2-y1+1); + imlib_render_image_on_drawable(0,0); +ret: + return FIM_ERR_NO_ERROR; + } + + fim_err_t Imlib2Device::clear_rect(fim_coo_t x1, fim_coo_t x2, fim_coo_t y1,fim_coo_t y2) + { + // FIXME: this code may be not portable + if(initialized==false) goto ret; + imlib_context_set_color(0x0,0x0,0x0,0xFF); + imlib_image_fill_rectangle(x1,y1,x2-x1+1,y2-y1+1); + imlib_render_image_on_drawable(0,0); +ret: + return FIM_ERR_NO_ERROR; + } + +void Imlib2Device::fs_render_fb(fim_coo_t x_, fim_coo_t y, FSXCharInfo *charInfo, fim_byte_t *data) +{ + if(initialized==false) goto err; +/* + * These preprocessor macros should serve *only* for font handling purposes. + * */ +#define BIT_ORDER BitmapFormatBitOrderMSB +#ifdef BYTE_ORDER +#undef BYTE_ORDER +#endif +#define BYTE_ORDER BitmapFormatByteOrderMSB +#define SCANLINE_UNIT BitmapFormatScanlineUnit8 +#define SCANLINE_PAD BitmapFormatScanlinePad8 +#define EXTENTS BitmapFormatImageRectMin + +#define SCANLINE_PAD_BYTES 1 +#define GLWIDTHBYTESPADDED(bits, nBytes) \ + ((nBytes) == 1 ? (((bits) + 7) >> 3) /* pad to 1 byte */\ + :(nBytes) == 2 ? ((((bits) + 15) >> 3) & ~1) /* pad to 2 bytes */\ + :(nBytes) == 4 ? ((((bits) + 31) >> 3) & ~3) /* pad to 4 bytes */\ + :(nBytes) == 8 ? ((((bits) + 63) >> 3) & ~7) /* pad to 8 bytes */\ + : 0) + + fim_coo_t row,bit,x; + fim_sys_int bpr; + DATA32 *ild; + ild=imlib_image_get_data(); + if(!ild)goto err; + bpr = GLWIDTHBYTESPADDED((charInfo->right - charInfo->left), SCANLINE_PAD_BYTES); + for (row = 0; row < (charInfo->ascent + charInfo->descent); row++) + { + for (x = 0, bit = 0; bit < (charInfo->right - charInfo->left); bit++) + { + if (data[bit>>3] & fs_masktab[bit&7]) + { + // WARNING ! + ild[((y+row)*(current_w_)+(x_+x))]=0xFFFFFFFF; + } + ++x; + } + data += bpr; + } + +#undef BIT_ORDER +#undef BYTE_ORDER +#undef SCANLINE_UNIT +#undef SCANLINE_PAD +#undef EXTENTS +#undef SCANLINE_PAD_BYTES +#undef GLWIDTHBYTESPADDED +err: + return; +} + +fim_err_t Imlib2Device::fs_puts(struct fs_font *f_, fim_coo_t x, fim_coo_t y, const fim_char_t *str) +{ + fim_err_t rc=FIM_ERR_GENERIC; + fim_sys_int i,c/*,j,w*/; + if(initialized==false) + goto ret; + + for (i = 0; str[i] != '\0'; i++) { + c = (fim_byte_t)str[i]; + if (FIM_NULL == f_->eindex[c]) + continue; + fs_render_fb(x,y,f_->eindex[c],f_->gindex[c]); + x += f_->eindex[c]->width; + /* FIXME : SLOW ! */ + if (((fim_coo_t)x) > width() - f_->width) + goto derr; /* FIXME: seems like this is often triggered. */ + } + rc=FIM_ERR_NO_ERROR; +derr: + imlib_render_image_on_drawable(0,0); +ret: + return rc; +} + + fim_err_t Imlib2Device::status_line(const fim_char_t *msg) + { + fim_coo_t y,ys=3;// FIXME + + if(get_chars_per_column()<1) + goto done; + y = height() - f_->height - ys; + if(y<0 ) + goto done; + clear_rect(0, width()-1, y+1,y+f_->height+ys-1); + fs_puts(f_, 0, y+ys, msg); + fill_rect(0,width()-1, y, y, FIM_CNS_WHITE); +done: + return FIM_ERR_NO_ERROR; + } + + fim_key_t Imlib2Device::catchInteractiveCommand(fim_ts_t seconds)const + { + // FIXME: missing handling code, here + return -1; + } + + void Imlib2Device::flush(void) + { + } + + void Imlib2Device::lock(void) + { + } + + void Imlib2Device::unlock(void) + { + } + + bool Imlib2Device::allowed_resolution(fim_coo_t w, fim_coo_t h) + { + return true; + } + + fim_err_t Imlib2Device::resize(fim_coo_t w, fim_coo_t h) + { + if(initialized==true) + XResizeWindow(disp,win,w,h), + imlib_free_image(); + initialized=true; + buffer_=imlib_create_image(current_w_,current_h_); + imlib_context_set_image(buffer_); + return FIM_ERR_NO_ERROR; + } + + fim_err_t Imlib2Device::reinit(const fim_char_t *rs) + { + if(parse_optstring(rs)!=FIM_ERR_NO_ERROR) + goto err; + return cc.resize(current_w_,current_h_); + err: + //std::cerr<<"problems!\n"; + return FIM_ERR_GENERIC; + } + + fim_err_t Imlib2Device::set_wm_caption(const fim_char_t *msg) + { + // FIXME: unfinished +#if 1 + fim_err_t rc=FIM_ERR_UNSUPPORTED; +#else + fim_err_t rc=FIM_ERR_NO_ERROR; + if(!msg) + goto err; + XStoreName(disp,win,msg); +err: +#endif + return rc; + } + + fim_err_t Imlib2Device::reset_wm_caption(void) + { + // FIXME: unfinished +#if 1 + XStoreName(disp,win,""); + return FIM_ERR_NO_ERROR; +#else + return FIM_ERR_UNSUPPORTED; +#endif + } +#endif + + fim_coo_t Imlib2Device::status_line_height(void)const + { + return f_ ? border_height_ + f_->height : 0; + } diff --git a/src/Imlib2Device.h b/src/Imlib2Device.h new file mode 100644 index 0000000..6be9ed7 --- /dev/null +++ b/src/Imlib2Device.h @@ -0,0 +1,108 @@ +/* $LastChangedDate: 2013-11-06 19:33:57 +0100 (Wed, 06 Nov 2013) $ */ +/* + Imlib2Device.h : Imlib2 device Fim driver header file + + (c) 2011-2013 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +#ifndef FIM_IMLIB2DEVICE_H +#define FIM_IMLIB2DEVICE_H +#ifdef FIM_WITH_LIBIMLIB2 + +#include "DisplayDevice.h" +#include +#include + +class Imlib2Device:public DisplayDevice +{ + private: + XEvent ev_; + Imlib_Updates updates_, current_update_; + Imlib_Image buffer_; + fim_coo_t current_w_; + fim_coo_t current_h_; + + Imlib_Image image;// FIXME: -> tmpimage + int w, h, text_w, text_h; // FIXME: temporary vals + bool want_windowed_; + bool want_mouse_display_; + bool want_resize_; + static const fim_coo_t border_height_=1; + + public: + +#ifndef FIM_WANT_NO_OUTPUT_CONSOLE + Imlib2Device(MiniConsole & mc_, +#else /* FIM_WANT_NO_OUTPUT_CONSOLE */ + Imlib2Device( +#endif /* FIM_WANT_NO_OUTPUT_CONSOLE */ + fim::string opts + ); + + virtual fim_err_t display( + void *ida_image_img, // source image structure (struct ida_image *)(but we refuse to include header files here!) + //void* rgb,// destination gray array and source rgb array + fim_coo_t iroff,fim_coo_t icoff, // row and column offset of the first input pixel + fim_coo_t irows,fim_coo_t icols,// rows and columns in the input image + fim_coo_t icskip, // input columns to skip for each line + fim_coo_t oroff,fim_coo_t ocoff,// row and column offset of the first output pixel + fim_coo_t orows,fim_coo_t ocols,// rows and columns to draw in output buffer + fim_coo_t ocskip,// output columns to skip for each line + fim_flags_t flags// some flags + ); + + fim_err_t initialize(sym_keys_t &sym_keys); + fim_err_t il2_initialize(void); + void finalize(void) ; + + int get_chars_per_line(void) ; + int get_chars_per_column(void); + fim_coo_t width(void); + fim_coo_t height(void); + fim_err_t status_line(const fim_char_t *msg); + fim_bool_t handle_console_switch(void){return false;} + fim_err_t clear_rect(fim_coo_t x1, fim_coo_t x2, fim_coo_t y1,fim_coo_t y2); + fim_sys_int get_input(fim_key_t * c, bool want_poll=false); + virtual fim_key_t catchInteractiveCommand(fim_ts_t seconds)const; + void fs_render_fb(fim_coo_t x, fim_coo_t y, FSXCharInfo *charInfo, fim_byte_t *data); + fim_err_t fs_puts(struct fs_font *f_, fim_coo_t x, fim_coo_t y, const fim_char_t *str); + void flush(void); + void lock(void); + void unlock(void); + fim_bpp_t get_bpp(void); + virtual fim_coo_t status_line_height(void)const; + private: + fim_sys_int get_input_i2l(fim_key_t * c); + /* TEMPORARY */ + void status_screen_(int desc,int draw_output){ return ; } + fim_err_t fill_rect(fim_coo_t x1, fim_coo_t x2, fim_coo_t y1,fim_coo_t y2, fim_color_t color); + fim_coo_t txt_width(void) ; + fim_coo_t txt_height(void) ; + virtual fim_err_t resize(fim_coo_t w, fim_coo_t h); + private: + bool allowed_resolution(fim_coo_t w, fim_coo_t h); + virtual fim_err_t reinit(const fim_char_t *rs); + fim_err_t parse_optstring(const fim_char_t *os); + virtual fim_err_t set_wm_caption(const fim_char_t *msg); + fim_err_t reset_wm_caption(void); + protected: + void toggle_fullscreen(void); + void apply_fullscreen(void); +}; + + +#endif /* FIM_WITH_LIBIMLIB2 */ +#endif /* FIM_IMLIB2DEVICE_H */ diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..7a4fdfb --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,210 @@ +# $Id: Makefile.am 1144 2017-03-10 20:51:43Z dezperado $ + +subdir = src +AUTOMAKE_OPTIONS = no-dependencies dejagnu +#AUTOMAKE_OPTIONS+= nostdinc +SUBDIRS = +check_PROGRAMS = fim +bin_PROGRAMS = fim +bin_SCRIPTS = fimgs +doc_DATA = fimrc + +LFLAGS = -+ --nounistd +YFLAGS = -v -d + +#lex.yy.cc : lex.lex +lex.yy.cc: lex.lex yacc.tab.cpp + $(LEX) $(LFLAGS) $< + @$(ECHO) "Applying a horrible hack to avoid the flex non-throwing isatty() redeclaration in 'extern "C" int isatty (int );'" + $(SED) -i 's/^.*extern.*isatty.*int.*$$//g' $@ + +yacc.tab.hpp: yacc.tab.cpp +yacc.tab.cpp: yacc.ypp lex.lex + LC_ALL=C $(YACC) $(YFLAGS) $< -o $@ + +FIM_LIB_OBJECTS = yacc.tab.o lex.yy.o + +conf.h: fimrc + $(ECHO) 'const fim_char_t * FIM_DEFAULT_CONFIG_FILE_CONTENTS =' > $@ + $(SED) 's/\\/\\\\/g;s/"/\\\"/g;s/^/"/g;s/$$/\\n"/g;' $< >> $@ + $(ECHO) '"";' >> $@ + +grammar.h: yacc.tab.cpp yacc.output + $(ECHO) 'const fim_char_t * FIM_DEFAULT_GRAMMAR_FILE_CONTENTS =' > $@ + $(AWK) -f $(top_srcdir)/scripts/maintenance/yacc2grammar.awk yacc.output | $(CPP) -include $(top_srcdir)/scripts/maintenance/yacc2grammar.h | $(GREP) -v '^#' | $(SED) 's/"/\\\"/g;s/^/"/g;s/$$/\\n"/g;' >> $@ + $(ECHO) '"";' >> $@ + +examples.h: ../scripts/example/oneline.fim + $(ECHO) 'const fim_char_t * FIM_DEFAULT_EXAMPLE_FILE_CONTENTS =' > $@ + $(SED) 's/"/\\\"/g;s/^/"/g;s/$$/\\n"/g;' $< >> $@ + $(ECHO) '"";' >> $@ + +CommandConsole-help.o: CommandConsole-help.cpp help-acm.cpp help.cpp examples.h grammar.h +if FIM_WANT_HARDCODED_CONSOLEFONT +FontServer.o: default_font_byte_array.h +endif +SDLDevice.o: default_icon_byte_array.h + +# in the following : for some freebsd oddity, i was forced to replace ..0-9_]\+ with ..0-9_]* +version.h: ../config.h + $(GREP) define $< | $(GREP) FIM | LC_ALL=C $(SORT) | $(SED) 's/^#//g;s/define //g;s/^\([A-Za-z0-9_]*\).*$$/+\1 /g;s/^/\"/g;s/$$/\"/g' > $@ + $(ECHO) "\"\n\"" >> $@ + $(GREP) define $< | $(GREP) FIM.*'"' | LC_ALL=C $(SORT) | $(SED) 's/^#//g;s/define //g;s/^\([A-Za-z0-9_]*\) "\(.*\)"$$/"\1 = \\"\2\\"\\n"/g' >> $@ + $(GREP) undef $< | $(GREP) FIM | LC_ALL=C $(SORT) | $(SED) 's/^#//g;s/.*undef //g;s/^\([A-Za-z0-9_]*\).\+$$/-\1 /g;s/^/\"/g;s/$$/\"/g' >> $@ + $(ECHO) '"\n'CXXFLAGS=$(CXXFLAGS)'\n"' >> $@ + +help.cpp: fim.h + $(ECHO) -e "#ifdef FIM_WANT_INLINE_HELP\n" > $@ + $(GREP) '^#define FIM_VID' $< | $(SED) 's/^#define //g;s/\(^[A-Z0-9_]\+\)\s\+\("[^ ]*"\)\s*\/\*\(.*\)\*\/$$/fim_var_help_db[\1]=\3;/g' >> $@ + $(ECHO) '#endif /* FIM_WANT_INLINE_HELP */' >> $@ + +help-acm.cpp: fim.h + $(ECHO) -e "//#ifdef FIM_WANT_INLINE_HELP\n" > $@ + $(ECHO) -e '#define FIM_AUTOCOMMANDS_LIST \' >> $@ + $(GREP) '^#define FIM_ACM' $< | $(SED) 's/^#define //g;s/\(^[A-Z0-9_]\+\)\s\+\("[^ ]*"\)\s*\/\*\(.*\)\*\/$$/\1", "/g'|tr '\n' ' ' >> $@ + $(ECHO) ' '>> $@ + $(ECHO) '//#endif' >> $@ + +b2ba: b2ba.c + $(CC) -o $@ $< + +if FIM_WANT_CUSTOM_HARDCODED_CONSOLEFONT +default_font_byte_array.h: $(FIM_CUSTOM_HARDCODED_CONSOLEFONT) b2ba + ./b2ba < $< > $@ +else +default_font_byte_array.h: ../var/fonts/Lat15-Terminus16.psf b2ba + ./b2ba < $< > $@ +endif + +# the following sources are built at make time +# old bison versions could have problems with this (e.g.: generating yacc.tab.cpp.h instead of yacc.tab.hpp) +BUILT_SOURCES = lex.yy.cc yacc.tab.cpp conf.h yacc.tab.hpp + +# this hook triggers on 'make dist' +dist-hook: + -for file in $(BUILT_SOURCES) ; do $(RM) -f $(distdir)/$$file ; done + +EXTRA_fim_SOURCES = +# The following files are marked as source files by configure.ac +EXTRA_fim_SOURCES += FbiStuffGif.cpp +EXTRA_fim_SOURCES += FbiStuffJasPer.cpp +EXTRA_fim_SOURCES += FbiStuffJpeg.cpp +EXTRA_fim_SOURCES += FbiStuffTiff.cpp +EXTRA_fim_SOURCES += FbiStuffPng.cpp +EXTRA_fim_SOURCES += FbiStuffDjvu.cpp +EXTRA_fim_SOURCES += FbiStuffMagick.cpp +EXTRA_fim_SOURCES += FbiStuffPdf.cpp +EXTRA_fim_SOURCES += FbiStuffPs.cpp +EXTRA_fim_SOURCES += Imlib2Device.cpp +EXTRA_fim_SOURCES += FbiStuffXyz.cpp +EXTRA_fim_SOURCES += FbiStuffPcx.cpp +EXTRA_fim_SOURCES += FbiStuffBmp.cpp + +CLEANFILES=$(BUILT_SOURCES) yacc.output b2ba + +#CPP_FLAGS="$CPP_FLAGS -D X_DISPLAY_MISSING" +#AM_CPPFLAGS= +fim_DEPENDENCIES = @FIM_LIB_OBJECTS@ @LIBOBJS@ $(INTLDEPS) +fim_LDADD = @FIM_LIB_OBJECTS@ @LIBOBJS@ $(FIMLIBS) +#fim_LDADD = @FIM_LIB_OBJECTS@ @LIBOBJS@ $(FIMLIBS) $(LEXLIB) +fim_SOURCES = $(BUILT_SOURCES) \ + $(srcdir)/fim.cpp \ + $(srcdir)/fim.h \ + $(srcdir)/fim_types.h \ + $(srcdir)/fim_limits.h \ + $(srcdir)/fim_plugin.h \ + $(srcdir)/fim_plugin.cpp \ + $(srcdir)/fim_wrappers.h \ + $(srcdir)/default_font_byte_array.h \ + $(srcdir)/default_icon_byte_array.h \ + $(srcdir)/AADevice.h \ + $(srcdir)/Benchmarkable.h \ + $(srcdir)/CACADevice.h \ + $(srcdir)/SDLDevice.h \ + $(srcdir)/Arg.h \ + $(srcdir)/Browser.h \ + $(srcdir)/Cache.h \ + $(srcdir)/Command.h \ + $(srcdir)/CommandConsole.h \ + $(srcdir)/DebugConsole.h \ + $(srcdir)/DisplayDevice.h \ + $(srcdir)/DummyDisplayDevice.h \ + $(srcdir)/FbiStuff.h \ + $(srcdir)/FbiStuffList.h \ + $(srcdir)/FbiStuffFbtools.h \ + $(srcdir)/FbiStuffLoader.h \ + $(srcdir)/FontServer.h \ + $(srcdir)/FramebufferDevice.h \ + $(srcdir)/Imlib2Device.h \ + $(srcdir)/Image.h \ + $(srcdir)/Namespace.h \ + $(srcdir)/Var.h \ + $(srcdir)/Viewport.h \ + $(srcdir)/FimWindow.h \ + $(srcdir)/common.h \ + $(srcdir)/conf.h \ + $(srcdir)/help.cpp \ + $(srcdir)/help-acm.cpp \ + $(srcdir)/version.h \ + $(srcdir)/grammar.h \ + $(srcdir)/examples.h \ + $(srcdir)/fim.h \ + $(srcdir)/fim_stream.h \ + $(srcdir)/fim_stream.cpp \ + $(srcdir)/fimgs \ + $(srcdir)/lex.h \ + $(srcdir)/readline.h \ + $(srcdir)/readline.cpp \ + $(srcdir)/fim_string.h \ + $(srcdir)/AADevice.cpp \ + $(srcdir)/CACADevice.cpp \ + $(srcdir)/SDLDevice.cpp \ + $(srcdir)/Arg.cpp \ + $(srcdir)/Browser.cpp \ + $(srcdir)/Cache.cpp \ + $(srcdir)/Command.cpp \ + $(srcdir)/CommandConsole.cpp \ + $(srcdir)/CommandConsole-cmd.cpp \ + $(srcdir)/CommandConsole-var.cpp \ + $(srcdir)/CommandConsole-init.cpp \ + $(srcdir)/CommandConsole-help.cpp \ + $(srcdir)/DebugConsole.cpp \ + $(srcdir)/DisplayDevice.cpp \ + $(srcdir)/FbiStuff.cpp \ + $(srcdir)/FbiStuffFbtools.cpp \ + $(srcdir)/FbiStuffLoader.cpp \ + $(srcdir)/FbiStuffPpm.cpp \ + $(srcdir)/FbiStuffBit1.cpp \ + $(srcdir)/FbiStuffBit24.cpp \ + $(srcdir)/FbiStuffText.cpp \ + $(srcdir)/FbiStuffMatrixMarket.cpp \ + $(srcdir)/FontServer.cpp \ + $(srcdir)/FramebufferDevice.cpp \ + $(srcdir)/Image.cpp \ + $(srcdir)/Namespace.cpp \ + $(srcdir)/Var.cpp \ + $(srcdir)/Viewport.cpp \ + $(srcdir)/FimWindow.cpp \ + $(srcdir)/common.cpp \ + $(srcdir)/interpreter.cpp \ + $(srcdir)/fim_string.cpp + +Command.o: Command.h +CommandConsole.o: defaultConfiguration.o +CommandConsole-init.o: conf.h defaultConfiguration.o +help.o: conf.h defaultConfiguration.o +fim.o: version.h help.cpp grammar.h examples.h +Var.o: help.cpp +fim.cpp: version.h help.cpp grammar.h examples.h +lex.yy.o: lex.yy.cc + +# regex.c is work in progress and awaits for integration +EXTRA_DIST = lex.lex yacc.ypp fimrc defaultConfiguration.cpp fimgs \ + testdir/*ok testdir/*in testdir/Makefile \ + testsuite/*/* \ + regex.c b2ba.c + +RUNTESTDEFAULTFLAGS = --tool ./fim FIM=$$srcdir/./fim --srcdir $$srcdir/testsuite +#RUNTESTDEFAULTFLAGS = --all --tool ./fim FIM=$$srcdir/./fim --tool_opts=$$srcdir/../media/fim.png --srcdir $$srcdir/testsuite + + diff --git a/src/Makefile.in b/src/Makefile.in new file mode 100644 index 0000000..ca51fc8 --- /dev/null +++ b/src/Makefile.in @@ -0,0 +1,1246 @@ +# Makefile.in generated by automake 1.11.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# $Id: Makefile.am 1144 2017-03-10 20:51:43Z dezperado $ + + + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +check_PROGRAMS = fim$(EXEEXT) +bin_PROGRAMS = fim$(EXEEXT) +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in regex.c +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" \ + "$(DESTDIR)$(docdir)" +PROGRAMS = $(bin_PROGRAMS) +am__objects_1 = lex.yy.$(OBJEXT) yacc.tab.$(OBJEXT) +am_fim_OBJECTS = $(am__objects_1) fim.$(OBJEXT) fim_plugin.$(OBJEXT) \ + help.$(OBJEXT) help-acm.$(OBJEXT) fim_stream.$(OBJEXT) \ + readline.$(OBJEXT) AADevice.$(OBJEXT) CACADevice.$(OBJEXT) \ + SDLDevice.$(OBJEXT) Arg.$(OBJEXT) Browser.$(OBJEXT) \ + Cache.$(OBJEXT) Command.$(OBJEXT) CommandConsole.$(OBJEXT) \ + CommandConsole-cmd.$(OBJEXT) CommandConsole-var.$(OBJEXT) \ + CommandConsole-init.$(OBJEXT) CommandConsole-help.$(OBJEXT) \ + DebugConsole.$(OBJEXT) DisplayDevice.$(OBJEXT) \ + FbiStuff.$(OBJEXT) FbiStuffFbtools.$(OBJEXT) \ + FbiStuffLoader.$(OBJEXT) FbiStuffPpm.$(OBJEXT) \ + FbiStuffBit1.$(OBJEXT) FbiStuffBit24.$(OBJEXT) \ + FbiStuffText.$(OBJEXT) FbiStuffMatrixMarket.$(OBJEXT) \ + FontServer.$(OBJEXT) FramebufferDevice.$(OBJEXT) \ + Image.$(OBJEXT) Namespace.$(OBJEXT) Var.$(OBJEXT) \ + Viewport.$(OBJEXT) FimWindow.$(OBJEXT) common.$(OBJEXT) \ + interpreter.$(OBJEXT) fim_string.$(OBJEXT) +fim_OBJECTS = $(am_fim_OBJECTS) +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +SCRIPTS = $(bin_SCRIPTS) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = +am__depfiles_maybe = +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +SOURCES = $(fim_SOURCES) $(EXTRA_fim_SOURCES) +DIST_SOURCES = $(fim_SOURCES) $(EXTRA_fim_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(doc_DATA) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir +ETAGS = etags +CTAGS = ctags +DEJATOOL = $(PACKAGE) +EXPECT = expect +RUNTEST = runtest +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CAT = @CAT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONFIG_STATUS_DEPENDENCIES = @CONFIG_STATUS_DEPENDENCIES@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FIM_CONFIGURATION = @FIM_CONFIGURATION@ +FIM_CUSTOM_HARDCODED_CONSOLEFONT = @FIM_CUSTOM_HARDCODED_CONSOLEFONT@ +FIM_DEFS = @FIM_DEFS@ +FIM_LIBS = @FIM_LIBS@ +FIM_LIB_OBJECTS = yacc.tab.o lex.yy.o +FIM_SVN_REPOSITORY = @FIM_SVN_REPOSITORY@ +GREP = @GREP@ +HAVE_AWK = @HAVE_AWK@ +HAVE_BISON = @HAVE_BISON@ +HAVE_CAT = @HAVE_CAT@ +HAVE_CPP = @HAVE_CPP@ +HAVE_ECHO = @HAVE_ECHO@ +HAVE_FLEX = @HAVE_FLEX@ +HAVE_GREP = @HAVE_GREP@ +HAVE_MAN = @HAVE_MAN@ +HAVE_RM = @HAVE_RM@ +HAVE_SED = @HAVE_SED@ +HAVE_SORT = @HAVE_SORT@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBAA_CONFIG = @LIBAA_CONFIG@ +LIBDJVU = @LIBDJVU@ +LIBGIF = @LIBGIF@ +LIBJPEG = @LIBJPEG@ +LIBOBJS = @LIBOBJS@ +LIBPNG_CONFIG = @LIBPNG_CONFIG@ +LIBPOPPLER = @LIBPOPPLER@ +LIBPS = @LIBPS@ +LIBS = @LIBS@ +LIBSDL_CONFIG = @LIBSDL_CONFIG@ +LIBTIFF = @LIBTIFF@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MAN = @MAN@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POPPLER_CFLAGS = @POPPLER_CFLAGS@ +POPPLER_LIBS = @POPPLER_LIBS@ +RANLIB = @RANLIB@ +RM = @RM@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SORT = @SORT@ +STRIP = @STRIP@ +SVN_REVISION = @SVN_REVISION@ +SVN_REVISION_NUMBER = @SVN_REVISION_NUMBER@ +VERSION = @VERSION@ +YACC = @YACC@ +YFLAGS = -v -d +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build_alias = @build_alias@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +fim_cv_version = @fim_cv_version@ +have_convert = @have_convert@ +have_dia = @have_dia@ +have_inkscape = @have_inkscape@ +have_xcftopnm = @have_xcftopnm@ +have_xfig = @have_xfig@ +have_zcat = @have_zcat@ +host_alias = @host_alias@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +subdir = src +AUTOMAKE_OPTIONS = no-dependencies dejagnu +#AUTOMAKE_OPTIONS+= nostdinc +SUBDIRS = +bin_SCRIPTS = fimgs +doc_DATA = fimrc +LFLAGS = -+ --nounistd + +# the following sources are built at make time +# old bison versions could have problems with this (e.g.: generating yacc.tab.cpp.h instead of yacc.tab.hpp) +BUILT_SOURCES = lex.yy.cc yacc.tab.cpp conf.h yacc.tab.hpp +# The following files are marked as source files by configure.ac +EXTRA_fim_SOURCES = FbiStuffGif.cpp FbiStuffJasPer.cpp \ + FbiStuffJpeg.cpp FbiStuffTiff.cpp FbiStuffPng.cpp \ + FbiStuffDjvu.cpp FbiStuffMagick.cpp FbiStuffPdf.cpp \ + FbiStuffPs.cpp Imlib2Device.cpp FbiStuffXyz.cpp \ + FbiStuffPcx.cpp FbiStuffBmp.cpp +CLEANFILES = $(BUILT_SOURCES) yacc.output b2ba + +#CPP_FLAGS="$CPP_FLAGS -D X_DISPLAY_MISSING" +#AM_CPPFLAGS= +fim_DEPENDENCIES = @FIM_LIB_OBJECTS@ @LIBOBJS@ $(INTLDEPS) +fim_LDADD = @FIM_LIB_OBJECTS@ @LIBOBJS@ $(FIMLIBS) +#fim_LDADD = @FIM_LIB_OBJECTS@ @LIBOBJS@ $(FIMLIBS) $(LEXLIB) +fim_SOURCES = $(BUILT_SOURCES) \ + $(srcdir)/fim.cpp \ + $(srcdir)/fim.h \ + $(srcdir)/fim_types.h \ + $(srcdir)/fim_limits.h \ + $(srcdir)/fim_plugin.h \ + $(srcdir)/fim_plugin.cpp \ + $(srcdir)/fim_wrappers.h \ + $(srcdir)/default_font_byte_array.h \ + $(srcdir)/default_icon_byte_array.h \ + $(srcdir)/AADevice.h \ + $(srcdir)/Benchmarkable.h \ + $(srcdir)/CACADevice.h \ + $(srcdir)/SDLDevice.h \ + $(srcdir)/Arg.h \ + $(srcdir)/Browser.h \ + $(srcdir)/Cache.h \ + $(srcdir)/Command.h \ + $(srcdir)/CommandConsole.h \ + $(srcdir)/DebugConsole.h \ + $(srcdir)/DisplayDevice.h \ + $(srcdir)/DummyDisplayDevice.h \ + $(srcdir)/FbiStuff.h \ + $(srcdir)/FbiStuffList.h \ + $(srcdir)/FbiStuffFbtools.h \ + $(srcdir)/FbiStuffLoader.h \ + $(srcdir)/FontServer.h \ + $(srcdir)/FramebufferDevice.h \ + $(srcdir)/Imlib2Device.h \ + $(srcdir)/Image.h \ + $(srcdir)/Namespace.h \ + $(srcdir)/Var.h \ + $(srcdir)/Viewport.h \ + $(srcdir)/FimWindow.h \ + $(srcdir)/common.h \ + $(srcdir)/conf.h \ + $(srcdir)/help.cpp \ + $(srcdir)/help-acm.cpp \ + $(srcdir)/version.h \ + $(srcdir)/grammar.h \ + $(srcdir)/examples.h \ + $(srcdir)/fim.h \ + $(srcdir)/fim_stream.h \ + $(srcdir)/fim_stream.cpp \ + $(srcdir)/fimgs \ + $(srcdir)/lex.h \ + $(srcdir)/readline.h \ + $(srcdir)/readline.cpp \ + $(srcdir)/fim_string.h \ + $(srcdir)/AADevice.cpp \ + $(srcdir)/CACADevice.cpp \ + $(srcdir)/SDLDevice.cpp \ + $(srcdir)/Arg.cpp \ + $(srcdir)/Browser.cpp \ + $(srcdir)/Cache.cpp \ + $(srcdir)/Command.cpp \ + $(srcdir)/CommandConsole.cpp \ + $(srcdir)/CommandConsole-cmd.cpp \ + $(srcdir)/CommandConsole-var.cpp \ + $(srcdir)/CommandConsole-init.cpp \ + $(srcdir)/CommandConsole-help.cpp \ + $(srcdir)/DebugConsole.cpp \ + $(srcdir)/DisplayDevice.cpp \ + $(srcdir)/FbiStuff.cpp \ + $(srcdir)/FbiStuffFbtools.cpp \ + $(srcdir)/FbiStuffLoader.cpp \ + $(srcdir)/FbiStuffPpm.cpp \ + $(srcdir)/FbiStuffBit1.cpp \ + $(srcdir)/FbiStuffBit24.cpp \ + $(srcdir)/FbiStuffText.cpp \ + $(srcdir)/FbiStuffMatrixMarket.cpp \ + $(srcdir)/FontServer.cpp \ + $(srcdir)/FramebufferDevice.cpp \ + $(srcdir)/Image.cpp \ + $(srcdir)/Namespace.cpp \ + $(srcdir)/Var.cpp \ + $(srcdir)/Viewport.cpp \ + $(srcdir)/FimWindow.cpp \ + $(srcdir)/common.cpp \ + $(srcdir)/interpreter.cpp \ + $(srcdir)/fim_string.cpp + + +# regex.c is work in progress and awaits for integration +EXTRA_DIST = lex.lex yacc.ypp fimrc defaultConfiguration.cpp fimgs \ + testdir/*ok testdir/*in testdir/Makefile \ + testsuite/*/* \ + regex.c b2ba.c + +RUNTESTDEFAULTFLAGS = --tool ./fim FIM=$$srcdir/./fim --srcdir $$srcdir/testsuite +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +.SUFFIXES: .c .cc .cpp .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + +clean-checkPROGRAMS: + -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS) +fim$(EXEEXT): $(fim_OBJECTS) $(fim_DEPENDENCIES) $(EXTRA_fim_DEPENDENCIES) + @rm -f fim$(EXEEXT) + $(CXXLINK) $(fim_OBJECTS) $(fim_LDADD) $(LIBS) +install-binSCRIPTS: $(bin_SCRIPTS) + @$(NORMAL_INSTALL) + @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n' \ + -e 'h;s|.*|.|' \ + -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) { files[d] = files[d] " " $$1; \ + if (++n[d] == $(am__install_max)) { \ + print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ + else { print "f", d "/" $$4, $$1 } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binSCRIPTS: + @$(NORMAL_UNINSTALL) + @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 's,.*/,,;$(transform)'`; \ + dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +.c.o: + $(COMPILE) -c $< + +.c.obj: + $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.cc.o: + $(CXXCOMPILE) -c -o $@ $< + +.cc.obj: + $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +fim.obj: $(srcdir)/fim.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o fim.obj `if test -f '$(srcdir)/fim.cpp'; then $(CYGPATH_W) '$(srcdir)/fim.cpp'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/fim.cpp'; fi` + +fim_plugin.o: $(srcdir)/fim_plugin.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o fim_plugin.o `test -f '$(srcdir)/fim_plugin.cpp' || echo '$(srcdir)/'`$(srcdir)/fim_plugin.cpp + +fim_plugin.obj: $(srcdir)/fim_plugin.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o fim_plugin.obj `if test -f '$(srcdir)/fim_plugin.cpp'; then $(CYGPATH_W) '$(srcdir)/fim_plugin.cpp'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/fim_plugin.cpp'; fi` + +help.obj: $(srcdir)/help.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o help.obj `if test -f '$(srcdir)/help.cpp'; then $(CYGPATH_W) '$(srcdir)/help.cpp'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/help.cpp'; fi` + +help-acm.o: $(srcdir)/help-acm.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o help-acm.o `test -f '$(srcdir)/help-acm.cpp' || echo '$(srcdir)/'`$(srcdir)/help-acm.cpp + +help-acm.obj: $(srcdir)/help-acm.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o help-acm.obj `if test -f '$(srcdir)/help-acm.cpp'; then $(CYGPATH_W) '$(srcdir)/help-acm.cpp'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/help-acm.cpp'; fi` + +fim_stream.o: $(srcdir)/fim_stream.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o fim_stream.o `test -f '$(srcdir)/fim_stream.cpp' || echo '$(srcdir)/'`$(srcdir)/fim_stream.cpp + +fim_stream.obj: $(srcdir)/fim_stream.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o fim_stream.obj `if test -f '$(srcdir)/fim_stream.cpp'; then $(CYGPATH_W) '$(srcdir)/fim_stream.cpp'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/fim_stream.cpp'; fi` + +readline.o: $(srcdir)/readline.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o readline.o `test -f '$(srcdir)/readline.cpp' || echo '$(srcdir)/'`$(srcdir)/readline.cpp + +readline.obj: $(srcdir)/readline.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o readline.obj `if test -f '$(srcdir)/readline.cpp'; then $(CYGPATH_W) '$(srcdir)/readline.cpp'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/readline.cpp'; fi` + +AADevice.o: $(srcdir)/AADevice.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o AADevice.o `test -f '$(srcdir)/AADevice.cpp' || echo '$(srcdir)/'`$(srcdir)/AADevice.cpp + +AADevice.obj: $(srcdir)/AADevice.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o AADevice.obj `if test -f '$(srcdir)/AADevice.cpp'; then $(CYGPATH_W) '$(srcdir)/AADevice.cpp'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/AADevice.cpp'; fi` + +CACADevice.o: $(srcdir)/CACADevice.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o CACADevice.o `test -f '$(srcdir)/CACADevice.cpp' || echo '$(srcdir)/'`$(srcdir)/CACADevice.cpp + +CACADevice.obj: $(srcdir)/CACADevice.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o CACADevice.obj `if test -f '$(srcdir)/CACADevice.cpp'; then $(CYGPATH_W) '$(srcdir)/CACADevice.cpp'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/CACADevice.cpp'; fi` + +SDLDevice.obj: $(srcdir)/SDLDevice.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o SDLDevice.obj `if test -f '$(srcdir)/SDLDevice.cpp'; then $(CYGPATH_W) '$(srcdir)/SDLDevice.cpp'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/SDLDevice.cpp'; fi` + +Arg.o: $(srcdir)/Arg.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Arg.o `test -f '$(srcdir)/Arg.cpp' || echo '$(srcdir)/'`$(srcdir)/Arg.cpp + +Arg.obj: $(srcdir)/Arg.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Arg.obj `if test -f '$(srcdir)/Arg.cpp'; then $(CYGPATH_W) '$(srcdir)/Arg.cpp'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/Arg.cpp'; fi` + +Browser.o: $(srcdir)/Browser.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Browser.o `test -f '$(srcdir)/Browser.cpp' || echo '$(srcdir)/'`$(srcdir)/Browser.cpp + +Browser.obj: $(srcdir)/Browser.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Browser.obj `if test -f '$(srcdir)/Browser.cpp'; then $(CYGPATH_W) '$(srcdir)/Browser.cpp'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/Browser.cpp'; fi` + +Cache.o: $(srcdir)/Cache.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Cache.o `test -f '$(srcdir)/Cache.cpp' || echo '$(srcdir)/'`$(srcdir)/Cache.cpp + +Cache.obj: $(srcdir)/Cache.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Cache.obj `if test -f '$(srcdir)/Cache.cpp'; then $(CYGPATH_W) '$(srcdir)/Cache.cpp'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/Cache.cpp'; fi` + +Command.obj: $(srcdir)/Command.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Command.obj `if test -f '$(srcdir)/Command.cpp'; then $(CYGPATH_W) '$(srcdir)/Command.cpp'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/Command.cpp'; fi` + +CommandConsole.obj: $(srcdir)/CommandConsole.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o CommandConsole.obj `if test -f '$(srcdir)/CommandConsole.cpp'; then $(CYGPATH_W) '$(srcdir)/CommandConsole.cpp'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/CommandConsole.cpp'; fi` + +CommandConsole-cmd.o: $(srcdir)/CommandConsole-cmd.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o CommandConsole-cmd.o `test -f '$(srcdir)/CommandConsole-cmd.cpp' || echo '$(srcdir)/'`$(srcdir)/CommandConsole-cmd.cpp + +CommandConsole-cmd.obj: $(srcdir)/CommandConsole-cmd.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o CommandConsole-cmd.obj `if test -f '$(srcdir)/CommandConsole-cmd.cpp'; then $(CYGPATH_W) '$(srcdir)/CommandConsole-cmd.cpp'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/CommandConsole-cmd.cpp'; fi` + +CommandConsole-var.o: $(srcdir)/CommandConsole-var.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o CommandConsole-var.o `test -f '$(srcdir)/CommandConsole-var.cpp' || echo '$(srcdir)/'`$(srcdir)/CommandConsole-var.cpp + +CommandConsole-var.obj: $(srcdir)/CommandConsole-var.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o CommandConsole-var.obj `if test -f '$(srcdir)/CommandConsole-var.cpp'; then $(CYGPATH_W) '$(srcdir)/CommandConsole-var.cpp'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/CommandConsole-var.cpp'; fi` + +CommandConsole-init.obj: $(srcdir)/CommandConsole-init.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o CommandConsole-init.obj `if test -f '$(srcdir)/CommandConsole-init.cpp'; then $(CYGPATH_W) '$(srcdir)/CommandConsole-init.cpp'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/CommandConsole-init.cpp'; fi` + +CommandConsole-help.obj: $(srcdir)/CommandConsole-help.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o CommandConsole-help.obj `if test -f '$(srcdir)/CommandConsole-help.cpp'; then $(CYGPATH_W) '$(srcdir)/CommandConsole-help.cpp'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/CommandConsole-help.cpp'; fi` + +DebugConsole.o: $(srcdir)/DebugConsole.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o DebugConsole.o `test -f '$(srcdir)/DebugConsole.cpp' || echo '$(srcdir)/'`$(srcdir)/DebugConsole.cpp + +DebugConsole.obj: $(srcdir)/DebugConsole.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o DebugConsole.obj `if test -f '$(srcdir)/DebugConsole.cpp'; then $(CYGPATH_W) '$(srcdir)/DebugConsole.cpp'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/DebugConsole.cpp'; fi` + +DisplayDevice.o: $(srcdir)/DisplayDevice.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o DisplayDevice.o `test -f '$(srcdir)/DisplayDevice.cpp' || echo '$(srcdir)/'`$(srcdir)/DisplayDevice.cpp + +DisplayDevice.obj: $(srcdir)/DisplayDevice.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o DisplayDevice.obj `if test -f '$(srcdir)/DisplayDevice.cpp'; then $(CYGPATH_W) '$(srcdir)/DisplayDevice.cpp'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/DisplayDevice.cpp'; fi` + +FbiStuff.o: $(srcdir)/FbiStuff.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o FbiStuff.o `test -f '$(srcdir)/FbiStuff.cpp' || echo '$(srcdir)/'`$(srcdir)/FbiStuff.cpp + +FbiStuff.obj: $(srcdir)/FbiStuff.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o FbiStuff.obj `if test -f '$(srcdir)/FbiStuff.cpp'; then $(CYGPATH_W) '$(srcdir)/FbiStuff.cpp'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/FbiStuff.cpp'; fi` + +FbiStuffFbtools.o: $(srcdir)/FbiStuffFbtools.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o FbiStuffFbtools.o `test -f '$(srcdir)/FbiStuffFbtools.cpp' || echo '$(srcdir)/'`$(srcdir)/FbiStuffFbtools.cpp + +FbiStuffFbtools.obj: $(srcdir)/FbiStuffFbtools.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o FbiStuffFbtools.obj `if test -f '$(srcdir)/FbiStuffFbtools.cpp'; then $(CYGPATH_W) '$(srcdir)/FbiStuffFbtools.cpp'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/FbiStuffFbtools.cpp'; fi` + +FbiStuffLoader.o: $(srcdir)/FbiStuffLoader.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o FbiStuffLoader.o `test -f '$(srcdir)/FbiStuffLoader.cpp' || echo '$(srcdir)/'`$(srcdir)/FbiStuffLoader.cpp + +FbiStuffLoader.obj: $(srcdir)/FbiStuffLoader.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o FbiStuffLoader.obj `if test -f '$(srcdir)/FbiStuffLoader.cpp'; then $(CYGPATH_W) '$(srcdir)/FbiStuffLoader.cpp'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/FbiStuffLoader.cpp'; fi` + +FbiStuffPpm.o: $(srcdir)/FbiStuffPpm.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o FbiStuffPpm.o `test -f '$(srcdir)/FbiStuffPpm.cpp' || echo '$(srcdir)/'`$(srcdir)/FbiStuffPpm.cpp + +FbiStuffPpm.obj: $(srcdir)/FbiStuffPpm.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o FbiStuffPpm.obj `if test -f '$(srcdir)/FbiStuffPpm.cpp'; then $(CYGPATH_W) '$(srcdir)/FbiStuffPpm.cpp'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/FbiStuffPpm.cpp'; fi` + +FbiStuffBit1.o: $(srcdir)/FbiStuffBit1.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o FbiStuffBit1.o `test -f '$(srcdir)/FbiStuffBit1.cpp' || echo '$(srcdir)/'`$(srcdir)/FbiStuffBit1.cpp + +FbiStuffBit1.obj: $(srcdir)/FbiStuffBit1.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o FbiStuffBit1.obj `if test -f '$(srcdir)/FbiStuffBit1.cpp'; then $(CYGPATH_W) '$(srcdir)/FbiStuffBit1.cpp'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/FbiStuffBit1.cpp'; fi` + +FbiStuffBit24.o: $(srcdir)/FbiStuffBit24.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o FbiStuffBit24.o `test -f '$(srcdir)/FbiStuffBit24.cpp' || echo '$(srcdir)/'`$(srcdir)/FbiStuffBit24.cpp + +FbiStuffBit24.obj: $(srcdir)/FbiStuffBit24.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o FbiStuffBit24.obj `if test -f '$(srcdir)/FbiStuffBit24.cpp'; then $(CYGPATH_W) '$(srcdir)/FbiStuffBit24.cpp'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/FbiStuffBit24.cpp'; fi` + +FbiStuffText.o: $(srcdir)/FbiStuffText.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o FbiStuffText.o `test -f '$(srcdir)/FbiStuffText.cpp' || echo '$(srcdir)/'`$(srcdir)/FbiStuffText.cpp + +FbiStuffText.obj: $(srcdir)/FbiStuffText.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o FbiStuffText.obj `if test -f '$(srcdir)/FbiStuffText.cpp'; then $(CYGPATH_W) '$(srcdir)/FbiStuffText.cpp'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/FbiStuffText.cpp'; fi` + +FbiStuffMatrixMarket.o: $(srcdir)/FbiStuffMatrixMarket.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o FbiStuffMatrixMarket.o `test -f '$(srcdir)/FbiStuffMatrixMarket.cpp' || echo '$(srcdir)/'`$(srcdir)/FbiStuffMatrixMarket.cpp + +FbiStuffMatrixMarket.obj: $(srcdir)/FbiStuffMatrixMarket.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o FbiStuffMatrixMarket.obj `if test -f '$(srcdir)/FbiStuffMatrixMarket.cpp'; then $(CYGPATH_W) '$(srcdir)/FbiStuffMatrixMarket.cpp'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/FbiStuffMatrixMarket.cpp'; fi` + +@FIM_WANT_HARDCODED_CONSOLEFONT_FALSE@FontServer.o: $(srcdir)/FontServer.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o FontServer.o `test -f '$(srcdir)/FontServer.cpp' || echo '$(srcdir)/'`$(srcdir)/FontServer.cpp + +FontServer.obj: $(srcdir)/FontServer.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o FontServer.obj `if test -f '$(srcdir)/FontServer.cpp'; then $(CYGPATH_W) '$(srcdir)/FontServer.cpp'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/FontServer.cpp'; fi` + +FramebufferDevice.o: $(srcdir)/FramebufferDevice.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o FramebufferDevice.o `test -f '$(srcdir)/FramebufferDevice.cpp' || echo '$(srcdir)/'`$(srcdir)/FramebufferDevice.cpp + +FramebufferDevice.obj: $(srcdir)/FramebufferDevice.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o FramebufferDevice.obj `if test -f '$(srcdir)/FramebufferDevice.cpp'; then $(CYGPATH_W) '$(srcdir)/FramebufferDevice.cpp'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/FramebufferDevice.cpp'; fi` + +Image.o: $(srcdir)/Image.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Image.o `test -f '$(srcdir)/Image.cpp' || echo '$(srcdir)/'`$(srcdir)/Image.cpp + +Image.obj: $(srcdir)/Image.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Image.obj `if test -f '$(srcdir)/Image.cpp'; then $(CYGPATH_W) '$(srcdir)/Image.cpp'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/Image.cpp'; fi` + +Namespace.o: $(srcdir)/Namespace.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Namespace.o `test -f '$(srcdir)/Namespace.cpp' || echo '$(srcdir)/'`$(srcdir)/Namespace.cpp + +Namespace.obj: $(srcdir)/Namespace.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Namespace.obj `if test -f '$(srcdir)/Namespace.cpp'; then $(CYGPATH_W) '$(srcdir)/Namespace.cpp'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/Namespace.cpp'; fi` + +Var.obj: $(srcdir)/Var.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Var.obj `if test -f '$(srcdir)/Var.cpp'; then $(CYGPATH_W) '$(srcdir)/Var.cpp'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/Var.cpp'; fi` + +Viewport.o: $(srcdir)/Viewport.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Viewport.o `test -f '$(srcdir)/Viewport.cpp' || echo '$(srcdir)/'`$(srcdir)/Viewport.cpp + +Viewport.obj: $(srcdir)/Viewport.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Viewport.obj `if test -f '$(srcdir)/Viewport.cpp'; then $(CYGPATH_W) '$(srcdir)/Viewport.cpp'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/Viewport.cpp'; fi` + +FimWindow.o: $(srcdir)/FimWindow.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o FimWindow.o `test -f '$(srcdir)/FimWindow.cpp' || echo '$(srcdir)/'`$(srcdir)/FimWindow.cpp + +FimWindow.obj: $(srcdir)/FimWindow.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o FimWindow.obj `if test -f '$(srcdir)/FimWindow.cpp'; then $(CYGPATH_W) '$(srcdir)/FimWindow.cpp'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/FimWindow.cpp'; fi` + +common.o: $(srcdir)/common.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o common.o `test -f '$(srcdir)/common.cpp' || echo '$(srcdir)/'`$(srcdir)/common.cpp + +common.obj: $(srcdir)/common.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o common.obj `if test -f '$(srcdir)/common.cpp'; then $(CYGPATH_W) '$(srcdir)/common.cpp'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/common.cpp'; fi` + +interpreter.o: $(srcdir)/interpreter.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o interpreter.o `test -f '$(srcdir)/interpreter.cpp' || echo '$(srcdir)/'`$(srcdir)/interpreter.cpp + +interpreter.obj: $(srcdir)/interpreter.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o interpreter.obj `if test -f '$(srcdir)/interpreter.cpp'; then $(CYGPATH_W) '$(srcdir)/interpreter.cpp'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/interpreter.cpp'; fi` + +fim_string.o: $(srcdir)/fim_string.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o fim_string.o `test -f '$(srcdir)/fim_string.cpp' || echo '$(srcdir)/'`$(srcdir)/fim_string.cpp + +fim_string.obj: $(srcdir)/fim_string.cpp + $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o fim_string.obj `if test -f '$(srcdir)/fim_string.cpp'; then $(CYGPATH_W) '$(srcdir)/fim_string.cpp'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/fim_string.cpp'; fi` + +.cpp.o: + $(CXXCOMPILE) -c -o $@ $< + +.cpp.obj: + $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +install-docDATA: $(doc_DATA) + @$(NORMAL_INSTALL) + @list='$(doc_DATA)'; test -n "$(docdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(docdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(docdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(docdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(docdir)" || exit $$?; \ + done + +uninstall-docDATA: + @$(NORMAL_UNINSTALL) + @list='$(doc_DATA)'; test -n "$(docdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(docdir)'; $(am__uninstall_files_from_dir) + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +check-DEJAGNU: site.exp + srcdir='$(srcdir)'; export srcdir; \ + EXPECT=$(EXPECT); export EXPECT; \ + runtest=$(RUNTEST); \ + if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \ + exit_status=0; l='$(DEJATOOL)'; for tool in $$l; do \ + if $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) $(RUNTESTFLAGS); \ + then :; else exit_status=1; fi; \ + done; \ + else echo "WARNING: could not find \`runtest'" 1>&2; :;\ + fi; \ + exit $$exit_status +site.exp: Makefile $(EXTRA_DEJAGNU_SITE_CONFIG) + @echo 'Making a new site.exp file...' + @echo '## these variables are automatically generated by make ##' >site.tmp + @echo '# Do not edit here. If you wish to override these values' >>site.tmp + @echo '# edit the last section' >>site.tmp + @echo 'set srcdir "$(srcdir)"' >>site.tmp + @echo "set objdir `pwd`" >>site.tmp + @list='$(EXTRA_DEJAGNU_SITE_CONFIG)'; for f in $$list; do \ + echo "## Begin content included from file $$f. Do not modify. ##" \ + && cat `test -f "$$f" || echo '$(srcdir)/'`$$f \ + && echo "## End content included from file $$f. ##" \ + || exit 1; \ + done >> site.tmp + @echo "## End of auto-generated content; you can edit from here. ##" >> site.tmp + @if test -f site.exp; then \ + sed -e '1,/^## End of auto-generated content.*##/d' site.exp >> site.tmp; \ + fi + @-rm -f site.bak + @test ! -f site.exp || mv site.exp site.bak + @mv site.tmp site.exp + +distclean-DEJAGNU: + -rm -f site.exp site.bak + -l='$(DEJATOOL)'; for tool in $$l; do \ + rm -f $$tool.sum $$tool.log; \ + done + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-hook +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) + $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-recursive +all-am: Makefile $(PROGRAMS) $(SCRIPTS) $(DATA) +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(docdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +clean: clean-recursive + +clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \ + mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-DEJAGNU distclean-compile \ + distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: install-docDATA + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: install-binPROGRAMS install-binSCRIPTS + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS \ + uninstall-docDATA + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all check \ + check-am ctags-recursive install install-am install-strip \ + tags-recursive + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-DEJAGNU check-am clean \ + clean-binPROGRAMS clean-checkPROGRAMS clean-generic ctags \ + ctags-recursive dist-hook distclean distclean-DEJAGNU \ + distclean-compile distclean-generic distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-binPROGRAMS install-binSCRIPTS install-data \ + install-data-am install-docDATA install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs installdirs-am \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ + tags tags-recursive uninstall uninstall-am \ + uninstall-binPROGRAMS uninstall-binSCRIPTS uninstall-docDATA + + +#lex.yy.cc : lex.lex +lex.yy.cc: lex.lex yacc.tab.cpp + $(LEX) $(LFLAGS) $< + @$(ECHO) "Applying a horrible hack to avoid the flex non-throwing isatty() redeclaration in 'extern "C" int isatty (int );'" + $(SED) -i 's/^.*extern.*isatty.*int.*$$//g' $@ + +yacc.tab.hpp: yacc.tab.cpp +yacc.tab.cpp: yacc.ypp lex.lex + LC_ALL=C $(YACC) $(YFLAGS) $< -o $@ + +conf.h: fimrc + $(ECHO) 'const fim_char_t * FIM_DEFAULT_CONFIG_FILE_CONTENTS =' > $@ + $(SED) 's/\\/\\\\/g;s/"/\\\"/g;s/^/"/g;s/$$/\\n"/g;' $< >> $@ + $(ECHO) '"";' >> $@ + +grammar.h: yacc.tab.cpp yacc.output + $(ECHO) 'const fim_char_t * FIM_DEFAULT_GRAMMAR_FILE_CONTENTS =' > $@ + $(AWK) -f $(top_srcdir)/scripts/maintenance/yacc2grammar.awk yacc.output | $(CPP) -include $(top_srcdir)/scripts/maintenance/yacc2grammar.h | $(GREP) -v '^#' | $(SED) 's/"/\\\"/g;s/^/"/g;s/$$/\\n"/g;' >> $@ + $(ECHO) '"";' >> $@ + +examples.h: ../scripts/example/oneline.fim + $(ECHO) 'const fim_char_t * FIM_DEFAULT_EXAMPLE_FILE_CONTENTS =' > $@ + $(SED) 's/"/\\\"/g;s/^/"/g;s/$$/\\n"/g;' $< >> $@ + $(ECHO) '"";' >> $@ + +CommandConsole-help.o: CommandConsole-help.cpp help-acm.cpp help.cpp examples.h grammar.h +@FIM_WANT_HARDCODED_CONSOLEFONT_TRUE@FontServer.o: default_font_byte_array.h +SDLDevice.o: default_icon_byte_array.h + +# in the following : for some freebsd oddity, i was forced to replace ..0-9_]\+ with ..0-9_]* +version.h: ../config.h + $(GREP) define $< | $(GREP) FIM | LC_ALL=C $(SORT) | $(SED) 's/^#//g;s/define //g;s/^\([A-Za-z0-9_]*\).*$$/+\1 /g;s/^/\"/g;s/$$/\"/g' > $@ + $(ECHO) "\"\n\"" >> $@ + $(GREP) define $< | $(GREP) FIM.*'"' | LC_ALL=C $(SORT) | $(SED) 's/^#//g;s/define //g;s/^\([A-Za-z0-9_]*\) "\(.*\)"$$/"\1 = \\"\2\\"\\n"/g' >> $@ + $(GREP) undef $< | $(GREP) FIM | LC_ALL=C $(SORT) | $(SED) 's/^#//g;s/.*undef //g;s/^\([A-Za-z0-9_]*\).\+$$/-\1 /g;s/^/\"/g;s/$$/\"/g' >> $@ + $(ECHO) '"\n'CXXFLAGS=$(CXXFLAGS)'\n"' >> $@ + +help.cpp: fim.h + $(ECHO) -e "#ifdef FIM_WANT_INLINE_HELP\n" > $@ + $(GREP) '^#define FIM_VID' $< | $(SED) 's/^#define //g;s/\(^[A-Z0-9_]\+\)\s\+\("[^ ]*"\)\s*\/\*\(.*\)\*\/$$/fim_var_help_db[\1]=\3;/g' >> $@ + $(ECHO) '#endif /* FIM_WANT_INLINE_HELP */' >> $@ + +help-acm.cpp: fim.h + $(ECHO) -e "//#ifdef FIM_WANT_INLINE_HELP\n" > $@ + $(ECHO) -e '#define FIM_AUTOCOMMANDS_LIST \' >> $@ + $(GREP) '^#define FIM_ACM' $< | $(SED) 's/^#define //g;s/\(^[A-Z0-9_]\+\)\s\+\("[^ ]*"\)\s*\/\*\(.*\)\*\/$$/\1", "/g'|tr '\n' ' ' >> $@ + $(ECHO) ' '>> $@ + $(ECHO) '//#endif' >> $@ + +b2ba: b2ba.c + $(CC) -o $@ $< + +@FIM_WANT_CUSTOM_HARDCODED_CONSOLEFONT_TRUE@default_font_byte_array.h: $(FIM_CUSTOM_HARDCODED_CONSOLEFONT) b2ba +@FIM_WANT_CUSTOM_HARDCODED_CONSOLEFONT_TRUE@ ./b2ba < $< > $@ +@FIM_WANT_CUSTOM_HARDCODED_CONSOLEFONT_FALSE@default_font_byte_array.h: ../var/fonts/Lat15-Terminus16.psf b2ba +@FIM_WANT_CUSTOM_HARDCODED_CONSOLEFONT_FALSE@ ./b2ba < $< > $@ + +# this hook triggers on 'make dist' +dist-hook: + -for file in $(BUILT_SOURCES) ; do $(RM) -f $(distdir)/$$file ; done + +Command.o: Command.h +CommandConsole.o: defaultConfiguration.o +CommandConsole-init.o: conf.h defaultConfiguration.o +help.o: conf.h defaultConfiguration.o +fim.o: version.h help.cpp grammar.h examples.h +Var.o: help.cpp +fim.cpp: version.h help.cpp grammar.h examples.h +lex.yy.o: lex.yy.cc +#RUNTESTDEFAULTFLAGS = --all --tool ./fim FIM=$$srcdir/./fim --tool_opts=$$srcdir/../media/fim.png --srcdir $$srcdir/testsuite + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/Namespace.cpp b/src/Namespace.cpp new file mode 100644 index 0000000..b4558cb --- /dev/null +++ b/src/Namespace.cpp @@ -0,0 +1,230 @@ +/* $LastChangedDate: 2015-12-19 00:45:57 +0100 (Sat, 19 Dec 2015) $ */ +/* + Namespace.cpp : a class for local variables storage + + (c) 2007-2015 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "fim.h" + +#ifndef FIM_INDIPENDENT_NAMESPACE +#define FIM_NS_SV(VN,VL) if(rnsp_) return rnsp_->setVariable(VN,VL); /* FIXME: need a better solution here ! */ +#else +#define FIM_NS_SV(VN,VL) +#endif /* FIM_INDIPENDENT_NAMESPACE */ + +namespace fim +{ + fim_int Namespace::setVariable(const fim::string& varname,fim_int value) + { + return variables_[varname].setInt(value); + } + + fim_float_t Namespace::setVariable(const fim::string& varname,fim_float_t value) + { + return variables_[varname].setFloat(value); + } + + Var Namespace::setVariable(const fim::string& varname,const Var&value) + { + return (fim_int)variables_[varname].set(value); + } + + fim_int Namespace::setVariable(const fim::string& varname,const fim_char_t*value) + { + fim::string s(value); + return (fim_int)(variables_[varname].setString(s)); + } + + fim_bool_t Namespace::isSetVar(const fim::string &varname)const + { + fim_bool_t isv = variables_.find(varname) != variables_.end(); + return isv; + } + + void Namespace::unsetVariable(const fim::string &varname) + { + variables_t ::iterator vi=variables_.find(varname); + if( vi!= variables_.end() ) + variables_.erase(varname); + } + + fim_int Namespace::getIntVariable(const fim::string &varname)const + { + variables_t::const_iterator vi=variables_.find(varname); + fim_int retval = FIM_CNS_EMPTY_INT_VAL; + + if(vi!=variables_.end()) + retval = vi->second.getInt(); + return retval; + } + + Var Namespace::getVariable(const fim::string &varname)const + { + if(varname == "*") + { + return Var(get_variables_list(true)); + } + else + { + variables_t::const_iterator vi=variables_.find(varname); + + if(vi!=variables_.end()) + return vi->second; + else + return Var((fim_int)FIM_CNS_EMPTY_INT_VAL); + } + } + + fim_float_t Namespace::getFloatVariable(const fim::string &varname)const + { + variables_t::const_iterator vi=variables_.find(varname); + fim_float_t retval = FIM_CNS_EMPTY_FP_VAL; + + if(vi!=variables_.end()) + retval = vi->second.getString(); + return retval; + } + + fim::string Namespace::getStringVariable(const fim::string &varname)const + { + fim::string retval = FIM_CNS_EMPTY_RESULT; + variables_t::const_iterator vi=variables_.find(varname); + + if(vi!=variables_.end()) + retval = vi->second.getString(); + return retval; + } + + fim_float_t Namespace::setGlobalVariable(const fim::string& varname,fim_float_t value) + { + FIM_NS_SV(varname,value); + return FIM_CNS_EMPTY_FP_VAL; + } + + fim_int Namespace::setGlobalVariable(const fim::string& varname,fim_int value) + { + FIM_NS_SV(varname,value); + return FIM_CNS_EMPTY_INT_VAL; + } + + fim_int Namespace::setGlobalVariable(const fim::string& varname,const fim_char_t*value) + { + FIM_NS_SV(varname,value); + return FIM_CNS_EMPTY_INT_VAL; + } + + fim_int Namespace::getGlobalIntVariable(const fim::string &varname)const + { + /* FIXME: need a better solution here ! */ +#ifndef FIM_INDIPENDENT_NAMESPACE + if(rnsp_) + return rnsp_->getIntVariable(varname); +#endif /* FIM_INDIPENDENT_NAMESPACE */ + return FIM_CNS_EMPTY_INT_VAL; + } + + fim_float_t Namespace::getGlobalFloatVariable(const fim::string &varname)const + { + /* FIXME: need a better solution here ! */ +#ifndef FIM_INDIPENDENT_NAMESPACE + if(rnsp_) + return rnsp_->getFloatVariable(varname); +#endif /* FIM_INDIPENDENT_NAMESPACE */ + return FIM_CNS_EMPTY_FP_VAL; + } + + fim::string Namespace::getGlobalStringVariable(const fim::string &varname)const + { + /* FIXME: need a better solution here ! */ +#ifndef FIM_INDIPENDENT_NAMESPACE + if(rnsp_) + return rnsp_->getStringVariable(varname); +#endif /* FIM_INDIPENDENT_NAMESPACE */ + return FIM_CNS_EMPTY_RESULT; + } + + fim::string Namespace::autocmd_exec(const fim::string &event,const fim::string &fname) + { +#ifdef FIM_AUTOCMDS + /* FIXME: need a better solution here ! */ +#ifndef FIM_INDIPENDENT_NAMESPACE + if(rnsp_) + return rnsp_->autocmd_exec(event,fname); +#endif /* FIM_INDIPENDENT_NAMESPACE */ + return FIM_CNS_EMPTY_RESULT; +#else /* FIM_AUTOCMDS */ + return FIM_CNS_EMPTY_RESULT; +#endif /* FIM_AUTOCMDS */ + } + + fim::string Namespace::get_variables_list(bool with_values)const + { + fim::string acl; + variables_t::const_iterator vi; + + for( vi=variables_.begin();vi!=variables_.end();++vi) + { + if(ns_char_!=FIM_SYM_NULL_NAMESPACE_CHAR) + { + acl+=ns_char_; + acl+=FIM_SYM_NAMESPACE_SEP; + } + acl+=((*vi).first); + acl+=" "; + if(with_values) + acl+=" = ", + acl+=((*vi).second.getString()), + acl+="\n"; + } + return acl; + } + + fim_err_t Namespace::find_matching_list(fim::string cmd, args_t & completions, bool prepend_ns)const + { + for(variables_t::const_iterator vi=variables_.begin();vi!=variables_.end();++vi) + { + if((vi->first).find(cmd)==0) + { + fim::string res; + if(prepend_ns) + res+=ns_char_,res+=FIM_SYM_NAMESPACE_SEP; + res+=(*vi).first; + completions.push_back(res); + } + } + return FIM_ERR_NO_ERROR; + } + + fim_err_t Namespace::assign_ns(const Namespace & ns) + { + for(variables_t::const_iterator fit=ns.variables_.begin();fit!=ns.variables_.end();++fit) + setVariable((fit->first),Var(fit->second)); + return FIM_ERR_NO_ERROR; + } + + std::ostream& Namespace::print(std::ostream &os)const + { + return os << this->get_variables_list(true); + } + + std::ostream& operator<<(std::ostream &os, const Namespace & ns) + { + return ns.print(os); + } +} + diff --git a/src/Namespace.h b/src/Namespace.h new file mode 100644 index 0000000..f36b32a --- /dev/null +++ b/src/Namespace.h @@ -0,0 +1,87 @@ +/* $LastChangedDate: 2015-12-19 01:58:26 +0100 (Sat, 19 Dec 2015) $ */ +/* + Namespace.h : Namespace class headers + + (c) 2007-2015 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef FIM_NAMESPACE_H +#define FIM_NAMESPACE_H + +#include "fim.h" + +namespace fim +{ + typedef std::map variables_t; //id->var + class Namespace + { + protected: +#ifndef FIM_INDIPENDENT_NAMESPACE + CommandConsole*rnsp_; // root Namespace pointer +#endif /* FIM_INDIPENDENT_NAMESPACE */ + variables_t variables_; //id->var + fim_char_t ns_char_; // ns_char_ ':' varname + + public: + + fim_int setVariable(const fim::string& varname,fim_int value); + fim_float_t setVariable(const fim::string& varname,fim_float_t value); + fim_int setVariable(const fim::string& varname,const fim_char_t*value); + Var setVariable(const fim::string& varname,const Var&value); + + fim_int getIntVariable(const fim::string &varname)const; + fim_float_t getFloatVariable(const fim::string &varname)const; + fim::string getStringVariable(const fim::string &varname)const; + Var getVariable(const fim::string &varname)const; + + fim_bool_t isSetVar(const fim::string &varname)const; + void unsetVariable(const fim::string &varname); + + fim_int setGlobalVariable(const fim::string& varname,fim_int value); + fim_float_t setGlobalVariable(const fim::string& varname,fim_float_t value); + fim_int setGlobalVariable(const fim::string& varname,const fim_char_t*value); + + fim_int getGlobalIntVariable(const fim::string &varname)const; + fim_float_t getGlobalFloatVariable(const fim::string &varname)const; + fim::string getGlobalStringVariable(const fim::string &varname)const; + fim::string autocmd_exec(const fim::string &event,const fim::string &fname); + fim::string get_variables_list(bool with_values=false)const; + virtual size_t byte_size(void)const = 0; + fim_err_t assign_ns(const Namespace & ns); + + Namespace( +#ifndef FIM_INDIPENDENT_NAMESPACE + CommandConsole *rnsp = FIM_NULL, +#endif /* FIM_INDIPENDENT_NAMESPACE */ + const fim_char_t ns_char = FIM_SYM_NULL_NAMESPACE_CHAR + ) + : +#ifndef FIM_INDIPENDENT_NAMESPACE + rnsp_(rnsp), +#endif /* FIM_INDIPENDENT_NAMESPACE */ + variables_(variables_t()) + ,ns_char_(ns_char) + {} + virtual ~Namespace(void){} + fim_err_t find_matching_list(fim::string cmd, args_t & completions, bool prepend_ns)const; + std::ostream& print(std::ostream &os)const; + }; + std::ostream& operator<<(std::ostream &os, const Namespace & ns); +} + +#endif /* FIM_NAMESPACE_H */ + diff --git a/src/SDLDevice.cpp b/src/SDLDevice.cpp new file mode 100644 index 0000000..533d050 --- /dev/null +++ b/src/SDLDevice.cpp @@ -0,0 +1,1130 @@ +/* $LastChangedDate: 2017-04-17 19:40:39 +0200 (Mon, 17 Apr 2017) $ */ +/* + SDLDevice.cpp : sdllib device Fim driver file + + (c) 2008-2017 Michele Martone + based on code (c) 1998-2006 Gerd Knorr + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/* + * NOTES : The SDL support is INCOMPLETE: + * + * - input problems when coupled with readline + */ +#include "fim.h" + +#ifdef FIM_WITH_LIBSDL + +#include "SDLDevice.h" +#define FIM_SDL_FLAGS /*SDL_FULLSCREEN|*/SDL_HWSURFACE + +#define FIM_WANT_HARDCODED_ICON 1 +#define FIM_SDL_ICONPATH "" +#define FIM_FRAC(VAL,N,D) (((VAL)*(N))/(D)) + +namespace fim +{ + extern CommandConsole cc; +} + +#define FIM_SDL_MINWIDTH 2 +#define FIM_SDL_MINHEIGHT 2 + +#define FIM_SDL_ALLOW_QUIT 1 +#define FIM_SDL_WANT_KEYREPEAT 1 +#define FIM_SDL_WANT_RESIZE 1 +#define FIM_SDL_DEBUG 1 +#undef FIM_SDL_DEBUG +#define FIM_WANT_EXPERIMENTAL_MOUSE_PAN 1 + +#ifdef FIM_SDL_DEBUG +#define FIM_SDL_INPUT_DEBUG(C,MSG) \ +/* i miss sooo much printf() :'( */ \ +std::cout << (size_t)getmilliseconds() << " : "<orows ) + return -8-10*100; + if( ocoff>ocols ) + return -9-11*100; + if( ocskipdata:FIM_NULL;// source rgb array + + if ( !rgb ) return -1; + + if( iroff <0 ) return -2; + if( icoff <0 ) return -3; + if( irows <=0 ) return -4; + if( icols <=0 ) return -5; + if( icskip<0 ) return -6; + if( oroff <0 ) return -7; + if( ocoff <0 ) return -8; + if( orows <=0 ) return -9; + if( ocols <=0 ) return -10; + if( ocskip<0 ) return -11; + if( flags <0 ) return -12; + + if( iroff>irows ) return -2-3*100 ; + if( icoff>icols ) return -3-5*100; +// if( oroff>orows ) return -7-9*100;//EXP +// if( ocoff>ocols ) return -8-10*100;//EXP + if( oroff>height() ) return -7-9*100;//EXP + if( ocoff>width()) return -8-10*100;//EXP + + if( icskip height() ) return -9 -99*100; + if( ocols > width() ) return -10-99*100; + if( ocskip < width() ) return -11-99*100; + if( icskip 16*1024 || irows > 16*1024); /* FIXME: occurring with SDL-1.2.15; to ascertain! (actually problems occur with an 21874x940 pixelmap ) */ + + // FIXME : temporary +// clear_rect( ocoff, ocoff+ocols, oroff, oroff+orows); +// clear_rect( 0, ocols, 0, orows); + clear_rect( 0, width()-1, 0, height()-1); + + + if(!mirror && !flip && !buginsdlorsomewhere) + { +#if 0 + for(oi=oroff;FIM_LIKELY(oipitch/Bpp_; + + ii = oi + idr; + ij = oj + idc; + srcp = ((fim_byte_t*)rgb)+(3*(ii*icskip+ij)); + + setpixel(screen_, oj, ytimesw, (fim_coo_t)srcp[0], (fim_coo_t)srcp[1], (fim_coo_t)srcp[2]); + } +#else + const Uint32 rmask=0x00000000,gmask=0x00000000,bmask=0x00000000,amask=0x00000000; + SDL_Surface *src=SDL_CreateRGBSurfaceFrom(rgb,icols,irows,24,icols*3,rmask,gmask,bmask,amask); + if(src) + { + SDL_Rect srcrect; + SDL_Rect dstrect; + srcrect.x=icoff; + srcrect.y=iroff; + srcrect.w=icols; + srcrect.h=irows; + dstrect.x=ocoff; + dstrect.y=oroff; + dstrect.w=ocols; + dstrect.h=orows; + SDL_UpperBlit(src,&srcrect,screen_,&dstrect); + SDL_FreeSurface(src); + /* FIXME: shall check error codes */ + } + else + { + /* FIXME: need some error processing, here */ + return FIM_ERR_GENERIC; + } +#endif + } + else + for(oi=oroff;FIM_LIKELY(oipitch/Bpp_; + /* UNFINISHED : FIX ME */ + ii = oi + idr; + ij = oj + idc; + + if(mirror)ij=((icols-1)-ij); + if( flip )ii=((irows-1)-ii); + srcp = ((fim_byte_t*)rgb)+(3*(ii*icskip+ij)); + + setpixel(screen_, oj, ytimesw, (fim_coo_t)srcp[0], (fim_coo_t)srcp[1], (fim_coo_t)srcp[2]); + } + + if(SDL_MUSTLOCK(screen_)) SDL_UnlockSurface(screen_); + + SDL_Flip(screen_); + + return FIM_ERR_NO_ERROR; + } + + bool SDLDevice::sdl_window_update(void) + { + vi_ = SDL_GetVideoInfo(); + if(!vi_) + return false; + current_w_=vi_->current_w; + current_h_=vi_->current_h; + bpp_ =vi_->vfmt->BitsPerPixel; + Bpp_ =vi_->vfmt->BytesPerPixel; + // FIXME: shall update want_windowed_ with effective flags contents + return true; + } + + fim_err_t SDLDevice::initialize(sym_keys_t &sym_keys) + { + /* + * + * */ + fim_coo_t want_width=current_w_, want_height=current_h_/*, want_bpp=0*/; + fim_sdl_int want_flags=FIM_SDL_FLAGS; + fim_sdl_int delay=0,interval=0; + const fim_char_t*errstr=FIM_NULL; + //want_flags|=SDL_NOFRAME; + //std::cout << want_width << " : "<< want_height<<"\n"; +#if 0 + //want_windowed_=true; + want_height=480; + want_width=480; +#endif + if(want_windowed_) + want_flags&=~SDL_FULLSCREEN; +#if FIM_SDL_WANT_RESIZE + if(want_resize_ && ! want_windowed_) + want_flags|=SDL_RESIZABLE; +#endif /* FIM_SDL_WANT_RESIZE */ + //want_flags|=SDL_DOUBLEBUF; + + if(!allowed_resolution(want_width,want_height)) + { + std::cout << "requested window size ("<sheight(); + } + + int SDLDevice::get_chars_per_line(void) + { + return width() / f_->swidth(); + } + + fim_coo_t SDLDevice::width(void) + { + return current_w_; + } + + fim_coo_t SDLDevice::height(void) + { + return current_h_; + } + + inline void SDLDevice::setpixel(SDL_Surface *screen_, fim_coo_t x, fim_coo_t y, Uint8 r, Uint8 g, Uint8 b) + { + /* + * this function is taken straight from the sdl documentation: there are smarter ways to do this. + * */ + + switch (bpp_) + { + case 8: + { + Uint8 *pixmem8; + Uint8 colour; + colour = SDL_MapRGB( screen_->format, b, g, r ); + pixmem8 = (Uint8*)((fim_byte_t*)( screen_->pixels) + (y + x)*Bpp_); + *pixmem8 = colour; + } + break; + case 15: + case 16: + { + Uint16 *pixmem16; + Uint16 colour; + colour = SDL_MapRGB( screen_->format, b, g, r ); + pixmem16 = (Uint16*)((fim_byte_t*)( screen_->pixels) + (y + x)*Bpp_); + *pixmem16 = colour; + } + break; + case 24: + { + Uint32 *pixmem32; + Uint32 colour; + colour = SDL_MapRGB( screen_->format, b, g, r ); + pixmem32 = (Uint32*)((fim_byte_t*)( screen_->pixels) + (y + x)*Bpp_); + *pixmem32 = colour; + } + break; + case 32: + { + Uint32 *pixmem32; + Uint32 colour; + colour = SDL_MapRGBA( screen_->format, b, g, r, 255 ); + pixmem32 = (Uint32*)((fim_byte_t*)( screen_->pixels) + (y + x)*Bpp_); + *pixmem32 = colour; + } + break; + default: + { + /* 1,2,4 modes unsupported for NOW */ + } + } + + } + + static fim_sys_int get_input_inner(fim_key_t * c, SDL_Event*eventp, fim_sys_int *keypressp, bool want_poll) + { +// fim_sys_int keypress_=0; + bool ctrl_on=0; + bool alt_on=0; + bool shift_on=0; + fim_sys_int ret=0; + SDL_Event event=*eventp; + + *c = 0x0; /* blank */ + +// while(SDL_PollEvent(&event)) + if(want_poll) + ret=SDL_PollEvent(&event); + else + ret=SDL_WaitEvent(&event); + if(ret) + { + if(event.type==SDL_KEYUP) + if(!SDL_PollEvent(&event)) + goto done; + + switch (event.type) + { +#if FIM_SDL_WANT_RESIZE + case SDL_VIDEORESIZE: + cc.resize(event.resize.w,event.resize.h); + break; +#endif /* FIM_SDL_WANT_RESIZE */ + case SDL_QUIT: +#if FIM_SDL_ALLOW_QUIT + *c=cc.find_keycode_for_bound_cmd(FIM_FLT_QUIT); + return 1; + //cc.quit(); +#endif /* FIM_SDL_ALLOW_QUIT */ + *keypressp = 1; + + break; + case SDL_KEYDOWN: + + if(event.key.keysym.mod == KMOD_RCTRL || event.key.keysym.mod == KMOD_LCTRL ) + ctrl_on=true; + if(event.key.keysym.mod == KMOD_RALT || event.key.keysym.mod == KMOD_LALT ) + alt_on=true; + if(event.key.keysym.mod == KMOD_RSHIFT || event.key.keysym.mod == KMOD_LSHIFT ) + shift_on=true; + + // std::cout << "sym : " << (fim_int)event.key.keysym.sym << "\n" ; + // std::cout << "uni : " << (fim_int)event.key.keysym.unicode<< "\n" ; + // if(shift_on)std::cout << "shift_on\n"; + + if( event.key.keysym.unicode == 0x0 ) + { + /* arrows and stuff */ + FIM_SDL_INPUT_DEBUG(c,"no unicode"); + if(event.key.keysym.sym<256) + { + FIM_SDL_INPUT_DEBUG(c,"uhm"); + *c=event.key.keysym.sym; + return 1; + } + else + if(event.key.keysym.sym>=SDLK_F1 && event.key.keysym.sym<=SDLK_F12) + { + FIM_SDL_INPUT_DEBUG(c,"FXX?"); + *c=event.key.keysym.sym; + return 1; + } + else + if( + event.key.keysym.sym!=SDLK_LSHIFT + && event.key.keysym.sym!=SDLK_RSHIFT + && event.key.keysym.sym!=SDLK_LALT + && event.key.keysym.sym!=SDLK_RALT + && event.key.keysym.sym!=SDLK_LCTRL + && event.key.keysym.sym!=SDLK_RCTRL + ) + { + /* arrows.. .. */ + *c=event.key.keysym.sym; + FIM_SDL_INPUT_DEBUG(c,"arrow"); + return 1; + } + else + { + FIM_SDL_INPUT_DEBUG(c,"shift"); + /* we ignore lone shift or alt .. */ + return 0; + } + } + + if(alt_on) + { + *c=(fim_byte_t)event.key.keysym.unicode; + *c|=(1<<31); /* FIXME : a dirty trick */ + return 1; + } + + if( event.key.keysym.unicode < 0x80) + { + /* + * SDL documentation 1.2.12 about unicode: + * It is useful to note that unicode values < 0x80 translate directly + * a characters ASCII value. + * */ + // if(event.key.keysym.mod == KMOD_RCTRL || event.key.keysym.mod == KMOD_LCTRL ) std::cout << "ctrl ! \n"; + *c=(fim_byte_t)event.key.keysym.unicode; + + if(ctrl_on) + { + // if(*c-1+'a'=='c')std::exit(-1);//works +#if 0 + if(*c-1+'a'<='z') + { + //std::cout << "with control : " << *c+'a'-1 << "\n"; + } + else + { + /* other chars */ + *c-='a'; + *c+= 1 ; + } +#else +#endif + FIM_SDL_INPUT_DEBUG(c,"ctrl is on"); + } + if(*c) /* !iscntrl(c) */ + { + /* the usual chars */ + FIM_SDL_INPUT_DEBUG(c,"keysym"); + return 1; + } + else /* iscntrl(c) */ + { + FIM_SDL_INPUT_DEBUG(c,"iscntrl"); + return 0; + } + /* + * p.s.: note that we get 0 in some cases (e.g.: KMOD_RSHIFT, ...). + * */ + } + else + { + FIM_SDL_INPUT_DEBUG(c,"wchar"); + cout << "sorry, no support for wide chars in fim\n"; + /* no support for wide chars in fim */ + return 0; + } + FIM_SDL_INPUT_DEBUG(c,"unknown"); + return 0; + + break; +#if FIM_WANT_SDL_PROOF_OF_CONCEPT_MOUSE_SUPPORT + //case SDL_MOUSEMOTION: + case SDL_MOUSEBUTTONDOWN: + //case SDL_MOUSEBUTTONUP: + { + fim_coo_t x,y; + Uint8 ms=SDL_GetMouseState(&x,&y); +#if 0 + cout << "mouse clicked at "<this->width()/2)?'r':'l') <<"; state: "< 0 && event.motion.y ) + { + fim_off_t bf = 5; + fim_off_t vx = cv->viewport_width(); + fim_off_t vy = cv->viewport_height(); + fim_off_t bx = vx / bf; + fim_off_t by = vy / bf; + fim_off_t px = FIM_INT_DET_PCNT(event.motion.x-bx/2,vx-bx); + fim_off_t py = FIM_INT_DET_PCNT(event.motion.y-by/2,vy-by); + px = FIM_DELIMIT_TO_100(px); + py = FIM_DELIMIT_TO_100(py); + if(px >= 0 && py >= 0 ) + if(px <= 100 && py <= 100 ) + { + //std::cout << "pct:"<< px << " " << py << "\n"; + cv->place(px,py); + cv->display(); // draw only if necessary + //cv->redisplay(); // draw always + } + } + } +#endif /* FIM_WANT_EXPERIMENTAL_MOUSE_PAN */ + break; + default: + FIM_SDL_INPUT_DEBUG(c,"default-unknown"); + } + return 0; + } +done: + FIM_SDL_INPUT_DEBUG(c,"no key"); + return 0; + } + + fim_sys_int SDLDevice::get_input(fim_key_t * c, bool want_poll) + { + return get_input_inner(c,&event_,&keypress_,want_poll); + } + + fim_err_t SDLDevice::fill_rect(fim_coo_t x1, fim_coo_t x2, fim_coo_t y1,fim_coo_t y2, fim_color_t color) + { + fim_coo_t y; + /* + * This could be optimized + * */ + for(y=y1;y<=y2;++y) + { + fim_memset(((fim_byte_t*)(screen_->pixels)) + y*screen_->pitch + x1*Bpp_,color, (x2-x1)* Bpp_); + } + return FIM_ERR_NO_ERROR; + } + + fim_err_t SDLDevice::clear_rect(fim_coo_t x1, fim_coo_t x2, fim_coo_t y1,fim_coo_t y2) + { + fim_coo_t y; + /* + * This could be optimized + * */ + for(y=y1;y<=y2;++y) + { + fim_bzero(((fim_byte_t*)(screen_->pixels)) + y*screen_->pitch + x1*Bpp_, (x2-x1+1)* Bpp_); + } + return FIM_ERR_NO_ERROR; + } + +void SDLDevice::fs_render_fb(fim_coo_t x_, fim_coo_t y, FSXCharInfo *charInfo, fim_byte_t *data) +{ + +/* + * These preprocessor macros should serve *only* for font handling purposes. + * */ +#define BIT_ORDER BitmapFormatBitOrderMSB +#ifdef BYTE_ORDER +#undef BYTE_ORDER +#endif +#define BYTE_ORDER BitmapFormatByteOrderMSB +#define SCANLINE_UNIT BitmapFormatScanlineUnit8 +#define SCANLINE_PAD BitmapFormatScanlinePad8 +#define EXTENTS BitmapFormatImageRectMin + +#define SCANLINE_PAD_BYTES 1 +#define GLWIDTHBYTESPADDED(bits, nBytes) \ + ((nBytes) == 1 ? (((bits) + 7) >> 3) /* pad to 1 byte */\ + :(nBytes) == 2 ? ((((bits) + 15) >> 3) & ~1) /* pad to 2 bytes */\ + :(nBytes) == 4 ? ((((bits) + 31) >> 3) & ~3) /* pad to 4 bytes */\ + :(nBytes) == 8 ? ((((bits) + 63) >> 3) & ~7) /* pad to 8 bytes */\ + : 0) + + fim_coo_t row,bit,x; + fim_sys_int bpr; + const Uint8 rc = 0xff, gc = 0xff, bc = 0xff; + // const Uint8 rc = 0x00, gc = 0x00, bc = 0xff; + + bpr = GLWIDTHBYTESPADDED((charInfo->right - charInfo->left), SCANLINE_PAD_BYTES); + for (row = 0; row < (charInfo->ascent + charInfo->descent); row++) + { + for (x = 0, bit = 0; bit < (charInfo->right - charInfo->left); bit++) + { + if (data[bit>>3] & fs_masktab[bit&7]) + { // WARNING ! +#if FIM_FONT_MAGNIFY_FACTOR == 1 + setpixel(screen_,x_+x,(y+row)*screen_->pitch/Bpp_,rc,gc,bc); +#else /* FIM_FONT_MAGNIFY_FACTOR */ + for(fim_coo_t mi = 0; mi < fim_fmf; ++mi) + for(fim_coo_t mj = 0; mj < fim_fmf; ++mj) + setpixel(screen_,x_+fim_fmf*x+mj,(y+fim_fmf*row+mi)*screen_->pitch/Bpp_,rc,gc,bc); +#endif /* FIM_FONT_MAGNIFY_FACTOR */ + } + x += Bpp_/Bpp_;/* FIXME */ + } + data += bpr; + } + +#undef BIT_ORDER +#undef BYTE_ORDER +#undef SCANLINE_UNIT +#undef SCANLINE_PAD +#undef EXTENTS +#undef SCANLINE_PAD_BYTES +#undef GLWIDTHBYTESPADDED +} + +fim_err_t SDLDevice::fs_puts(struct fs_font *f_, fim_coo_t x, fim_coo_t y, const fim_char_t *str) +{ + fim_sys_int i,c/*,j,w*/; + + for (i = 0; str[i] != '\0'; i++) { + c = (fim_byte_t)str[i]; + if (FIM_NULL == f_->eindex[c]) + continue; + /* clear with bg color */ +// w = (f_->eindex[c]->width+1)*Bpp_; +#if 0 +#ifdef FIM_IS_SLOWER_THAN_FBI + for (j = 0; j < f_->sheight(); j++) { +///// memset_combine(start,0x20,w); + fim_bzero(start,w); + start += fb_fix.line_length; + } +#else + //sometimes we can gather multiple calls.. + if(fb_fix.line_length==(fim_int)w) + { + //contiguous case + fim_bzero(start,w*f_->sheight()); + start += fb_fix.line_length*f_->sheight(); + } + else + for (j = 0; j < f_->sheight(); j++) { + fim_bzero(start,w); + start += fb_fix.line_length; + } +#endif +#endif + /* draw character */ + //fs_render_fb(fb_fix.line_length,f_->eindex[c],f_->gindex[c]); + fs_render_fb(x,y,f_->eindex[c],f_->gindex[c]); + x += f_->eindex[c]->swidth(); + /* FIXME : SLOW ! */ + if (((fim_coo_t)x) > width() - f_->swidth()) + goto err; + } + // FIXME + return FIM_ERR_NO_ERROR; +err: + return FIM_ERR_GENERIC; +} + + fim_err_t SDLDevice::status_line(const fim_char_t *msg) + { + fim_err_t errval = FIM_ERR_NO_ERROR; + fim_coo_t y,ys=3;// FIXME + + if(SDL_MUSTLOCK(screen_) && SDL_LockSurface(screen_) < 0) + { + errval = FIM_ERR_GENERIC; + goto done; + } + + if(get_chars_per_column()<1) + goto done; + y = height() - f_->sheight() - ys; + if(y<0 ) + goto done; + clear_rect(0, width()-1, y+1,y+f_->sheight()+ys-1); + fs_puts(f_, 0, y+ys, msg); + fill_rect(0,width()-1, y, y, FIM_CNS_WHITE); + + if(SDL_MUSTLOCK(screen_)) SDL_UnlockSurface(screen_); + SDL_Flip(screen_); +done: + return errval; + } + + fim_key_t SDLDevice::catchInteractiveCommand(fim_ts_t seconds)const + { + /* + * Whether there is some input in the input queue. + * Note that in this way the event_ will be lost. + * */ + fim_key_t c=0; + SDL_Event levent; + fim_sys_int lkeypress=0; + fim_tms_t sms=10,ms=seconds*1000;// sms: sleep ms +#if 0 + for(;seconds>0;--seconds) + sleep(1); + if(!get_input_inner(&c,&levent,&lkeypress)) + { + //std::cout << "input:" << c << "\n"; + return c; + } + else + return -1; +#else + do + { + if(ms>0) + usleep((useconds_t)(sms*1000)),ms-=sms; + // we read input twice: it seems we have a number of "spurious" inputs. + if(1==get_input_inner(&c,&levent,&lkeypress,true)) goto done; + } + while(ms>0); + return -1; +done: + usleep((useconds_t)(sms*1000)),ms-=sms; + return c; +#endif + } + + void SDLDevice::flush(void) + { + } + + void SDLDevice::lock(void) + { + if(SDL_MUSTLOCK(screen_)) + { + if(SDL_LockSurface(screen_) < 0) return; + } + } + + void SDLDevice::unlock(void) + { + if(SDL_MUSTLOCK(screen_)) SDL_UnlockSurface(screen_); + SDL_Flip(screen_); + } + + bool SDLDevice::allowed_resolution(fim_coo_t w, fim_coo_t h) + { + if(w==0 || h==0) + goto ok; + if(wswidth() || hsheight()) + return false; +ok: + return true; + } + + fim_err_t SDLDevice::resize(fim_coo_t w, fim_coo_t h) + { + SDL_Surface *nscreen_=FIM_NULL; + fim_sdl_int want_flags=screen_?screen_->flags:FIM_SDL_FLAGS; +#if FIM_WANT_HARDCODED_ICON + unsigned char icondata[] = +#include "default_icon_byte_array.h" + SDL_Surface *icon = FIM_NULL; +#endif /* FIM_WANT_HARDCODED_ICON */ + + if(want_resize_) + want_flags|=SDL_RESIZABLE; + else + want_flags&=~SDL_RESIZABLE; + + if(want_windowed_) + want_flags&=~SDL_FULLSCREEN; + else + want_flags|=SDL_FULLSCREEN; + + if(!allowed_resolution(w,h)) + return FIM_ERR_GENERIC; + + SDL_ShowCursor(want_mouse_display_?1:0); + + if(w==0 && h==0) + { + int nr = 1, dr = 2; + + if( want_flags & SDL_FULLSCREEN ) + nr = 1, dr = 1; + + w = FIM_FRAC(bvi_.current_w,nr,dr); + h = FIM_FRAC(bvi_.current_h,nr,dr); + } + w = FIM_MIN(w,bvi_.current_w); + h = FIM_MIN(h,bvi_.current_h); + //std::cout << "using " << bvi_.current_w << " "<< bvi_.current_h << " !\n"; + +#if FIM_WANT_HARDCODED_ICON + icon = SDL_LoadBMP_RW(SDL_RWFromMem(icondata, sizeof(icondata)), 1); + SDL_WM_SetIcon(icon, FIM_NULL); + SDL_FreeSurface(icon); +#endif /* FIM_WANT_HARDCODED_ICON */ + + //std::cout << "resizing to " << w << " "<< h << "\n"; + if (FIM_NULL==(nscreen_ = SDL_SetVideoMode(w, h, bpp_, want_flags))) + { + ///std::cout << "resizing to " << w << " "<< h << " FAILED!\n"; + return FIM_ERR_GENERIC; + } + + screen_=nscreen_; + if(want_flags&SDL_FULLSCREEN) + reset_wm_caption(); + if(!sdl_window_update()) + { + std::cout << "problems initializing SDL (SDL_GetVideoInfo)\n"; + return FIM_ERR_GENERIC; + } + + post_wmresize(); + return FIM_ERR_NO_ERROR; + } + + fim_err_t SDLDevice::reinit(const fim_char_t *rs) + { +#if FIM_SDL_WANT_RESIZE +#else + cout << "reinit not allowed\n"; + goto err; +#endif + // FIXME: a wrong command string shall be ignored! + if(parse_optstring(rs)!=FIM_ERR_NO_ERROR) + goto err; + return cc.resize(current_w_,current_h_); + err: + //std::cerr<<"problems!\n"; + return FIM_ERR_GENERIC; + } + + fim_err_t SDLDevice::set_wm_caption(const fim_char_t *msg) + { + fim_err_t rc=FIM_ERR_NO_ERROR; +#if FIM_WANT_CAPTION_CONTROL + if((!msg) || (!want_windowed_)) + { + rc=FIM_ERR_UNSUPPORTED; + goto err; + } + SDL_WM_SetCaption(msg,FIM_SDL_ICONPATH); +#else + rc=FIM_ERR_UNSUPPORTED; +#endif +err: + return rc; + } + + fim_err_t SDLDevice::reset_wm_caption(void) + { + SDL_WM_SetCaption(FIM_CNS_FIM_APPTITLE,FIM_SDL_ICONPATH); + return FIM_ERR_NO_ERROR; + } + + fim_coo_t SDLDevice::status_line_height(void)const + { + return f_ ? border_height_ + f_->sheight() : 0; + } + + fim_err_t SDLDevice::post_wmresize(void) + { + cc.setVariable(FIM_VID_SCREEN_WIDTH, (fim_int)current_w_); + cc.setVariable(FIM_VID_SCREEN_HEIGHT,(fim_int)current_h_); +#ifndef FIM_WANT_NO_OUTPUT_CONSOLE + // textual console reformatting + //mc_.setRows ( get_chars_per_column()/(2*f_->sheight()) ); + mc_.setGlobalVariable(FIM_VID_CONSOLE_ROWS,(fim_int)(height()/(2*f_->sheight()))); + mc_.reformat( width() / f_->swidth() ); +#endif /* FIM_WANT_NO_OUTPUT_CONSOLE */ + return FIM_ERR_NO_ERROR; + } +#endif + + diff --git a/src/SDLDevice.h b/src/SDLDevice.h new file mode 100644 index 0000000..0172f92 --- /dev/null +++ b/src/SDLDevice.h @@ -0,0 +1,110 @@ +/* $LastChangedDate: 2015-01-24 12:04:20 +0100 (Sat, 24 Jan 2015) $ */ +/* + SDLDevice.h : sdllib device Fim driver header file + + (c) 2008-2013 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +#ifndef FIM_SDLDEVICE_H +#define FIM_SDLDEVICE_H +#ifdef FIM_WITH_LIBSDL + +#include "DisplayDevice.h" +#include + +class SDLDevice:public DisplayDevice +{ + private: + + SDL_Surface *screen_; + SDL_Event event_; + const SDL_VideoInfo* vi_; + SDL_VideoInfo bvi_; + + int keypress_ ; + + fim_coo_t current_w_; + fim_coo_t current_h_; + fim_bpp_t Bpp_,bpp_; + fim::string opts_; + static const fim_coo_t border_height_=1; + bool want_windowed_; + bool want_mouse_display_; + bool want_resize_; + + public: + +#ifndef FIM_WANT_NO_OUTPUT_CONSOLE + SDLDevice(MiniConsole & mc_, +#else /* FIM_WANT_NO_OUTPUT_CONSOLE */ + SDLDevice( +#endif /* FIM_WANT_NO_OUTPUT_CONSOLE */ + fim::string opts + ); + + virtual fim_err_t display( + void *ida_image_img, // source image structure (struct ida_image *)(but we refuse to include header files here!) + //void* rgb,// destination gray array and source rgb array + fim_coo_t iroff,fim_coo_t icoff, // row and column offset of the first input pixel + fim_coo_t irows,fim_coo_t icols,// rows and columns in the input image + fim_coo_t icskip, // input columns to skip for each line + fim_coo_t oroff,fim_coo_t ocoff,// row and column offset of the first output pixel + fim_coo_t orows,fim_coo_t ocols,// rows and columns to draw in output buffer + fim_coo_t ocskip,// output columns to skip for each line + fim_flags_t flags// some flags + ); + + fim_err_t initialize(sym_keys_t &sym_keys); + void finalize(void) ; + + int get_chars_per_line(void) ; + int get_chars_per_column(void); + fim_coo_t width(void); + fim_coo_t height(void); + fim_err_t status_line(const fim_char_t *msg); + fim_bool_t handle_console_switch(void) { return false; } + fim_err_t clear_rect(fim_coo_t x1, fim_coo_t x2, fim_coo_t y1,fim_coo_t y2); + fim_sys_int get_input(fim_key_t * c, bool want_poll=false); + virtual fim_key_t catchInteractiveCommand(fim_ts_t seconds)const; + void fs_render_fb(fim_coo_t x, fim_coo_t y, FSXCharInfo *charInfo, fim_byte_t *data); + fim_err_t fs_puts(struct fs_font *f_, fim_coo_t x, fim_coo_t y, const fim_char_t *str); + void flush(void); + void lock(void); + void unlock(void); + fim_bpp_t get_bpp(void) { return bpp_; }; + bool sdl_window_update(void); + virtual fim_coo_t status_line_height(void)const; + private: + fim_err_t clear_rect_( void* dst, fim_coo_t oroff,fim_coo_t ocoff,fim_coo_t orows,fim_coo_t ocols,fim_coo_t ocskip); + /* TEMPORARY */ + inline void setpixel(SDL_Surface *screen_, fim_coo_t x, fim_coo_t y, Uint8 r, Uint8 g, Uint8 b); + void status_screen_(int desc,int draw_output){ return ; } + fim_err_t fill_rect(fim_coo_t x1, fim_coo_t x2, fim_coo_t y1,fim_coo_t y2, fim_color_t color); + fim_coo_t txt_width(void) ; + fim_coo_t txt_height(void) ; + virtual fim_err_t resize(fim_coo_t w, fim_coo_t h); + private: + bool allowed_resolution(fim_coo_t w, fim_coo_t h); + virtual fim_err_t reinit(const fim_char_t *rs); + fim_err_t parse_optstring(const fim_char_t *os); + virtual fim_err_t set_wm_caption(const fim_char_t *msg); + fim_err_t reset_wm_caption(void); + fim_err_t post_wmresize(void); +}; + + +#endif /* FIM_WITH_LIBSDL */ +#endif /* FIM_SDLDEVICE_H */ diff --git a/src/Var.cpp b/src/Var.cpp new file mode 100644 index 0000000..abf1939 --- /dev/null +++ b/src/Var.cpp @@ -0,0 +1,83 @@ +/* $LastChangedDate: 2016-02-04 23:46:33 +0100 (Thu, 04 Feb 2016) $ */ +/* + Var.cpp : + + (c) 2007-2016 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +#include "fim.h" +namespace fim +{ + typedef std::map fim_var_help_t;//variable id -> variable help + static fim_var_help_t fim_var_help_db; /* this is the global help db for fim variables */ + + void fim_var_help_db_init(void) + { + /* The inclusion of the next file is not essential : it serves only to populate the variables help database. */ + #define FIM_WANT_INLINE_HELP 1 + #include "help.cpp" + #undef FIM_WANT_INLINE_HELP + ;/* freebsd 7.2 cc dies without */ + } + + fim::string fim_var_help_db_query(const fim::string &id) + { + string hs = fim_var_help_db[id]; + if(hs==FIM_CNS_EMPTY_STRING) + return "the help system for variables is still incomplete"; + else + return hs; + } + + fim::string fim_get_variables_reference(FimDocRefMode refmode) + { + string s =FIM_CNS_EMPTY_STRING; + fim_var_help_t::const_iterator vi; + if(refmode==Man) + goto manmode; + for( vi=fim_var_help_db.begin();vi!=fim_var_help_db.end();++vi) + { + s+=vi->first; + s+=" : "; + s+=fim_var_help_db_query(vi->first); + s+="\n"; + } + return s; +manmode: + for( vi=fim_var_help_db.begin();vi!=fim_var_help_db.end();++vi) + { + s+=".na\n"; /* No output-line adjusting; unelegant way to avoid man --html=cat's: cannot adjust line */ + s+=".B\n"; + s+=vi->first; + s+="\n"; + s+=fim_var_help_db_query(vi->first); + s+="\n"; + s+=".fi\n"; + } + s.substitute("\\$","$\\:"); /* Zero-width break point on $ (that is, on long hardcoded regexps). */ + return s; + } + + std::ostream& Var::print(std::ostream &os)const + { + return os << this->getString(); + } + + std::ostream& operator<<(std::ostream &os, const Var & var) + { + return var.print(os); + } +} diff --git a/src/Var.h b/src/Var.h new file mode 100644 index 0000000..1339ac1 --- /dev/null +++ b/src/Var.h @@ -0,0 +1,302 @@ +/* $LastChangedDate: 2017-07-10 12:50:43 +0200 (Mon, 10 Jul 2017) $ */ +/* + Var.h : Var class header file + + (c) 2007-2015 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/* + * This class is horrible. + */ +#ifndef FIM_VAR_H +#define FIM_VAR_H + +//#include "fim.h" +#include "string.h" + +#define FIM_FFL_PRT printf("In %s located in %20s:%d :\n",__func__,__FILE__,__LINE__) +#if 0 +#define DBG(X) FIM_FFL_PRT;std::cout<set(v); + } + + int set(const Var &v) + { + DBG("(v:?)\n"); + this->type=v.type; + if(type=='i') + this->i=v.i; + if(type=='f') + this->f=v.f; + if(type=='s') + this->s=v.s; + return 0; + } + + Var(float v) + :type(0),i(0),s(fim::string()) + { + DBG("(f:"<s=s; + else + i=0; + } + + Var(const fim::string s) + :type(0),i(0),s(fim::string()) + { + type='s'; + this->s=s.c_str(); + } + + Var(const fim_char_t*s) + :type(0),i(0),s(fim::string()) + { + type='s'; + this->s=s; + } +/* + Var(const fim_char_t*s="0",int type_='i') + { + type=type_; + if(type=='i')i=fim_atoi(s); + else if(type=='f')f=fim_atof(s); + else if(type=='s')this->s=s; + else i=0; + } +*/ +/* void operator= (int i){if(type=='i')this->i=i;} + void operator= (float f){if(type=='f')this->f=f;}*/ +#if 0 + void operator= (int i){type='i';this->i=i;} + void operator= (float f){setFloat(f);} + void operator= (fim::string &s){setString(s);} +#else + const Var& operator= (int i){DBG("2i:"<i=i;return *this;} + const Var& operator= (float f){setFloat(f);return *this;} + const Var& operator= (fim::string &s){setString(s);return *this;} + /* const Var& operator= (const Var &v){type=v.type;;return *this;} */ + const Var& operator= (const Var &v){set(v);return *this;} + Var concat(const Var &v)const{return this->getString()+v.getString();} +#endif + float setFloat(float f){type='f';return this->f=f;} + fim_int setInt(fim_int i){type='i';return this->i=i;} + fim::string setString(fim::string &s){type='s';this->s=s;return this->s;} + int getType(void)const{return type;} + fim_int getInt(void)const{return(type=='i')?i: + (type=='f'?((fim_int)(f)): + (type=='s'?(fim_atoi(s.c_str())):0) + ) + ;} + + float getFloat(void)const{ + + return(type=='f')?f: + (type=='i'? + ((float)i): + ((type=='s')?fim_atof(s.c_str()):0.0f) + ) + ;} + + fim::string getString(void)const + { + fim_char_t buf[16]; + DBG("t:"<<(char)type <<"\n"); + if(type=='s')return this->s; + else + { + if(type=='i') + { + if(sizeof(fim_int)==sizeof(int)) + sprintf(buf,"%d",(int)i); + else + sprintf(buf,"%lld",(int64_t)i); + } + else + if(type=='f') + sprintf(buf,"%f",f); + DBG(" v:"<=(const Var &v)const { return getFloat()>=v.getFloat(); } + Var operator< (const Var &v)const { return getFloat()< v.getFloat(); } + Var operator> (const Var &v)const { return getFloat()> v.getFloat(); } + #define _both(t) (((getType()==t) && (v.getType()==t))) + #define _types() DBG("t1:"<<(getType())<<",t2:"<<(v.getType())<<"\n"); + #define _some_string() (getType()=='s' || v.getType()=='s') + #define _numeric() (!_some_string()) + #define _p_t(op) DBG(op<<"("<<(fim_char_t)getType()<<","<<(fim_char_t)v.getType()<<")\n"); + Var operator!=(const Var &v)const { + //_p_t("!=") + _types() + if(_both('i'))return getInt () !=v.getInt (); + if(_both('f'))return getFloat() !=v.getFloat(); + if(_both('s')) + { + return getString()!=v.getString(); + } + return getFloat()!=v.getFloat(); + } + Var operator==(const Var &v)const {DBG("EQV\n"); return 1-(*this != v).getInt(); } + Var operator/ (const Var &v)const + { + if(_both('i')) return getInt()/(v.getInt()!=0?v.getInt():1); + return getFloat()/(v.getFloat()!=0.0?v.getFloat():1); + } + Var operator* (const Var &v)const + { + if(_both('i'))return getInt ()*v.getInt (); + if(_both('f'))return getFloat()*v.getFloat(); + if(_both('s'))return getFloat()*v.getFloat(); + return getFloat()*v.getFloat(); + } + Var operator| (const Var &v)const + { + return getInt ()|v.getInt (); + } + Var operator& (const Var &v)const + { + return getInt ()&v.getInt (); + } + Var operator+ (const Var &v)const + { + if(_both('i'))return getInt ()+v.getInt (); + if(_both('f'))return getFloat()+v.getFloat(); + if(_both('s'))return getString()+v.getString();//yes... + return getFloat()+v.getFloat(); + } + Var operator- (const Var &v)const + { + DBG("SUB"<getString().c_str()); + return aeq == 0; + } + int re (const Var &v)const + { + return re_match(v).getInt(); + } +/* + Var operator< (const Var &v)const + { + if(_both('i'))return getInt () // ceilf +/* + * TODO : + * Windowing related problems: + * + * Implement a mechanism such that each Image instance owns + * one only copy of the original image, and zero or more rescaled versions, + * for display use only. + * Once freed, an image could free all of its buffers, depending on the caching policy. + * + * When windowing will be implemented, note that redisplay will be also affected + * after window geometry change. Update mechanisms are needed.. + */ +#define FIM_WANT_VIEWPORT_TRANSFORM 1 +namespace fim +{ + + Viewport::Viewport( + CommandConsole &c +#ifdef FIM_WINDOWS + ,const Rect & corners +#endif /* FIM_WINDOWS */ + ) + : +#ifdef FIM_NAMESPACES + Namespace(&c,FIM_SYM_NAMESPACE_VIEWPORT_CHAR), +#endif /* FIM_NAMESPACES */ + psteps_(false), + displaydevice_(c.displaydevice_) /* could be FIM_NULL */ +#ifdef FIM_WINDOWS + ,corners_(corners) +#endif /* FIM_WINDOWS */ + ,image_(FIM_NULL) + ,commandConsole(c) + { + // WARNING : this constructor will be filled soon + if(!displaydevice_) + throw FIM_E_TRAGIC; + reset(); + } + + Viewport::Viewport(const Viewport &v) + : + /* steps_(v.steps_) + ,hsteps_(v.hsteps_) + ,vsteps_(v.vsteps_) + ,top_(v.top_) + ,left_(v.left_) + ,panned_(v.panned_) */ +#ifdef FIM_NAMESPACES + Namespace(v), +#endif /* FIM_NAMESPACES */ + psteps_(v.psteps_) + ,displaydevice_(v.displaydevice_) + ,corners_(v.corners_) + ,image_(FIM_NULL) + ,commandConsole(v.commandConsole) + { + steps_ = v.steps_; + hsteps_ = v.hsteps_; + vsteps_ = v.vsteps_; + top_ = v.top_; + left_ = v.left_; + panned_ = v.panned_; + // WARNING + //reset(); + try + { +#ifndef FIM_BUGGED_CACHE + #ifdef FIM_CACHE_DEBUG + if(v.image_) + std::cout << "Viewport:Viewport():maybe will cache \"" <getName() << "\" from "<check_invalid()) + { + ViewportState viewportState; + setImage( commandConsole.browser_.cache_.useCachedImage(v.image_->getKey(),&viewportState) ); + setState(viewportState); + } +#else /* FIM_BUGGED_CACHE */ + if(v.image_) + setImage ( new Image(*v.image_) ) ; +#endif /* FIM_BUGGED_CACHE */ + } + catch(FimException e) + { + image_=FIM_NULL; + std::cerr << "fatal error" << __FILE__ << ":" << __LINE__ << FIM_CNS_NEWLINE; + } + } + + void Viewport::setState(const ViewportState & viewportState) + { + hsteps_ = viewportState.hsteps_; + vsteps_ = viewportState.vsteps_; + steps_ = viewportState.steps_; + top_ = viewportState.top_; + left_ = viewportState.left_; + panned_ = viewportState.panned_; + } + + void Viewport::pan_up(fim_pan_t s) + { + panned_ |= 0x1; + if(s<0) + pan_down(-s); + else + { + if(this->onTop()) + return; + s=(s==0)?steps_:s; + top_ -= s; + } + } + + void Viewport::pan_down(fim_pan_t s) + { + panned_ |= 0x1; + if(s<0) + pan_up(-s); + else + { + if(this->onBottom()) + return; + s=(s==0)?steps_:s; + top_ += s; + } + } + + void Viewport::pan_right(fim_pan_t s) + { + panned_ |= 0x2; + if(s<0) + pan_left(-s); + else + { + if(onRight()) + return; + s=(s==0)?steps_:s; + left_+=s; + } + } + + void Viewport::pan_left(fim_pan_t s) + { + panned_ |= 0x2; + if(s<0) + pan_right(-s); + else + { + if(onLeft()) + return; + s=(s==0)?steps_:s; + left_-=s; + } + } + + bool Viewport::onBottom(void)const + { + if( check_invalid() ) + return false; + return (top_ + viewport_height() >= image_->height()); + } + + bool Viewport::onRight(void)const + { + if( check_invalid() ) + return false; + return (left_ + viewport_width() >= image_->width()); + } + + bool Viewport::onLeft(void)const + { + if( check_invalid() ) + return false; + return (left_ <= 0 ); + } + + bool Viewport::onTop(void)const + { + if( check_invalid() ) + return false; + return (top_ <= 0 ); + } + + fim_coo_t Viewport::viewport_width(void)const + { + /* + * */ +#ifdef FIM_WINDOWS + return corners_.width(); +#else + return displaydevice_->width(); +#endif /* FIM_WINDOWS */ + } + + fim_coo_t Viewport::viewport_height(void)const + { + /* + * */ + fim_coo_t fh = displaydevice_->status_line_height(); + if(fh) + fh*=(getGlobalIntVariable(FIM_VID_DISPLAY_STATUS)==1?1:0); +#ifdef FIM_WINDOWS + return corners_.height()-fh; +#else + return displaydevice_->height()-fh; +#endif /* FIM_WINDOWS */ + } + + bool Viewport::redisplay(void) + { + /* + * we 'force' redraw. + * display() has still the last word :P + * */ + should_redraw(); + return display(); + } + + fim_coo_t Viewport::xorigin(void) + { + // horizontal origin coordinate (upper) +#ifdef FIM_WINDOWS + return corners_.xorigin(); +#else + return 0; +#endif /* FIM_WINDOWS */ + } + + fim_coo_t Viewport::yorigin(void) + { + // vertical origin coordinate (upper) +#ifdef FIM_WINDOWS + return corners_.yorigin(); +#else /* FIM_WINDOWS */ + return 0; +#endif /* FIM_WINDOWS */ + } + + void Viewport::null_display(void) + { + /* + * for recovery purposes. FIXME + * */ + if(! need_redraw()) + return; +#ifdef FIM_WINDOWS + /* FIXME : note that fbi's clear_rect() is a buggy function and thus the fs_bpp multiplication need ! */ + { + displaydevice_->clear_rect( + xorigin(), + xorigin()+viewport_width()-1, + yorigin(), + yorigin()+viewport_height()-1 + ); + } +#else /* FIM_WINDOWS */ + /* FIXME */ + displaydevice_->clear_rect( 0, (viewport_width()-1)*displaydevice_->get_bpp(), 0, (viewport_height()-1)); +#endif /* FIM_WINDOWS */ + } + + void Viewport::fs_ml_puts(const char *str, fim_int doclear) + { + /* multiline puts */ + int fh=displaydevice_->f_ ? displaydevice_->f_->sheight():1; // FIXME : this is not clean + int fw=displaydevice_->f_ ? displaydevice_->f_->swidth():1; // FIXME : this is not clean + int sl = strlen(str), rw = viewport_width() / fw, wh = viewport_height(); + int cpl = displaydevice_->get_chars_per_line(); + + if(doclear && cpl) + { + int lc = FIM_INT_FRAC(sl,cpl); /* lines count */ + displaydevice_->clear_rect(0, viewport_width()-1, 0, FIM_MIN(fh*lc,wh-1)); + } + + for( int li = 0 ; sl > rw * li ; ++li ) + if((li+1)*fhfs_puts(displaydevice_->f_, 0, fh*li, str+rw*li); + } + + bool Viewport::display(void) + { + /* + * the display function draws the image in the frame buffer + * memory. + * no scaling occurs, only some alignment. + * + * returns true when some drawing occurred. + */ + if(! need_redraw()) + return false; + if( check_invalid() ) + null_display();// NEW + if( check_invalid() ) + return false; + /* + * should flip ? should mirror ? + * + * global or inner (not i: !) or local (v:) marker + * */ + int autotop=getGlobalIntVariable(FIM_VID_AUTOTOP) | image_->getIntVariable(FIM_VID_AUTOTOP) /* | getIntVariable(FIM_VID_AUTOTOP)*/; + //int flip =getGlobalIntVariable(FIM_VID_AUTOFLIP) | image_->getIntVariable(FIM_VID_FLIPPED) | getIntVariable(FIM_VID_FLIPPED); + int flip = + ((getGlobalIntVariable(FIM_VID_AUTOFLIP)== 1)|(image_->getIntVariable(FIM_VID_FLIPPED)== 1)/*|(getIntVariable(FIM_VID_FLIPPED)== 1)*/&& + !((getGlobalIntVariable(FIM_VID_AUTOFLIP)==-1)|(image_->getIntVariable(FIM_VID_FLIPPED)==-1)/*|(getIntVariable(FIM_VID_FLIPPED)==-1)*/)); + int mirror = + (((getGlobalIntVariable(FIM_VID_AUTOMIRROR)== 1)|(image_->getIntVariable(FIM_VID_MIRRORED)== 1)/*|(getIntVariable(FIM_VID_MIRRORED)== 1)*/)&& + !((getGlobalIntVariable(FIM_VID_AUTOMIRROR)==-1)|(image_->getIntVariable(FIM_VID_MIRRORED)==-1)/*|(getIntVariable(FIM_VID_MIRRORED)==-1)*/)); + int negate = /* FIXME : temporarily here */ + ((getGlobalIntVariable(FIM_VID_AUTONEGATE)== 1)&&(image_->getIntVariable(FIM_VID_NEGATED)==0)); + int desaturate = /* FIXME : temporarily here */ + ((getGlobalIntVariable(FIM_VID_AUTODESATURATE)== 1)&&(image_->getIntVariable(FIM_VID_DESATURATED)==0)); + image_->update(); + + if(negate) + image_->negate(); + if(desaturate) + image_->desaturate(); + + if (getGlobalIntVariable("i:" FIM_VID_WANT_AUTOCENTER)==1 && need_redraw() ) + { + /* + * If this is the first image display, we have + * the right to rescale the image. + * */ + if(autotop && image_->height()>=this->viewport_height()) //THIS SHOULD BECOME AN AUTOCMD.. + { + top_=autotop>0?0:image_->height()-this->viewport_height(); + } + /* start with centered image, if larger than screen */ + if (image_->width() > this->viewport_width() ) + left_ = (image_->width() - this->viewport_width()) / 2; + if (image_->height() > this->viewport_height() && autotop==0) + top_ = (image_->height() - this->viewport_height()) / 2; + setGlobalVariable("i:" FIM_VID_WANT_AUTOCENTER,(fim_int)0); + } +// uncommenting the next 2 lines will reintroduce a bug +// else +// if( need_redraw() ) + { + /* + * 20070911 + * this code is essential in order to protect from bad left_ and top_ values. + * */ + /* + * This code should be studied in detail.. + * as it is is straight from fbi. + */ + if (image_->height() <= this->viewport_height()) + { + top_ = 0; + } + else + { + if (top_ < 0) + top_ = 0; + if (top_ + this->viewport_height() > image_->height()) + top_ = image_->height() - this->viewport_height(); + } + if (image_->width() <= this->viewport_width()) + { + left_ = 0; + } + else + { + if (left_ < 0) + left_ = 0; + if (left_ + this->viewport_width() > image_->width()) + left_ = image_->width() - this->viewport_width(); + } + } + + if( need_redraw()) + { + should_redraw(FIM_REDRAW_UNNECESSARY); + image_->should_redraw(FIM_REDRAW_UNNECESSARY); + /* + * there should be more work to use double buffering (if possible!?) + * and avoid image tearing! + */ +#if FIM_WANT_VIEWPORT_TRANSFORM + this->transform(mirror, flip); +#endif /* FIM_WANT_VIEWPORT_TRANSFORM */ +#ifdef FIM_WINDOWS + if(displaydevice_ ) + { + // FIXME : we need a mechanism for keeping the image pointer valid during multiple viewport usage + //std::cout << "display " << " ( " << yorigin() << "," << xorigin() << " ) "; + //std::cout << " " << " ( " << viewport_height() << "," << viewport_width() << " )\n"; + displaydevice_->display( + image_->img_, + top_, + left_, + image_->height(), + image_->width(), + image_->width(), + yorigin(), + xorigin(), + viewport_height(), + viewport_width(), + viewport_width(), + (mirror?FIM_FLAG_MIRROR:0)|(flip?FIM_FLAG_FLIP:0)/*flags : FIXME*/ + );} +#else + displaydevice_->display( + image_->img_, + top_, + left_, + //displaydevice_->height(), displaydevice_->width(), displaydevice_->width(), + viewport_height(), viewport_width(), viewport_width(), + 0, + 0, + // displaydevice_->height(), displaydevice_->width(), displaydevice_->width(), + viewport_height(), viewport_width(), viewport_width(), + (mirror?FIM_FLAG_MIRROR:0)|(flip?FIM_FLAG_FLIP:0)/*flags : FIXME*/ + ); +#endif +#if FIM_WANT_VIEWPORT_TRANSFORM + this->transform(mirror, flip); +#endif /* FIM_WANT_VIEWPORT_TRANSFORM */ +#if FIM_WANT_PIC_CMTS + /* FIXME: temporary; move to fs_puts_multiline() */ + if(image_) + if(fim_int wcoi = getGlobalIntVariable(FIM_VID_COMMENT_OI)) + { +#if 0 + int fh=displaydevice_->f_ ? displaydevice_->f_->sheight():1; // FIXME : this is not clean + int fw=displaydevice_->f_ ? displaydevice_->f_->swidth():1; // FIXME : this is not clean + const char * cmnts = image_->getStringVariable(FIM_VID_COMMENT).c_str(); + int sl = strlen(cmnts), rw = viewport_width() / fw, wh = viewport_height(); + for( int li = 0 ; sl > rw * li ; ++li ) + if((li+1)*fhfs_puts(displaydevice_->f_, 0, fh*li, cmnts+rw*li); +#else + const char * cmnts = image_->getStringVariable(FIM_VID_COMMENT).c_str(); + this->fs_ml_puts(cmnts,wcoi-1); +#endif + } +#endif /* FIM_WANT_PIC_CMTS */ + +#define FIM_WANT_BROWSER_PROGRESS_BAR 0 /* new */ +#if FIM_WANT_BROWSER_PROGRESS_BAR + fim_float_t bp = commandConsole.browser_.file_progress() * 100.0; + const fim_pan_t bw = 1; // bar width + const fim_pan_t vw = viewport_width(); + const fim_pan_t vh = viewport_height(); + const fim_coo_t xc = vw; // x coordinate + fim_color_t bc = FIM_CNS_WHITE; + bc = FIM_CNS_WHITE; + if(xc>bw) displaydevice_->fill_rect(xc-bw, xc, 0, FIM_FLT_PCNT_OF_100(bp,vh-1), bc); + // if(xc>bw) displaydevice_->fill_rect(xc-bw, xc, FIM_FLT_PCNT_OF_100(bp,vh-1),vh, bc); + // displaydevice_->fill_rect(0, 1, 0, FIM_FLT_PCNT_OF_100(bp,displaydevice_->height()-1), bc); + // displaydevice_->fill_rect(0, FIM_FLT_PCNT_OF_100(bp,displaydevice_->width()-1), 0, 1, bc); +#endif /* FIM_WANT_BROWSER_PROGRESS_BAR */ + return true; + } + return false; + } + + void Viewport::auto_scale(void) + { + fim_scale_t xs,ys; + if( check_invalid() ) + return; + else + { + xs = (fim_scale_t)this->viewport_width() / (fim_scale_t)(image_->original_width()*image_->ascale()); + ys = (fim_scale_t)this->viewport_height() / (fim_scale_t)image_->original_height(); + } + + image_->rescale(FIM_MIN(xs,ys)); + } + + void Viewport::auto_scale_if_bigger(void) + { + if( check_invalid() ) + return; + else + { + if((this->viewport_width()<(image_->original_width()*image_->ascale())) + ||(this->viewport_height() < image_->original_height())) + auto_scale(); + } + } + +#if 0 + int Viewport::valid(void) + { + // int instead of bool + return check_valid(); + } +#endif + + Image* Viewport::getImage(void)const + { + /* + * returns the image pointer, regardless its use! + * */ +#if FIM_WANT_BDI + if(!image_) + return &commandConsole.browser_.cache_.dummy_img_; + else +#endif /* FIM_WANT_BDI */ + return image_; + } + + const Image* Viewport::c_getImage(void)const + { + /* + * returns the image pointer, regardless its use! + * + * FIXME : this check is heavy.. move it downwards the call tree! + * */ +#if FIM_WANT_BDI + return check_valid() ? image_ : getImage(); +#else /* FIM_WANT_BDI */ + return check_valid() ? image_ : FIM_NULL; +#endif /* FIM_WANT_BDI */ + } + + void Viewport::setImage(fim::Image* ni) + { + /* + * the image could be FIM_NULL + * this image is not tightly bound! + * + * FIXME + */ +#ifdef FIM_CACHE_DEBUG + std::cout << "setting image \""<getName()<<"\" in viewport: "<< ni << "\n\n"; +#endif /* FIM_CACHE_DEBUG */ + + //image_ = FIM_NULL; + if(ni) + free(); + reset(); + image_ = ni; + } + + void Viewport::steps_reset(void) + { +#ifdef FIM_WINDOWS + steps_ = getGlobalIntVariable(FIM_VID_STEPS); + if(steps_reset_scale_flags(); + setGlobalVariable("i:" FIM_VID_WANT_AUTOCENTER,(fim_int)1); + } + should_redraw(); + top_ = 0; + left_ = 0; + steps_reset(); + } + + void Viewport::auto_height_scale(void) + { + /* + * scales the image in a way to fit in the viewport height + * */ + fim_scale_t newscale; + if( check_invalid() ) + return; + + newscale = ((fim_scale_t)this->viewport_height()) / (fim_scale_t)image_->original_height(); + + image_->rescale(newscale); + } + + void Viewport::auto_width_scale(void) + { + /* + * scales the image in a way to fit in the viewport width + * */ + fim_scale_t newscale; + if( check_invalid() ) + return; + + newscale = ((fim_scale_t)this->viewport_width()) / ((fim_scale_t)image_->original_width()*image_->ascale()); + + image_->rescale(newscale); + } + + void Viewport::free(void) + { + /* + * frees the currently loaded image, if any + */ +#ifndef FIM_BUGGED_CACHE + if(image_) + { + /* ViewportState viewportState() { */ + ViewportState viewportState; + viewportState.hsteps_ = hsteps_; + viewportState.vsteps_ = vsteps_; + viewportState.steps_ = steps_; + viewportState.top_ = top_; + viewportState.left_ = left_; + viewportState.panned_ = panned_; + /* } */ + if( !commandConsole.browser_.cache_.freeCachedImage(image_,&viewportState) ) + delete image_; // do it yourself :P + } +#else /* FIM_BUGGED_CACHE */ + // warning : in this cases exception handling is missing + if(image_) + delete image_; +#endif /* FIM_BUGGED_CACHE */ + image_ = FIM_NULL; + } + + bool Viewport::check_valid(void)const + { + /* + * yes :) + * */ + return ! check_invalid(); + } + + bool Viewport::check_invalid(void)const + { + /* + * this should not happen! (and probably doesn't happen :) ) + * */ + if(!image_) + return true; + else + return image_->check_invalid(); + } + + void Viewport::scale_position_magnify(fim_scale_t factor) + { + /* + * scale image positioning variables by adjusting by a multiplying factor + * */ + if(factor<=0.0) + return; + left_ = (fim_off_t)ceilf(((fim_scale_t)left_)*factor); + top_ = (fim_off_t)ceilf(((fim_scale_t)top_ )*factor); + /* + * should the following be controlled by some optional variable ? + * */ + //if(!panned_ /* && we_want_centering */ ) + this->recenter(); + } + + void Viewport::scale_position_reduce(fim_scale_t factor) + { + /* + * scale image positioning variables by adjusting by a multiplying factor + * */ + if(factor<=0.0) + return; + left_ = (fim_off_t)ceilf(((fim_scale_t)left_)/factor); + top_ = (fim_off_t)ceilf(((fim_scale_t)top_ )/factor); + //if(!panned_ /* && we_want_centering */ ) + this->recenter(); + } + + void Viewport::recenter_horizontally(void) + { + if(image_) + left_ = (image_->width() - this->viewport_width()) / 2; + } + + void Viewport::recenter_vertically(void) + { + if(image_) + top_ = (image_->height() - this->viewport_height()) / 2; + } + + void Viewport::recenter(void) + { + if(!(panned_ & 0x02)) + recenter_horizontally(); + if(!(panned_ & 0x01)) + recenter_vertically(); + } + + Viewport::~Viewport(void) + { + // FIXME : we need a revival for free() + free(); + } + + fim::string Viewport::pan(const fim_char_t*a1, const fim_char_t*a2) + { + // FIXME: a quick hack + args_t args; + if(a1) + args.push_back(a1); + if(a2) + args.push_back(a2); + return pan(args); + } + + bool Viewport::place(const fim_pan_t px, const fim_pan_t py) + { + /* FIXME: find a nicer name. */ + /* FIXME: shall merge this in an internal pan function. */ + fim_pan_t _px = px, _py = py; + +#if FIM_WANT_VIEWPORT_TRANSFORM + if(image_ && image_->is_flipped()) /* FIXME: this is only i: ... */ + _py = 100 - _py; + if(image_ && image_->is_mirrored()) /* FIXME: this is only i: ... */ + _px = 100 - _px; +#endif /* FIM_WANT_VIEWPORT_TRANSFORM */ + + if(image_) + { + fim_pan_t ih = image_->height(); + fim_pan_t iw = image_->width(); + fim_pan_t vh = this->viewport_height(); + fim_pan_t vw = this->viewport_width(); + fim_off_t top = top_, left = left_; + + if(ih>vh) + top = FIM_INT_PCNT_SAFE(_py,ih-vh); + if(iw>vw) + left = FIM_INT_PCNT_SAFE(_px,iw-vw); + + if( top != top_ || left != left_ ) + { + top_ = top; + left_ = left; + should_redraw(); + } + } + return true; + } + + fim::string Viewport::pan(const args_t &args) + { + /* FIXME: unfinished */ + fim_pan_t hs=0,vs=0; + fim_bool_t ps=false; + fim_char_t f=FIM_SYM_CHAR_NUL,s=FIM_SYM_CHAR_NUL; + const fim_char_t*fs=args[0].c_str(); + const fim_char_t*ss=FIM_NULL; + + if(args.size()<1 || (!fs)) + goto nop; + f=tolower(*fs); + if(!fs[0]) + goto nop; + s=tolower(fs[1]); + steps_reset(); + // FIXME: write me + if(args.size()>=2) + { + ps=((ss=args[1].c_str()) && *ss && ((ss[strlen(ss)-1])=='%')); + vs=hs=(int)(args[1]); + } + else + { + ps = psteps_; + vs = vsteps_; + hs = hsteps_; + } + if(ps) + { + // FIXME: new, brittle + vs = FIM_INT_PCNT(viewport_height(),vs); + hs = FIM_INT_PCNT(viewport_width(), hs); + } + + //std::cout << vs << " " << hs << " " << ps << FIM_CNS_NEWLINE; + +#if FIM_WANT_VIEWPORT_TRANSFORM + if(image_ && image_->is_flipped()) /* FIXME: this is only i: ... */ + vs=-vs; + if(image_ && image_->is_mirrored()) /* FIXME: this is only i: ... */ + hs=-hs; +#endif /* FIM_WANT_VIEWPORT_TRANSFORM */ + + switch(f) + { + case('u'): + pan_up(vs); + break; + case('d'): + pan_down(vs); + break; + case('r'): + pan_right(hs); + break; + case('l'): + pan_left(hs); + break; + case('n'): + case('s'): + if(f=='n') + pan_up(vs); + if(f=='s') + pan_down(vs); + switch(s) + { + case('e'): + pan_left(hs); + break; + case('w'): + pan_right(hs); + break; + default: + goto err; + } + break; + default: + goto err; + } + should_redraw(); +nop: + return FIM_CNS_EMPTY_RESULT; +err: + return FIM_CNS_EMPTY_RESULT; + } + + size_t Viewport::byte_size(void)const + { + size_t bs = 0; + bs += sizeof(*this); + return bs; + } + + int Viewport::snprintf_centering_info(char *str, size_t size)const + { + int vum,vlm; + int hum,hlm; + float va,ha; + char vc='c',hc='c'; + int res=0; + const char*cs=FIM_NULL; + const char*es=""; + const float bt=99.0; + const float ct=1.0; + + vum = top_; + vlm = image_->height() - viewport_height() - vum; + hum = left_; + hlm = image_->width() - viewport_width() - hum; + vum = FIM_MAX(vum,0); + vlm = FIM_MAX(vlm,0); + hum = FIM_MAX(hum,0); + hlm = FIM_MAX(hlm,0); + + if(vum<1 && vlm<1) + { + va=0.0; + // res = snprintf(str+res, size-res, "-"); + } + else + { + va=((float)(vum))/((float)(vum+vlm)); + va-=0.5; + va*=200.0; + if(va<0.0) + { + va*=-1.0,vc='^'; + if(va>=bt) + cs="top"; + } + else + { + vc='v'; + if(va>=bt) + cs="bot"; + } + if(va=bt) + cs="left"; + } + else + { + hc='>'; + if(ha>=bt) + cs="right"; + } + if(haonBottom()) + goto ret; + if( check_valid() ) + top_ = image_->height() - this->viewport_height(); + } + break; + case 't': + { + if(this->onTop()) + goto ret; + top_=0; + } + break; + case 'l': + left_=0; + break; + case 'r': + left_ = image_->width() - viewport_width(); + break; + case 'c': + //this->recenter(); + this->recenter_vertically(); this->recenter_horizontally(); + break; + default: + goto ret; + } + should_redraw(); +ret: + return; + } + + Viewport& Viewport::operator= (const Viewport&v){return *this;/* a disabled assignment */} + + void Viewport::transform(bool mirror, bool flip) + { + if(mirror) + { if( image_ && image_->width() > viewport_width() ) left_ = image_->width() - viewport_width() - left_; } + if(flip) + { if( image_ && image_->height() > viewport_height() ) top_ = image_->height() - viewport_height() - top_; } + } + + fim_bool_t Viewport::need_redraw(void)const + { + return ( ( redraw_ != FIM_REDRAW_UNNECESSARY ) || ( image_ && image_->need_redraw() ) || ( displaydevice_ && displaydevice_->need_redraw() ) ); + } + void Viewport::should_redraw(enum fim_redraw_t sr) + { + redraw_ = sr; + } +} + diff --git a/src/Viewport.h b/src/Viewport.h new file mode 100644 index 0000000..e3e6707 --- /dev/null +++ b/src/Viewport.h @@ -0,0 +1,132 @@ +/* $LastChangedDate: 2015-12-13 19:48:22 +0100 (Sun, 13 Dec 2015) $ */ +/* + Viewport.h : Viewport class headers + + (c) 2007-2015 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + + +#ifndef FIM_VIEWPORT_H +#define FIM_VIEWPORT_H + +#include "fim.h" +#include "FimWindow.h" // Rect +#include "DisplayDevice.h" + +namespace fim +{ + /* + * A viewport displays one single image, so it contains the information + * relative to the way it is displayed. + * */ +#ifdef FIM_NAMESPACES +class Viewport:public Namespace,public ViewportState +#else /* FIM_NAMESPACES */ +class Viewport:public ViewportState +#endif /* FIM_NAMESPACES */ +{ + protected: + fim_bool_t psteps_; + DisplayDevice* displaydevice_; +#ifdef FIM_WINDOWS + const Rect&corners_; // TODO: for now, no reassignCorners, but this will have to place old reassignWindow). +#endif /* FIM_WINDOWS */ + Image *image_; // !! + CommandConsole &commandConsole; + public: + void reset(void); + void steps_reset(void); + + Viewport( //yes, horrible + CommandConsole &c + ,const Rect &rect + ); + + Viewport(const Viewport &v); + ~Viewport(void); + private: + Viewport& operator= (const Viewport&v); + fim_redraw_t redraw_; + public: + void should_redraw(enum fim_redraw_t sr = FIM_REDRAW_NECESSARY); + fim_bool_t need_redraw(void)const; + +#if 0 + int valid(void)const; +#endif + + /* viewport member functions */ + fim::string pan(const args_t &args); + fim::string pan(const fim_char_t*a1, const fim_char_t*a2); + bool place(const fim_pan_t px, const fim_pan_t py); + void setState(const ViewportState & viewportState); + void pan_up (fim_pan_t s=0); + void pan_down (fim_pan_t s=0); + void pan_right(fim_pan_t s=0); + void pan_left (fim_pan_t s=0); + bool onBottom(void)const; + bool onRight(void)const; + bool onLeft(void)const; + bool onTop(void)const; + + fim_coo_t xorigin(void); + fim_coo_t yorigin(void); + protected: + +// int redraw; // there is already an external one! + /* viewport member functions */ + public: + fim_coo_t viewport_width(void)const; + fim_coo_t viewport_height(void)const; + /* viewport member functions */ + void align(const char c); + + /* viewport member functions */ + bool display(void); + bool redisplay(void); + void null_display(void); + + void auto_width_scale(void); + void auto_height_scale(void); + + void setImage(fim::Image* ni); + void scale_fix_top_left(void); + const Image* c_getImage(void)const; + Image* getImage(void)const; + + void auto_scale(void); + void auto_scale_if_bigger(void); + + void free(void); + bool check_invalid(void)const; + bool check_valid(void)const; +#if 0 + int valid(void); +#endif + bool scrollforward(void); + void scale_position_magnify(fim_scale_t factor=FIM_CNS_SCALEFACTOR); + void scale_position_reduce(fim_scale_t factor=FIM_CNS_SCALEFACTOR); + void recenter_horizontally(void); + void recenter_vertically(void); + void recenter(void); + virtual size_t byte_size(void)const; + int snprintf_centering_info(char *str, size_t size)const; + void transform(bool mirror, bool flip); + void fs_ml_puts(const char *str, fim_int doclear); +}; +} +#endif /* FIM_VIEWPORT_H */ diff --git a/src/b2ba.c b/src/b2ba.c new file mode 100644 index 0000000..774ed65 --- /dev/null +++ b/src/b2ba.c @@ -0,0 +1,30 @@ +/* + (c) 2011-2016 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +#include +int main(int argc,char *argv[]) +{ + /* read binary data from stdin, dump a C array with byte data on stdout */ + unsigned char byte=0; + unsigned int bc=0; + printf("{\n"); + while(read(0,&byte,1)==1) + printf("0x%02x,%s",byte,(++bc)%16?"":"\n"); + printf("\n};\n"); + return 0; +} + diff --git a/src/common.cpp b/src/common.cpp new file mode 100644 index 0000000..a6dd1ca --- /dev/null +++ b/src/common.cpp @@ -0,0 +1,1019 @@ +/* $LastChangedDate: 2016-01-29 17:23:12 +0100 (Fri, 29 Jan 2016) $ */ +/* + common.cpp : Miscellaneous stuff.. + + (c) 2007-2016 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +// including fim.h poses incompatibilities with +//#include "fim.h" + +#include +#include "fim.h" +#include "fim_string.h" +#include "common.h" +#include +#include +#include /* gettimeofday */ +#if HAVE_SYS_RESOURCE_H +#include /* getrusage */ +#endif /* HAVE_SYS_RESOURCE_H */ + +#ifdef HAVE_GETLINE +#include /* getline : _GNU_SOURCE */ +#endif /* HAVE_GETLINE */ +#ifdef HAVE_WCHAR_H +#include +#endif /* HAVE_WCHAR_H */ +#ifdef HAVE_LIBGEN_H +#include +#endif /* HAVE_LIBGEN_H */ + +#define FIM_WANT_ZLIB 0 +/* #include */ /* useless as long as FIM_WANT_ZLIB is 0 */ + +/* +void fim_tolowers(fim_char_t *s) +{ + if(!s) + return; + for(;*s;++s) + *s=tolower(*s); +} + +void fim_touppers(fim_char_t *s) +{ + if(!s) + return; + for(;*s;++s) + *s=toupper(*s); +} +*/ + +fim::string fim_dirname(const fim::string & arg) +{ +#ifdef HAVE_LIBGEN_H + fim_char_t buf[FIM_PATH_MAX]; + strncpy(buf,arg.c_str(),FIM_PATH_MAX-1); + buf[FIM_PATH_MAX-1]='\0'; + return dirname(buf); +#else /* HAVE_LIBGEN_H */ + return "";//FIXME +#endif /* HAVE_LIBGEN_H */ +} + fim::string fim_shell_arg_escape(const fim::string & arg) + { + // FIXME: this escaping function is NOT safe; this code shall only serve as a placeholder for a better one. + fim::string ear=arg; + fim::string res=FIM_CNS_EMPTY_STRING; + res+="'"; + ear.substitute("'","'\\''"); + res+=ear; + res+="'"; + return res; + } + +void fim_perror(const fim_char_t *s) +{ +#if 1 + if(errno) + { + if(s) + perror(s); + errno=0; // shall reset the error status + } +#endif +} + +size_t fim_strlen(const fim_char_t *str) +{ + return strlen(str); +} + +void trhex(fim_char_t *str) +{ + /* + * translates C-like hexcodes (e.g.: \xFF) to chars, in place. + * if \x is not followed by two hexadecimal values, it is ignored and silently copied. + * + * + * this function could be optimized. + * + * FIXME : UNUSED + */ + const fim_char_t *fp;//fast pointer + fim_char_t *sp;//slow pointer + fim_char_t hb[3]; + + if(!str) + goto ret; + + hb[2]=0; + fp=sp=str; + while(*fp) + { + if( + fp[0] =='\\' + && fp[1] && fp[1]=='x' + && fp[2] && isxdigit(toupper(fp[2])) + && fp[3] && isxdigit(toupper(fp[3])) ) + { + unsigned int hc; + hb[0]=toupper(fp[2]); + hb[1]=toupper(fp[3]); + hc=(fim_byte_t)strtol(hb,FIM_NULL,FIM_PRINTINUM_BUFSIZE); + *sp=hc; + fp+=3; + } + else + *sp=*fp; + ++fp; + ++sp; + } + *sp=0; +ret: + return; +} + +void trec(fim_char_t *str,const fim_char_t *f,const fim_char_t*t) +{ + /* this function translates escaped characters at index i in + * f into the characters at index i in t. + * + * order is not important for the final effect. + * + * this function could be optimized. + * 20090520 hex translation in + */ + int tl; + fim_char_t*_p=FIM_NULL; + const fim_char_t *fp; + const fim_char_t *tp; + + if(!str || !f || !t || strlen(f)-strlen(t)) + goto ret; + + tl = strlen(f);//table length + _p=str; + + while(*_p && _p[1])//redundant ? + { + fp=f; + tp=t; + +#if 1 + if( + _p[0] =='\\' + && _p[1] && _p[1]=='x' + && _p[2] && isxdigit(toupper(_p[2])) + && _p[3] && isxdigit(toupper(_p[3])) ) + { + unsigned int hc; + fim_char_t hb[3]; + fim_char_t *pp; + hb[2]=0; + hb[0]=toupper(_p[2]); + hb[1]=toupper(_p[3]); + hc=(fim_byte_t)strtol(hb,FIM_NULL,FIM_PRINTINUM_BUFSIZE); + *_p=hc; + /* + \xFF + ^-_p^-_p+4 + */ + pp=_p+4; + while(*pp){pp[-3]=*pp;++pp;} + pp[-3]='\0'; + } + else +#endif + while(*fp) + { + // if the following charcter is backslash-escaped and is in our from-list .. + if( *_p == '\\' && *(_p+1) == *fp ) + { + fim_char_t*pp; + *_p = *tp;//translation + ++_p; //new focus + pp=_p+1; + while(*pp) + { + pp[-1]=*pp;++pp; + }//!*pp means we are done :) + pp[-1]='\0'; + //if(*_p=='\\')++_p;//we want a single pass +// if(*_p)++_p;//we want a single pass // ! BUG + fp=f+tl;// in this way *(fp) == '\0' (single translation pass) as soon as we continue + if(!*_p) + goto ret; + --_p;//note that the outermost loop will increment this anyway + continue;//we jump straight to while(NUL) + } + ++fp;++tp; + } + ++_p; + } +ret: + return; +} + + fim_byte_t* slurp_binary_FD(FILE* fd, size_t *rs) + { + /* + * ripped off quickly from slurp_binary_fd + * FIXME : it is not throughly tested + * */ + fim_byte_t *buf=FIM_NULL; + int inc=FIM_FILE_BUF_SIZE,rb=0,nrb=0; + buf=(fim_byte_t*)fim_calloc(inc,1); + if(!buf) + goto ret; + while((nrb=fim_fread(buf+rb,1,inc,fd))>0) + { + fim_byte_t *tb; + // if(nrb==inc) a full read. let's try again + // else we assume this is the last read (could not be true, of course) + tb=(fim_byte_t*)realloc(buf,rb+=nrb); + if(tb!=FIM_NULL) + buf=tb; + else + {rb-=nrb;continue;} + } + if(rs) + { + *rs=rb; + } +ret: + return buf; + } + + fim_char_t* slurp_binary_fd(int fd,int *rs) + { + /* + * If badly tuned, this code is a true allocator grinder :) + * + * slurps a binary file (possibly a stream) and returns the allocated memory. + * + * FIXME : use stat if possible. + * FIXME : it is not throughly tested + * */ + fim_char_t *buf=FIM_NULL; + int inc=FIM_FILE_BUF_SIZE,rb=0,nrb=0; + buf = fim_stralloc(inc); + if(!buf) + goto ret; + while((nrb=read(fd,buf+rb,inc))>0) + { + fim_char_t *tb; + // if(nrb==inc) a full read. let's try again + // else we assume this is the last read (could not be true, of course) + tb=(fim_char_t*)realloc(buf,rb+=nrb); + if(tb!=FIM_NULL) + buf=tb; + else + {rb-=nrb;continue;} + } + if(rs) + *rs=rb; +ret: + return buf; + } + + fim::string slurp_file(fim::string filename) + { + std::string file; + std::ifstream fs; + fs.open(filename.c_str(),std::ios::binary); + if(fs.is_open()) + { + std::string tmp; + /* FIXME : this is not efficient */ + while(!fs.eof()) + { + getline(fs,tmp); + tmp+="\n" ; + file+=tmp; + } + // printf("%s\n",file.c_str()); + } + fs.close(); + return fim::string(file.c_str()); + } + +#if 0 + void append_to_file(fim::string filename, fim::string lines) + { + std::ofstream fs; + fs.open(filename.c_str(),std::ios::app|std::ios::binary); + if(fs.is_open()) + { + fs << "\""<< lines.c_str()<<"\"" ; + } + fs.close(); + sync(); + } +#endif + +/* + * Turns newline characters in NULs. + * Does stop on the first NUL encountered. + */ +void chomp(fim_char_t *s) +{ + for(;*s;++s) + if(*s=='\n') + *s='\0'; +} + +/* + * cleans the input string terminating it when some non printable character is encountered + * (except newline) + * */ +void sanitize_string_from_nongraph_except_newline(fim_char_t *s, int c) +{ + int n=c; + if(s) + while(*s && (c--||!n)) + if(!isgraph(*s)&&*s!='\n') + { + *s=' '; + ++s; + } + else + ++s; + return; +} + +/* + * cleans the input string terminating it when some non printable character is encountered + * */ +void sanitize_string_from_nongraph(fim_char_t *s, int c) +{ + int n=c; + if(s) + while(*s && (c--||!n)) + if(!isgraph(*s)||*s=='\n') + { + *s=' '; + ++s; + } + else + ++s; + return; +} + +/* + * Allocation of a small string for storing the + * representation of a double. + */ +fim_char_t * dupnstr (float n, const fim_char_t c) +{ + //allocation of a single string + fim_char_t *r = (fim_char_t*) fim_malloc (32); + if(!r){/*assert(r);*/throw FIM_E_NO_MEM;} + sprintf(r,"%f%c",n,c); + return (r); +} + +fim_char_t * dupnstr (const fim_char_t c1, double n, const fim_char_t c2) +{ + //allocation of a single string + fim_char_t *r = (fim_char_t*) fim_malloc (32); + if(!r){/*assert(r);*/throw FIM_E_NO_MEM;} + sprintf(r,"%c%f%c",c1,n,c2); + return (r); +} + +/* + * Allocation of a small string for storing the * representation of an integer. + */ +fim_char_t * dupnstr (fim_int n) +{ + //allocation of a single string + fim_char_t *r = (fim_char_t*) fim_malloc (FIM_PRINTINUM_BUFSIZE); + if(!r){/*assert(r);*/throw FIM_E_NO_MEM;} + if(sizeof(fim_int)==sizeof(int)) + sprintf(r,"%d",(int)n); + else + sprintf(r,"%lld",(long long int)n); + return (r); +} + +/* + * Allocation and duplication of a single string + */ +fim_char_t * dupstr (const fim_char_t* s) +{ + fim_char_t *r = (fim_char_t*) fim_malloc (strlen (s) + 1); + if(!r){/*assert(r);*/throw FIM_E_NO_MEM;} + strcpy (r, s); + return (r); +} + +/* + * Allocation and duplication of a single string, slash-quoted + */ +fim_char_t * dupsqstr (const fim_char_t* s) +{ + int l=0; + fim_char_t *r = (fim_char_t*) fim_malloc ((l=strlen (s)) + 3); + if(!r){/*assert(r);*/throw FIM_E_NO_MEM;} + else + { + r[0]='/'; + strcpy (r+1 , s); + strcat (r+1+l,"/"); + } + return (r); +} + +/* + * Allocation and duplication of a single string (not necessarily terminating) + */ +#ifdef HAVE_FGETLN +static fim_char_t * dupstrn (const fim_char_t* s, size_t l) +{ + fim_char_t *r = (fim_char_t*) fim_malloc (l + 1); + strncpy(r,s,l); + r[l]='\0'; + return (r); +} +#endif /* HAVE_FGETLN */ + +static int pick_word(const fim_char_t *f, unsigned int *w) +{ + /* + FIXME : what is this ? :) + */ + int fd = open(f,O_RDONLY); + if(fd==-1) + goto ret; + if(read(fd,w,sizeof(int))==sizeof(int)) + fd=0; +ret: + return fd; +} + +/* + * Will be improved, if needed. + * */ +fim_int fim_rand(void) +{ + /* + * Please don't use Fim random numbers for cryptographical purposes ;) + * Note that we use /dev/urandom because it will never block on reading. + * Reading from /dev/random could instead block. + * */ + unsigned int w,r; + if(pick_word(FIM_LINUX_RAND_FILE,&w)==0) + r = (w%RAND_MAX);// TODO: are we sure that RAND_MAX corresponds to FIM_LINUX_RAND_FILE ? + else + { + srand(clock()); + r = rand(); + } + return (fim_int) r; /* FIXME: shall document this limitation */ +} + + bool regexp_match(const fim_char_t*s, const fim_char_t*r, int ignorecase, int ignorenewlines) + { + /* + * given a string s, and a Posix regular expression r, this + * member function returns true if there is match. false otherwise. + */ + regex_t regex; //should be static!!! + const int nmatch=1; // we are satisfied with the first match, aren't we ? + regmatch_t pmatch[nmatch]; + bool match=true; + + /* + * we allow for the default match, in case of null regexp + */ + if(!r || !strlen(r)) + goto ret; + + /* fixup code for a mysterious bug + */ + if(*r=='*') + { + match = false; + goto ret; + } + + if(ignorenewlines) + { + fim::string aux; + aux=s; + } + + //if(regcomp(®ex,"^ \\+$", 0 | REG_EXTENDED | REG_ICASE )!=0) + if(regcomp(®ex,r, 0 | REG_EXTENDED | (ignorecase==0?0:REG_ICASE) )!=0) + { + /* error calling regcomp (invalid regexp?)! (should we warn the user ?) */ + //cout << "error calling regcomp (invalid regexp?)!" << "\n"; + return false; + } + else + { +// cout << "done calling regcomp!" << "\n"; + } + //if(regexec(®ex,s+0,nmatch,pmatch,0)==0) + if(regexec(®ex,s+0,nmatch,pmatch,0)!=REG_NOMATCH) + { +// cout << "'"<< s << "' matches with '" << r << "'\n"; +/* cout << "match : " << "\n"; + cout << "\""; + for(int m=pmatch[0].rm_so;m \0 + * next_row("123\n4") -> 4 + * next_row("12") -> \0 + * next_row("1234") -> 4 + * */ + const fim_char_t *b=s;int l=strlen(s); + if(!s) + return FIM_NULL; + if((s=strchr(s,'\n'))!=FIM_NULL) + { + // we have a newline marking the end of line: + // with newline-column merge (*s==\n and s+1 is after) + if((s-b)<=cols) + return s+1; + // ... or without merge (b[cols]!=\n and belongs to the next line) + else + return b+=cols; + } + return b+(l>=cols?cols:l);// no newlines in this string; we return the cols'th character or the NUL +} + +int lines_count(const fim_char_t*s, int cols) +{ + /* for cols=6 + * + * "" 0 + * "aab" 0 + * "aaaaba\nemk" 1 + * "aaaaba\nemk\n" 2 + * "aaaabaa\nemk\n" 3 + * */ + if(cols<=0) + return -1; + if(cols==0) + return newlines_count(s); + + int n=0; + const fim_char_t*b; + if(!s) + return 0; + b=s; + while((s=strchr(s,'\n'))!=FIM_NULL && *s) + { + /* + * we want a cols long sequence followed by \n + * to be counted as one line, just as cols chars alone. + * + * moreover, we want to be able to enter in this body + * even if *++s is NUL, just to perform this computation. + */ + n+=s>b?(s-1-b)/cols:0; /* extra lines due to the excessive line width (if s==b we can't expect any wrapping, of course ) */ + ++n; // the \n is counted as a new line + b=++s; // if now *s==NUL, strchr simply will fail + }; + //printf("n:%d\n",n); + s=b;//*b==NUL or *b points to the last substring non newline terminated + n+=(strlen(s))/cols; // we count the last substring chars (with no wrapping exceptions) + return n; +} + +int fim_common_test(void) +{ + /* + * this function should test the correctness of the functions in this file. + * it should be used for debug purposes, for Fim maintainance. + * */ + printf("%d\n",0==lines_count("" ,6)); + printf("%d\n",0==lines_count("aab" ,6)); + printf("%d\n",1==lines_count("aaaaba\nemk" ,6)); + printf("%d\n",2==lines_count("aaaaba\nemk\n" ,6)); + printf("%d\n",3==lines_count("aaaabaa\nemk\n" ,6)); + printf("%d\n",*next_row("123\n",3)=='\0'); + printf("%d\n",*next_row("123\n4",3)=='4'); + printf("%d\n",*next_row("12",3)=='\0'); + printf("%d\n",*next_row("1234",3)=='4'); + return 0; +} + +int swap_bytes_in_int(int in) +{ + // to Most Significant Byte First + // FIXME : this function should be optimized + int out=0; + int b=sizeof(int),i=-1; + while(i++0 ) + { + wc=fwrite(buf,1,rc,tfd); + if(wc!=rc) + { + /* FIXME : this error condition should be handled, as this mechanism is very brittle */ + // std::cerr << "fwrite error writing to tmpfile()!\n"; + } + } + rewind(tfd); + if(errno) + { + // FIXME: need to handle errors properly. + std::cout << "Error while reading temporary file: errno has now value "<1024) + d*=FIM_CNS_K,u='K',b='B'; + if(q/d>1024) + d*=FIM_CNS_K,u='M'; + if(q/d>1024) + d*=FIM_CNS_K,u='G'; +#if (SIZEOF_SIZE_T > 4) + if(q/d>1024) + d*=FIM_CNS_K,u='T'; + if(q/d>1024) + d*=FIM_CNS_K,u='P'; +#endif + if(q/d<10) + src = snprintf(str, size, "%1.1f%c%c",((float)q)/((float)d),u,b); + else + src = snprintf(str, size, "%zd%c%c",q/d,u,b); + return src; +} + +fim_byte_t * fim_pm_alloc(unsigned int width, unsigned int height, bool want_calloc) +{ + size_t nmemb=1, size=1; + nmemb *= width; + nmemb *= height; + nmemb *= 3; + /* FIXME: shall implement overflow checks here */ + if(want_calloc) + return (fim_byte_t*)fim_calloc(nmemb, 1); + else + return (fim_byte_t*)fim_malloc(nmemb); +} + +const fim_char_t * fim_basename_of(const fim_char_t * s) +{ + if(s && *s) + { +#if 0 + size_t sl = strlen(s); + + while(sl > 0 ) + { + sl--; + if(s[sl]=='/') + return s+sl+1; + } +#else + const fim_char_t *bn = strrchr(s,'/'); + if(bn) + s=bn+1; +#endif + } + return s; +} + +fim_int fim_atoi(const char*s) +{ + if(sizeof(fim_int)==sizeof(int)) + return atoi(s); + else + return atoll(s); +} + +size_t fim_maxrss(void) +{ +#if HAVE_SYS_RESOURCE_H + struct rusage usage; + int gru = getrusage(RUSAGE_SELF,&usage); + // printf("ru_maxrss: %ld (maximum resident set size -- MB)\n",usage.ru_maxrss / 1024); + // return quantity in B + return usage.ru_maxrss * 1024; +#else /* HAVE_SYS_RESOURCE_H */ + return 0; +#endif /* HAVE_SYS_RESOURCE_H */ +} + diff --git a/src/common.h b/src/common.h new file mode 100644 index 0000000..7e49de6 --- /dev/null +++ b/src/common.h @@ -0,0 +1,115 @@ +/* $LastChangedDate: 2015-12-14 23:54:53 +0100 (Mon, 14 Dec 2015) $ */ +/* + common.h : Miscellaneous stuff header file + + (c) 2007-2015 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +#ifndef FIM_COMMON_H +#define FIM_COMMON_H +#undef yyFlexLexer +#include +#include "fim_types.h" +extern int fim_pipedesc[2]; + +extern FlexLexer *lexer; +//#define YYLEX lexer->yylex() +namespace fim +{ + class CommandConsole; + class string; +} + +int fim_isspace(int c); +int fim_isquote(int c); + +fim::string fim_dirname(const fim::string & arg); +fim::string fim_shell_arg_escape(const fim::string & arg); +void fim_perror(const fim_char_t *s); +//void fim_tolowers(fim_char_t *s); +//void fim_touppers(fim_char_t *s); +size_t fim_strlen(const fim_char_t *str); +void trec(fim_char_t *str,const fim_char_t *f,const fim_char_t*t); +void trhex(fim_char_t *str); +void chomp(fim_char_t *s); +void sanitize_string_from_nongraph(fim_char_t *s, int c=0); +void sanitize_string_from_nongraph_except_newline(fim_char_t *s, int c=0); + +using namespace fim; + +int int2msbf(int in); +int int2lsbf(int in); +fim::string slurp_file(fim::string filename); +fim_char_t* slurp_binary_fd(int fd,int *rs); +fim_byte_t* slurp_binary_FD(FILE* fd, size_t *rs); +#if 0 +void append_to_file(fim::string filename, fim::string lines); +#endif + +fim_char_t * dupstr (const fim_char_t* s); +fim_char_t * dupnstr (float n, const fim_char_t c='\0'); +fim_char_t * dupnstr (const fim_char_t c1, double n, const fim_char_t c2='\0'); +fim_char_t * dupnstr (fim_int n); +fim_char_t * dupsqstr (const fim_char_t* s); +fim_int fim_rand(void); + +bool regexp_match(const fim_char_t*s, const fim_char_t*r, int ignorecase=1, int ignorenewlines=0); + +int strchr_count(const fim_char_t*s, int c); +int lines_count(const fim_char_t*s, int cols); +int newlines_count(const fim_char_t*s); +const fim_char_t* next_row(const fim_char_t*s, int cols); +int fim_common_test(void); + +double getmilliseconds(void); +const fim_char_t * fim_getenv(const fim_char_t * name); +FILE * fim_fread_tmpfile(FILE * fp); +double fim_atof(const fim_char_t *nptr); +ssize_t fim_getline(fim_char_t **lineptr, size_t *n, FILE *stream); + +bool is_dir(const fim::string nf); +bool is_file(const fim::string nf); +bool is_file_nonempty(const fim::string nf); +FILE *fim_fopen(const char *path, const char *mode); +int fim_fclose(FILE*fp); +size_t fim_fread(void *ptr, size_t size, size_t nmemb, FILE *stream); +int fim_rewind(FILE *stream); +int fim_fseek(FILE *stream, long offset, int whence); +int fim_fgetc(FILE *stream); +int fim_snprintf_XB(char *str, size_t size, size_t q); +fim_byte_t * fim_pm_alloc(unsigned int width, unsigned int height, bool want_calloc = false); +const fim_char_t * fim_basename_of(const fim_char_t * s); +fim_int fim_atoi(const char*s); +size_t fim_maxrss(void); + +/* exceptions */ +typedef int FimException; +#define FIM_E_NO_IMAGE 1 +#define FIM_E_NO_VIEWPORT 2 +#define FIM_E_WINDOW_ERROR 3 +#define FIM_E_TRAGIC -1 /* no hope */ +#define FIM_E_NO_MEM 4 /* also a return code */ +/* ... */ + +#define FIM_CHAR_BIT 8 /* FIXME */ +#define FIM_IS_SIGNED(T) (((T)0) > (((T)-1))) +#define FIM_MAX_UNSIGNED(T) ((T)-1) +#define FIM_HALF_MAX_SIGNED(T) ((T)1 << (sizeof(T)*FIM_CHAR_BIT-2)) +#define FIM_MAX_SIGNED(T) (FIM_HALF_MAX_SIGNED(T) - 1 + FIM_HALF_MAX_SIGNED(T)) +#define FIM_MAX_VALUE_FOR_TYPE(T) (FIM_IS_SIGNED(T)?FIM_MAX_SIGNED(T):FIM_MAX_UNSIGNED(T)) +#define FIM_MAX_INT FIM_MAX_VALUE_FOR_TYPE(fim_int) + +#endif /* FIM_COMMON_H */ diff --git a/src/defaultConfiguration.cpp b/src/defaultConfiguration.cpp new file mode 100644 index 0000000..7873448 --- /dev/null +++ b/src/defaultConfiguration.cpp @@ -0,0 +1,166 @@ +/* $LastChangedDate: 2016-03-06 15:30:49 +0100 (Sun, 06 Mar 2016) $ */ +/* + defaultConfiguration.cpp : + The following code contains key bindings and aliases definitions + which make up a first usable configuration for FIM. + + (c) 2007-2015 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +#if FIM_DEFAULT_CONFIG +#if 1 + alias(FIM_FLA_MAGNIFY,FIM_FLC_MAGNIFY,"magnify the displayed image by the " FIM_VID_MAGNIFY_FACTOR " variable or " FIM_CNS_EX_ARGS_STRING ""); + alias(FIM_FLA_REDUCE ,FIM_FLC_REDUCE,"reduce the displayed image by " FIM_VID_REDUCE_FACTOR " or " FIM_CNS_EX_ARGS_STRING ""); + alias(FIM_FLA_NEXT,FIM_FLC_NEXT,"go to the next page or picture file"); + alias(FIM_FLA_PREV,FIM_FLC_PREV,"go to the previous page or picture file"); + alias(FIM_FLA_NEXT_PAGE,FIM_FLC_NEXT_PAGE,"go to the next page in the file"); + alias(FIM_FLA_PREV_PAGE,FIM_FLC_PREV_PAGE,"go to the previous page in the file"); + alias(FIM_FLA_NEXT_FILE,FIM_FLC_NEXT_FILE,"go to the next file in the list"); + alias(FIM_FLA_PREV_FILE,FIM_FLC_PREV_FILE,"go to the previous file in the list"); +#endif +#if 1 + alias("scale_factor_grow","scale '+*'","multiply the scale factors " FIM_VID_REDUCE_FACTOR " and " FIM_VID_MAGNIFY_FACTOR " by " FIM_VID_SCALE_FACTOR_MULTIPLIER ""); + alias("scale_factor_shrink","scale '+/'","divide the scale factors " FIM_VID_REDUCE_FACTOR " and " FIM_VID_MAGNIFY_FACTOR " by " FIM_VID_SCALE_FACTOR_MULTIPLIER ""); + alias("scale_factor_decrease","scale '+-'","subtract " FIM_VID_SCALE_FACTOR_DELTA " to the scale factors " FIM_VID_REDUCE_FACTOR " and " FIM_VID_MAGNIFY_FACTOR ""); + alias("scale_factor_increase","scale '++'","add " FIM_VID_SCALE_FACTOR_DELTA " to the scale factors " FIM_VID_REDUCE_FACTOR " and " FIM_VID_MAGNIFY_FACTOR ""); + alias('A',"'" FIM_VID_AUTOTOP "=1-" FIM_VID_AUTOTOP ";'"); +#endif +#if 0 + alias('A',"'autotop=1-autotop;'"); + alias("toggleVerbosity","verbose=1-verbose;display;"); + alias("toggleKeyVerbosity","_verbose_keys=1-_verbose_keys;display;"); +#endif +#if 0 + bind('h',FIM_FLT_HELP); + bind('p',"prev;display;"); + bind('r',FIM_FLT_RELOAD); + bind('R',FIM_FLT_REDISPLAY); + bind('m',FIM_FLC_MIRROR); + bind('f',FIM_FLC_FLIP); + bind(4283163,"pan 'up'"); + bind(4414235,"pan 'right'"); + bind(4348699,"pan 'down'"); + bind(4479771,"pan 'left'"); + bind(' ',FIM_FLT_SCROLLDOWN); + bind(2117491483,"next"); + bind(2117425947,"prev"); + bind('i',FIM_FLT_INFO); +#endif +#if 1 + bind('q',FIM_FLT_QUIT); + bind('n',FIM_FLC_NEXT_FILE); + bind('p',FIM_FLC_PREV_FILE); + bind('d',FIM_FLT_DISPLAY); + bind('+',FIM_FLA_MAGNIFY); + bind('-',FIM_FLA_REDUCE); + bind('k',FIM_FLC_PAN_UP); + bind('l',FIM_FLC_PAN_RIGHT); + bind('j',FIM_FLC_PAN_DOWN); + bind('h',FIM_FLC_PAN_LEFT); + bind(29,"scale_factor_increase"); + bind(31,"scale_factor_decrease"); + bind(29,"scale_factor_grow"); + bind(31,"scale_factor_shrink"); +#endif +#if 1 + setVariable(FIM_VID_CONSOLE_KEY,(fim_int)FIM_SYM_CONSOLE_KEY); + setVariable(FIM_VID_PUSH_PUSHES_DIRS,(fim_int)1); +#endif +#if 0 + setVariable(FIM_VID_REDUCE_FACTOR,FIM_CNS_SCALEFACTOR); + setVariable(FIM_VID_MAGNIFY_FACTOR,FIM_CNS_SCALEFACTOR); + setVariable(FIM_VID_SCALE_FACTOR_DELTA,FIM_CNS_SCALEFACTOR_DELTA); + setVariable(FIM_VID_VERBOSE_KEYS,-1); + setVariable(FIM_VID_MAGNIFY_FACTOR,FIM_CNS_SCALEFACTOR); + setVariable(FIM_VID_SCALE_FACTOR_MULTIPLIER,FIM_CNS_SCALEFACTOR_MULTIPLIER); +#endif +#endif +/* + * The following code binds key codes to key symbols. + * In this way the user can write a configuration file + * and associate actions to key configurations.. + * + * Note : certain key bindings (especially Control key with arrows or other non letter keys ) are known to be non working. + * But by modifying this file one may experiment! + */ +#if FIM_DEFAULT_KEY_CONFIG + /* + * Standard key configuration + */ + fim_char_t k[4];k[1]='\0'; + + /* 97=0x61 to 122=0x7A */ + for(fim_char_t i='a';i<='z';++i) *k=i, sym_keys_[k]=i; + + /* 65=0x41 to 90=0x5A (shifted keys) */ + for(fim_char_t i='A';i<='Z';++i) *k=i, sym_keys_[k]=i; + + /* 32=0x20 to 65=0x40 */ + for(fim_char_t i=' ';i<='@';++i) *k=i, sym_keys_[k]=i; + + /* 91=0x5B to 96=0x60 */ + for(fim_char_t i='[';i<'a';++i) *k=i, sym_keys_[k]=i; + + /* 123=0x7B to 127=0x7F (DEL) */ + for(fim_key_t i='{';i<=126;++i) *k=fim_char_t(i), sym_keys_[k]=(fim_char_t)i; + // A note : DEL is not captured by the above configuration. + + /* + * Control keys handling + */ + k[0]='C'; k[1]='-'; k[3]='\0'; + //problem : no uppercase with control.sorry. + for(fim_key_t i='a';i<='j';++i) k[2]=fim_char_t(i), sym_keys_[k]=((i-'a')+1); + for(fim_key_t i='k';i<='z';++i) k[2]=fim_char_t(i), sym_keys_[k]=((i-'a')+1); + // for(fim_key_t i=' ';i<='?';++i) k[2]=fim_char_t(i), sym_keys_[k]=( i+1)-'a' ; + + /* + * The following bindings are known to be useless or bugful. + */ + /* + for(fim_char_t i='[';i<'a';++i,k[2]=i) sym_keys_[k]=(i+1); + for(int i='{';i<=127;++i,k[2]=(fim_char_t)i) sym_keys_[k]=(i+1)(fim_char_t)i; + */ + + /* + * The following means that when a decimal 4479771 will be read from + * the keyboard, it will be interpreted as a Left pressure. + */ + sym_keys_[FIM_KBD_LEFT]=4479771; + // and so on.. + sym_keys_[FIM_KBD_RIGHT]=4414235; + sym_keys_[FIM_KBD_UP]=4283163; + sym_keys_[FIM_KBD_DOWN]=4348699; + sym_keys_[FIM_KBD_PAGEDOWN]=2117491483; + sym_keys_[FIM_KBD_PAGEUP]=2117425947; + sym_keys_[FIM_KBD_ENTER]=10; + sym_keys_[FIM_KBD_BACKSPACE_]=127; + sym_keys_[FIM_KBD_BACKSPACE]=127; + sym_keys_[FIM_KBD_DEL]=2117294875; + sym_keys_[FIM_KBD_INS]=2117229339; + sym_keys_[FIM_KBD_HOME]=2117163803; + sym_keys_[FIM_KBD_END] =2117360411; + sym_keys_[FIM_KBD_TAB] =9; + sym_keys_[FIM_KBD_ANY] =0; /* EXPERIMENTAL */ + sym_keys_[FIM_KBD_ESC] =27; + + exitBinding_ = sym_keys_[FIM_KBD_ENTER]; /* Enter will terminate loops */ +// sym_keys_[" "]=' '; +// sym_keys_["."]='.'; +// sym_keys_[","]=','; +// + cc.key_syms_update(); +#endif diff --git a/src/default_font_byte_array.h b/src/default_font_byte_array.h new file mode 100644 index 0000000..9517901 --- /dev/null +++ b/src/default_font_byte_array.h @@ -0,0 +1,349 @@ +{ +0x36,0x04,0x02,0x10,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55, +0xaa,0x55,0xaa,0x55,0x00,0x00,0x00,0x7e,0x81,0x99,0xa5,0xa1,0xa5,0x99,0x81,0x7e, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7e,0x81,0xb9,0xa5,0xb9,0xa9,0xa5,0x81,0x7e, +0x00,0x00,0x00,0x00,0x00,0x00,0xfb,0x55,0x55,0x51,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x24,0x20,0x20,0x78,0x20,0x20,0x20,0x22,0x7e, +0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x54,0x38,0x10, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x40,0xfe,0x40,0x20,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x04,0xfe,0x04,0x08,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x38,0x54,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x00,0x00,0x00,0x00,0x88,0x22,0x88,0x22,0x88,0x22,0x88,0x22,0x88,0x22,0x88,0x22, +0x88,0x22,0x88,0x22,0x00,0x00,0x00,0x00,0x00,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x00, +0x00,0x00,0x00,0x00,0x00,0x18,0x24,0x24,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x38,0x7c,0xfe,0x7c,0x38,0x10,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x00,0x7c, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7e,0x42,0x42,0x42,0x42,0x42,0x42, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x08,0x10,0x20,0x10,0x08,0x04,0x00,0x3e, +0x00,0x00,0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xf0,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x7c,0x10,0x10,0x00,0x7c, +0x00,0x00,0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xf0,0x10,0x10,0x10,0x10, +0x10,0x10,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x10,0x10,0x10,0x10, +0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x10,0x10,0x10,0x00,0x00,0x10,0x10,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x7c,0x92,0x90,0x90,0x90,0x92,0x7c, +0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x44,0x38,0x44,0x44,0x44,0x38,0x44,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x82,0x82,0x44,0x28,0x10,0x7c,0x10,0x7c,0x10,0x10, +0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x10,0x10,0x00,0x00,0x10,0x10,0x10,0x10, +0x00,0x00,0x00,0x00,0x00,0x38,0x44,0x40,0x30,0x48,0x44,0x44,0x24,0x18,0x04,0x44, +0x38,0x00,0x00,0x00,0x24,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x38,0x04,0x3c,0x44,0x3c,0x00,0x7c,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x12,0x24,0x48,0x90,0x48,0x24,0x12, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7e,0x02,0x02,0x02,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x10,0x10, +0x00,0x00,0x00,0x00,0x00,0x24,0x24,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x24,0x24,0x24,0x7e,0x24,0x24,0x7e,0x24,0x24,0x24, +0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x7c,0x92,0x90,0x90,0x7c,0x12,0x12,0x92,0x7c, +0x10,0x10,0x00,0x00,0x00,0x00,0x64,0x94,0x68,0x08,0x10,0x10,0x20,0x2c,0x52,0x4c, +0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x24,0x24,0x18,0x30,0x4a,0x44,0x44,0x44,0x3a, +0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x10,0x20,0x20,0x20,0x20,0x20,0x20,0x10,0x08, +0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x10,0x08,0x08,0x08,0x08,0x08,0x08,0x10,0x20, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x24,0x18,0x7e,0x18,0x24,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x7c,0x10,0x10,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10, +0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7e,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10, +0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40, +0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x42,0x42,0x46,0x4a,0x52,0x62,0x42,0x42,0x3c, +0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x18,0x28,0x08,0x08,0x08,0x08,0x08,0x08,0x3e, +0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x42,0x42,0x02,0x04,0x08,0x10,0x20,0x40,0x7e, +0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x42,0x42,0x02,0x1c,0x02,0x02,0x42,0x42,0x3c, +0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x06,0x0a,0x12,0x22,0x42,0x7e,0x02,0x02,0x02, +0x00,0x00,0x00,0x00,0x00,0x00,0x7e,0x40,0x40,0x40,0x7c,0x02,0x02,0x02,0x42,0x3c, +0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0x20,0x40,0x40,0x7c,0x42,0x42,0x42,0x42,0x3c, +0x00,0x00,0x00,0x00,0x00,0x00,0x7e,0x02,0x02,0x04,0x04,0x08,0x08,0x10,0x10,0x10, +0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x42,0x42,0x42,0x3c,0x42,0x42,0x42,0x42,0x3c, +0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x42,0x42,0x42,0x42,0x3e,0x02,0x02,0x04,0x38, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x00,0x00,0x00,0x10,0x10, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x00,0x00,0x00,0x10,0x10, +0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7e,0x00,0x00,0x7e,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x40, +0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x42,0x42,0x42,0x04,0x08,0x08,0x00,0x08,0x08, +0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0x82,0x9e,0xa2,0xa2,0xa2,0xa6,0x9a,0x80,0x7e, +0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x42,0x42,0x42,0x42,0x7e,0x42,0x42,0x42,0x42, +0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0x42,0x42,0x42,0x7c,0x42,0x42,0x42,0x42,0x7c, +0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x42,0x42,0x40,0x40,0x40,0x40,0x42,0x42,0x3c, +0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x44,0x42,0x42,0x42,0x42,0x42,0x42,0x44,0x78, +0x00,0x00,0x00,0x00,0x00,0x00,0x7e,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0x40,0x7e, +0x00,0x00,0x00,0x00,0x00,0x00,0x7e,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0x40,0x40, +0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x42,0x42,0x40,0x40,0x4e,0x42,0x42,0x42,0x3c, +0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x42,0x42,0x7e,0x42,0x42,0x42,0x42,0x42, +0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x38, +0x00,0x00,0x00,0x00,0x00,0x00,0x0e,0x04,0x04,0x04,0x04,0x04,0x04,0x44,0x44,0x38, +0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x44,0x48,0x50,0x60,0x60,0x50,0x48,0x44,0x42, +0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7e, +0x00,0x00,0x00,0x00,0x00,0x00,0x82,0xc6,0xaa,0x92,0x82,0x82,0x82,0x82,0x82,0x82, +0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x42,0x62,0x52,0x4a,0x46,0x42,0x42,0x42, +0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3c, +0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0x42,0x42,0x42,0x42,0x7c,0x40,0x40,0x40,0x40, +0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x4a,0x3c, +0x02,0x00,0x00,0x00,0x00,0x00,0x7c,0x42,0x42,0x42,0x42,0x7c,0x50,0x48,0x44,0x42, +0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x42,0x40,0x40,0x3c,0x02,0x02,0x42,0x42,0x3c, +0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3c, +0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x24,0x24,0x24,0x18,0x18, +0x00,0x00,0x00,0x00,0x00,0x00,0x82,0x82,0x82,0x82,0x82,0x82,0x92,0xaa,0xc6,0x82, +0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x24,0x24,0x18,0x18,0x24,0x24,0x42,0x42, +0x00,0x00,0x00,0x00,0x00,0x00,0x82,0x82,0x44,0x44,0x28,0x10,0x10,0x10,0x10,0x10, +0x00,0x00,0x00,0x00,0x00,0x00,0x7e,0x02,0x02,0x04,0x08,0x10,0x20,0x40,0x40,0x7e, +0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x38, +0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04, +0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x38, +0x00,0x00,0x00,0x00,0x00,0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x7e,0x00,0x00,0x10,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x02,0x3e,0x42,0x42,0x42,0x3e, +0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x7c,0x42,0x42,0x42,0x42,0x42,0x7c, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x42,0x40,0x40,0x40,0x42,0x3c, +0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x3e,0x42,0x42,0x42,0x42,0x42,0x3e, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x42,0x42,0x7e,0x40,0x40,0x3c, +0x00,0x00,0x00,0x00,0x00,0x00,0x0e,0x10,0x10,0x7c,0x10,0x10,0x10,0x10,0x10,0x10, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3e,0x42,0x42,0x42,0x42,0x42,0x3e, +0x02,0x02,0x3c,0x00,0x00,0x00,0x40,0x40,0x40,0x7c,0x42,0x42,0x42,0x42,0x42,0x42, +0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x38, +0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x00,0x0c,0x04,0x04,0x04,0x04,0x04,0x04, +0x44,0x44,0x38,0x00,0x00,0x00,0x40,0x40,0x40,0x42,0x44,0x48,0x70,0x48,0x44,0x42, +0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x38, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x92,0x92,0x92,0x92,0x92,0x92, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0x42,0x42,0x42,0x42,0x42,0x42, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x42,0x42,0x42,0x42,0x42,0x3c, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0x42,0x42,0x42,0x42,0x42,0x7c, +0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x3e,0x42,0x42,0x42,0x42,0x42,0x3e, +0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x5e,0x60,0x40,0x40,0x40,0x40,0x40, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3e,0x40,0x40,0x3c,0x02,0x02,0x7c, +0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x10,0x7c,0x10,0x10,0x10,0x10,0x10,0x0e, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x42,0x3e, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x42,0x24,0x24,0x18,0x18, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x82,0x82,0x92,0x92,0x92,0x92,0x7c, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x24,0x18,0x24,0x42,0x42, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x42,0x3e, +0x02,0x02,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x7e,0x04,0x08,0x10,0x20,0x40,0x7e, +0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x10,0x10,0x10,0x20,0x10,0x10,0x10,0x10,0x0c, +0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x08,0x08,0x08,0x04,0x08,0x08,0x08,0x08,0x30, +0x00,0x00,0x00,0x00,0x00,0x62,0x92,0x8c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x18,0x24,0x08,0x10,0x3c,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x38,0x04,0x18,0x04,0x38,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x08,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x46,0x7a, +0x40,0x40,0x40,0x00,0x00,0x00,0x7e,0x92,0x92,0x92,0x92,0x72,0x12,0x12,0x12,0x12, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x10,0x10,0x20,0x00,0x00,0x10,0x30,0x10,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x38,0x00,0x7c,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x90,0x48,0x24,0x12,0x24,0x48,0x90, +0x00,0x00,0x00,0x00,0x00,0x20,0x60,0x20,0x22,0x24,0x08,0x10,0x22,0x46,0x8a,0x1e, +0x02,0x02,0x00,0x00,0x00,0x20,0x60,0x20,0x22,0x24,0x08,0x10,0x20,0x4c,0x92,0x04, +0x08,0x1e,0x00,0x00,0x00,0xe0,0x10,0x60,0x12,0xe4,0x08,0x10,0x22,0x46,0x8a,0x1e, +0x02,0x02,0x00,0x00,0x00,0x00,0x10,0x10,0x00,0x10,0x10,0x20,0x42,0x42,0x42,0x3c, +0x00,0x00,0x00,0x00,0x10,0x08,0x00,0x3c,0x42,0x42,0x42,0x7e,0x42,0x42,0x42,0x42, +0x00,0x00,0x00,0x00,0x08,0x10,0x00,0x3c,0x42,0x42,0x42,0x7e,0x42,0x42,0x42,0x42, +0x00,0x00,0x00,0x00,0x18,0x24,0x00,0x3c,0x42,0x42,0x42,0x7e,0x42,0x42,0x42,0x42, +0x00,0x00,0x00,0x00,0x32,0x4c,0x00,0x3c,0x42,0x42,0x42,0x7e,0x42,0x42,0x42,0x42, +0x00,0x00,0x00,0x00,0x24,0x24,0x00,0x3c,0x42,0x42,0x42,0x7e,0x42,0x42,0x42,0x42, +0x00,0x00,0x00,0x00,0x18,0x24,0x18,0x3c,0x42,0x42,0x42,0x7e,0x42,0x42,0x42,0x42, +0x00,0x00,0x00,0x00,0x00,0x00,0x7e,0x90,0x90,0x90,0xfc,0x90,0x90,0x90,0x90,0x9e, +0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x42,0x42,0x40,0x40,0x40,0x40,0x42,0x42,0x3c, +0x10,0x10,0x20,0x00,0x10,0x08,0x00,0x7e,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0x7e, +0x00,0x00,0x00,0x00,0x08,0x10,0x00,0x7e,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0x7e, +0x00,0x00,0x00,0x00,0x18,0x24,0x00,0x7e,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0x7e, +0x00,0x00,0x00,0x00,0x24,0x24,0x00,0x7e,0x40,0x40,0x40,0x78,0x40,0x40,0x40,0x7e, +0x00,0x00,0x00,0x00,0x20,0x10,0x00,0x38,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x38, +0x00,0x00,0x00,0x00,0x08,0x10,0x00,0x38,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x38, +0x00,0x00,0x00,0x00,0x18,0x24,0x00,0x38,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x38, +0x00,0x00,0x00,0x00,0x44,0x44,0x00,0x38,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x38, +0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x44,0x42,0x42,0xf2,0x42,0x42,0x42,0x44,0x78, +0x00,0x00,0x00,0x00,0x32,0x4c,0x00,0x42,0x42,0x62,0x52,0x4a,0x46,0x42,0x42,0x42, +0x00,0x00,0x00,0x00,0x10,0x08,0x00,0x3c,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3c, +0x00,0x00,0x00,0x00,0x08,0x10,0x00,0x3c,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3c, +0x00,0x00,0x00,0x00,0x18,0x24,0x00,0x3c,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3c, +0x00,0x00,0x00,0x00,0x32,0x4c,0x00,0x3c,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3c, +0x00,0x00,0x00,0x00,0x24,0x24,0x00,0x3c,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3c, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x24,0x18,0x24,0x42,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x02,0x3a,0x44,0x46,0x4a,0x4a,0x52,0x52,0x62,0x22,0x5c, +0x40,0x00,0x00,0x00,0x10,0x08,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3c, +0x00,0x00,0x00,0x00,0x08,0x10,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3c, +0x00,0x00,0x00,0x00,0x18,0x24,0x00,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3c, +0x00,0x00,0x00,0x00,0x24,0x24,0x00,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3c, +0x00,0x00,0x00,0x00,0x08,0x10,0x82,0x82,0x44,0x44,0x28,0x10,0x10,0x10,0x10,0x10, +0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x7c,0x42,0x42,0x42,0x42,0x7c,0x40,0x40, +0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x44,0x44,0x48,0x7c,0x42,0x42,0x42,0x62,0x5c, +0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x08,0x00,0x3c,0x02,0x3e,0x42,0x42,0x42,0x3e, +0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x10,0x00,0x3c,0x02,0x3e,0x42,0x42,0x42,0x3e, +0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x24,0x00,0x3c,0x02,0x3e,0x42,0x42,0x42,0x3e, +0x00,0x00,0x00,0x00,0x00,0x00,0x32,0x4c,0x00,0x3c,0x02,0x3e,0x42,0x42,0x42,0x3e, +0x00,0x00,0x00,0x00,0x00,0x00,0x24,0x24,0x00,0x3c,0x02,0x3e,0x42,0x42,0x42,0x3e, +0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x24,0x18,0x3c,0x02,0x3e,0x42,0x42,0x42,0x3e, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6c,0x12,0x72,0x9e,0x90,0x90,0x6c, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x42,0x40,0x40,0x40,0x42,0x3c, +0x10,0x10,0x20,0x00,0x00,0x00,0x10,0x08,0x00,0x3c,0x42,0x42,0x7e,0x40,0x40,0x3c, +0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x10,0x00,0x3c,0x42,0x42,0x7e,0x40,0x40,0x3c, +0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x24,0x00,0x3c,0x42,0x42,0x7e,0x40,0x40,0x3c, +0x00,0x00,0x00,0x00,0x00,0x00,0x24,0x24,0x00,0x3c,0x42,0x42,0x7e,0x40,0x40,0x3c, +0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x10,0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x38, +0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x10,0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x38, +0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x48,0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x38, +0x00,0x00,0x00,0x00,0x00,0x00,0x48,0x48,0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x38, +0x00,0x00,0x00,0x00,0x00,0x00,0x28,0x10,0x28,0x3c,0x42,0x42,0x42,0x42,0x42,0x3c, +0x00,0x00,0x00,0x00,0x00,0x00,0x32,0x4c,0x00,0x7c,0x42,0x42,0x42,0x42,0x42,0x42, +0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x08,0x00,0x3c,0x42,0x42,0x42,0x42,0x42,0x3c, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x28,0x28,0x28,0x28,0x28,0x28,0xef,0x00,0xef,0x28,0x28,0x28, +0x28,0x28,0x28,0x28,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xff,0x10,0x10,0x10,0x10, +0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x1f,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0xff,0x10,0xff,0x10,0x10,0x10, +0x10,0x10,0x10,0x10,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x10,0x10,0x10,0x10, +0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x1f,0x10,0x10,0x10,0x10, +0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xff,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x10,0x10,0x10,0x10, +0x10,0x10,0x10,0x10,0x00,0x00,0x08,0x10,0x00,0x3c,0x42,0x42,0x42,0x42,0x42,0x3c, +0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x24,0x00,0x3c,0x42,0x42,0x42,0x42,0x42,0x3c, +0x00,0x00,0x00,0x00,0x00,0x00,0x32,0x4c,0x00,0x3c,0x42,0x42,0x42,0x42,0x42,0x3c, +0x00,0x00,0x00,0x00,0x00,0x00,0x24,0x24,0x00,0x3c,0x42,0x42,0x42,0x42,0x42,0x3c, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x00,0x7c,0x00,0x10,0x10,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x3c,0x46,0x4a,0x52,0x62,0x42,0xbc, +0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x08,0x00,0x42,0x42,0x42,0x42,0x42,0x42,0x3e, +0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x10,0x00,0x42,0x42,0x42,0x42,0x42,0x42,0x3e, +0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x24,0x00,0x42,0x42,0x42,0x42,0x42,0x42,0x3e, +0x00,0x00,0x00,0x00,0x00,0x00,0x24,0x24,0x00,0x42,0x42,0x42,0x42,0x42,0x42,0x3e, +0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x10,0x00,0x42,0x42,0x42,0x42,0x42,0x42,0x3e, +0x02,0x02,0x3c,0x00,0x00,0x00,0x40,0x40,0x40,0x7c,0x42,0x42,0x42,0x42,0x42,0x7c, +0x40,0x40,0x40,0x00,0x00,0x00,0x24,0x24,0x00,0x42,0x42,0x42,0x42,0x42,0x42,0x3e, +0x02,0x02,0x3c,0x00,0x24,0x18,0x00,0x3c,0x42,0x42,0x40,0x4e,0x42,0x42,0x42,0x3c, +0x00,0x00,0x00,0x00,0x00,0x00,0x24,0x18,0x00,0x3e,0x42,0x42,0x42,0x42,0x42,0x3e, +0x02,0x02,0x3c,0x00,0x10,0x10,0x00,0x38,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x38, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x38, +0x00,0x00,0x00,0x00,0x00,0x00,0x7e,0x90,0x90,0x90,0x9c,0x90,0x90,0x90,0x90,0x7e, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0x92,0x92,0x9e,0x90,0x90,0x7c, +0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x42,0x40,0x40,0x3c,0x02,0x02,0x42,0x42,0x3c, +0x10,0x10,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x3e,0x40,0x40,0x3c,0x02,0x02,0x7c, +0x10,0x10,0x20,0x00,0x24,0x18,0x00,0x3c,0x42,0x40,0x40,0x3c,0x02,0x02,0x42,0x3c, +0x00,0x00,0x00,0x00,0x00,0x00,0x24,0x18,0x00,0x3e,0x40,0x40,0x3c,0x02,0x02,0x7c, +0x00,0x00,0x00,0x00,0x44,0x44,0x00,0x82,0x82,0x44,0x44,0x28,0x10,0x10,0x10,0x10, +0x00,0x00,0x00,0x00,0x24,0x18,0x00,0x7e,0x02,0x04,0x08,0x10,0x20,0x40,0x40,0x7e, +0x00,0x00,0x00,0x00,0x00,0x00,0x24,0x18,0x00,0x7e,0x04,0x08,0x10,0x20,0x40,0x7e, +0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x12,0x10,0x10,0x7c,0x10,0x10,0x10,0x10,0x10, +0x10,0x90,0x60,0x00,0x18,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x32,0x4c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x08,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08, +0x10,0x00,0x00,0x00,0x00,0x12,0x24,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x12,0x12,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x24,0x24, +0x48,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x7c,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x7c,0x10,0x10,0x10,0x10,0x7c,0x10,0x10, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x3c,0x3c,0x18,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x92,0x92, +0x00,0x00,0x00,0x00,0x00,0x00,0x48,0xa8,0x50,0x10,0x20,0x20,0x40,0x54,0xaa,0x94, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x08,0x10,0x20,0x10,0x08,0x04, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x10,0x08,0x04,0x08,0x10,0x20, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0x22,0x40,0xf8,0x40,0xf8,0x40,0x22,0x1c, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x7e,0x08,0x10,0x7e,0x40,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x32,0x4c,0x00,0x32,0x4c,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x96,0x96,0x96,0xd0,0xf0,0xf0,0xb0,0x96,0x90,0x96, +0x00,0x00,0x00,0x00,0x00,0x38,0x24,0x24,0x24,0x24,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x88,0x88,0x88,0xf4,0x84,0x8e,0x84,0x84,0x82, +0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0x10,0x10,0x1c,0x70,0x1c,0x70,0x10,0x10,0x10, +0x00,0x00,0x00,0x00,0x00,0x00,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x00,0x24,0x24, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7e,0x00,0x00,0x7e,0x00,0x00,0x7e,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1e,0x20,0x40,0x40,0x7e,0x40,0x40,0x20,0x1e, +0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x04,0x7c,0x8a,0x92,0x92,0xa2,0x7c,0x40,0x80, +0x00,0x00,0x00,0x00,0x92,0x25,0xff,0xff,0xa9,0x00,0xff,0xff,0xae,0x00,0xff,0xff, +0x22,0x21,0xff,0xff,0xa3,0x00,0xff,0xff,0x93,0x21,0xbc,0x25,0xff,0xff,0x90,0x21, +0xc0,0x25,0xff,0xff,0x92,0x21,0xb6,0x25,0xff,0xff,0x91,0x21,0xb2,0x25,0xff,0xff, +0x91,0x25,0xff,0xff,0xa0,0x25,0xae,0x25,0xff,0xff,0xb0,0x00,0xff,0xff,0x66,0x26, +0xfd,0xff,0xff,0xff,0x65,0x22,0xff,0xff,0xc0,0x03,0xff,0xff,0x64,0x22,0xff,0xff, +0x18,0x25,0x1b,0x25,0x1a,0x25,0x19,0x25,0xff,0xff,0xb1,0x00,0xff,0xff,0x24,0x25, +0x2b,0x25,0x2a,0x25,0x29,0x25,0x28,0x25,0x27,0x25,0x26,0x25,0x25,0x25,0xff,0xff, +0x10,0x25,0x13,0x25,0x12,0x25,0x11,0x25,0xff,0xff,0x02,0x25,0x03,0x25,0x7f,0x25, +0x7d,0x25,0x7b,0x25,0x77,0x25,0x79,0x25,0x75,0x25,0xff,0xff,0xa1,0x00,0xff,0xff, +0xa2,0x00,0xff,0xff,0xa4,0x00,0xff,0xff,0xa5,0x00,0xff,0xff,0xa6,0x00,0xff,0xff, +0xa7,0x00,0xff,0xff,0xa8,0x00,0xff,0xff,0xaa,0x00,0xff,0xff,0xab,0x00,0x6a,0x22, +0xff,0xff,0xac,0x00,0xff,0xff,0xaf,0x00,0xc9,0x02,0xff,0xff,0x20,0x00,0xa0,0x00, +0x00,0x20,0x01,0x20,0x02,0x20,0x03,0x20,0x04,0x20,0x05,0x20,0x06,0x20,0x07,0x20, +0x08,0x20,0x09,0x20,0x0a,0x20,0xff,0xff,0x21,0x00,0xff,0xff,0x22,0x00,0xff,0xff, +0x23,0x00,0xff,0xff,0x24,0x00,0xff,0xff,0x25,0x00,0x95,0x22,0xff,0xff,0x26,0x00, +0xff,0xff,0x27,0x00,0xff,0xff,0x28,0x00,0xff,0xff,0x29,0x00,0xff,0xff,0x2a,0x00, +0x9b,0x22,0xff,0xff,0x2b,0x00,0xff,0xff,0x2c,0x00,0xff,0xff,0x2d,0x00,0x12,0x20, +0x13,0x20,0x12,0x22,0xad,0x00,0x10,0x20,0x11,0x20,0x96,0x22,0xff,0xff,0x2e,0x00, +0x99,0x22,0xff,0xff,0x2f,0x00,0x98,0x22,0xff,0xff,0x30,0x00,0xea,0x24,0xff,0xff, +0x31,0x00,0x60,0x24,0xff,0xff,0x32,0x00,0x61,0x24,0xff,0xff,0x33,0x00,0x62,0x24, +0xff,0xff,0x34,0x00,0x63,0x24,0xff,0xff,0x35,0x00,0x64,0x24,0xff,0xff,0x36,0x00, +0x65,0x24,0xff,0xff,0x37,0x00,0x66,0x24,0xff,0xff,0x38,0x00,0x67,0x24,0xff,0xff, +0x39,0x00,0x68,0x24,0xff,0xff,0x3a,0x00,0xff,0xff,0x3b,0x00,0xff,0xff,0x3c,0x00, +0xff,0xff,0x3d,0x00,0x9c,0x22,0xff,0xff,0x3e,0x00,0xff,0xff,0x3f,0x00,0xff,0xff, +0x40,0x00,0xff,0xff,0x41,0x00,0x10,0x04,0x91,0x03,0xb6,0x24,0xff,0xff,0x42,0x00, +0x12,0x04,0x92,0x03,0xb7,0x24,0xff,0xff,0x43,0x00,0x21,0x04,0xb8,0x24,0xff,0xff, +0x44,0x00,0xb9,0x24,0xff,0xff,0x45,0x00,0x15,0x04,0x95,0x03,0xba,0x24,0xff,0xff, +0x46,0x00,0xbb,0x24,0xff,0xff,0x47,0x00,0xbc,0x24,0xff,0xff,0x48,0x00,0x1d,0x04, +0x97,0x03,0xbd,0x24,0xff,0xff,0x49,0x00,0x06,0x04,0x99,0x03,0xbe,0x24,0xff,0xff, +0x4a,0x00,0x08,0x04,0xbf,0x24,0xff,0xff,0x4b,0x00,0x1a,0x04,0x9a,0x03,0x2a,0x21, +0xc0,0x24,0xff,0xff,0x4c,0x00,0xc1,0x24,0xff,0xff,0x4d,0x00,0x1c,0x04,0x9c,0x03, +0xc2,0x24,0xff,0xff,0x4e,0x00,0x9d,0x03,0xc3,0x24,0xff,0xff,0x4f,0x00,0x1e,0x04, +0x9f,0x03,0xc4,0x24,0xff,0xff,0x50,0x00,0x20,0x04,0xa1,0x03,0xc5,0x24,0xff,0xff, +0x51,0x00,0xc6,0x24,0xff,0xff,0x52,0x00,0xc7,0x24,0xff,0xff,0x53,0x00,0x05,0x04, +0xc8,0x24,0xff,0xff,0x54,0x00,0x22,0x04,0xa4,0x03,0xc9,0x24,0xff,0xff,0x55,0x00, +0xca,0x24,0xff,0xff,0x56,0x00,0xcb,0x24,0xff,0xff,0x57,0x00,0xcc,0x24,0xff,0xff, +0x58,0x00,0x25,0x04,0xa7,0x03,0xcd,0x24,0xff,0xff,0x59,0x00,0xae,0x04,0xce,0x24, +0xff,0xff,0x5a,0x00,0x96,0x03,0xcf,0x24,0xff,0xff,0x5b,0x00,0xff,0xff,0x5c,0x00, +0xff,0xff,0x5d,0x00,0xff,0xff,0x5e,0x00,0xff,0xff,0x5f,0x00,0xff,0xff,0x60,0x00, +0xff,0xff,0x61,0x00,0x30,0x04,0xd0,0x24,0xff,0xff,0x62,0x00,0xd1,0x24,0xff,0xff, +0x63,0x00,0x41,0x04,0xd2,0x24,0xff,0xff,0x64,0x00,0xd3,0x24,0xff,0xff,0x65,0x00, +0x35,0x04,0xd4,0x24,0xff,0xff,0x66,0x00,0xd5,0x24,0xff,0xff,0x67,0x00,0xd6,0x24, +0xff,0xff,0x68,0x00,0xd7,0x24,0xff,0xff,0x69,0x00,0x56,0x04,0xd8,0x24,0xff,0xff, +0x6a,0x00,0x58,0x04,0xd9,0x24,0xff,0xff,0x6b,0x00,0xda,0x24,0xff,0xff,0x6c,0x00, +0xdb,0x24,0xff,0xff,0x6d,0x00,0xdc,0x24,0xff,0xff,0x6e,0x00,0xdd,0x24,0xff,0xff, +0x6f,0x00,0x3e,0x04,0xde,0x24,0xff,0xff,0x70,0x00,0x40,0x04,0xdf,0x24,0xff,0xff, +0x71,0x00,0xe0,0x24,0xff,0xff,0x72,0x00,0xe1,0x24,0xff,0xff,0x55,0x04,0x73,0x00, +0xe2,0x24,0xff,0xff,0x74,0x00,0xe3,0x24,0xff,0xff,0x75,0x00,0xe4,0x24,0xff,0xff, +0x76,0x00,0xe5,0x24,0xff,0xff,0x77,0x00,0xe6,0x24,0xff,0xff,0x78,0x00,0x45,0x04, +0xe7,0x24,0xff,0xff,0x79,0x00,0x43,0x04,0xe8,0x24,0xff,0xff,0x7a,0x00,0xe9,0x24, +0xff,0xff,0x7b,0x00,0xff,0xff,0x7c,0x00,0xff,0xff,0x7d,0x00,0xff,0xff,0x7e,0x00, +0xff,0xff,0xb2,0x00,0xff,0xff,0xb3,0x00,0xff,0xff,0xb4,0x00,0xff,0xff,0xb5,0x00, +0xbc,0x03,0xff,0xff,0xb6,0x00,0xff,0xff,0xb7,0x00,0xff,0xff,0xb8,0x00,0xff,0xff, +0xb9,0x00,0xff,0xff,0xba,0x00,0xff,0xff,0xbb,0x00,0x6b,0x22,0xff,0xff,0xbc,0x00, +0xff,0xff,0xbd,0x00,0xff,0xff,0xbe,0x00,0xff,0xff,0xbf,0x00,0xff,0xff,0xc0,0x00, +0xff,0xff,0xc1,0x00,0xff,0xff,0xc2,0x00,0xff,0xff,0xc3,0x00,0xff,0xff,0xc4,0x00, +0xff,0xff,0xc5,0x00,0x2b,0x21,0xff,0xff,0xc6,0x00,0xff,0xff,0xc7,0x00,0xff,0xff, +0xc8,0x00,0xff,0xff,0xc9,0x00,0xff,0xff,0xca,0x00,0xff,0xff,0xcb,0x00,0x01,0x04, +0xff,0xff,0xcc,0x00,0xff,0xff,0xcd,0x00,0xff,0xff,0xce,0x00,0xff,0xff,0xcf,0x00, +0x07,0x04,0xff,0xff,0xd0,0x00,0x10,0x01,0xff,0xff,0xd1,0x00,0xff,0xff,0xd2,0x00, +0xff,0xff,0xd3,0x00,0xff,0xff,0xd4,0x00,0xff,0xff,0xd5,0x00,0xff,0xff,0xd6,0x00, +0xff,0xff,0xd7,0x00,0xff,0xff,0xd8,0x00,0xff,0xff,0xd9,0x00,0xff,0xff,0xda,0x00, +0xff,0xff,0xdb,0x00,0xff,0xff,0xdc,0x00,0xff,0xff,0xdd,0x00,0xff,0xff,0xde,0x00, +0xff,0xff,0xdf,0x00,0xff,0xff,0xe0,0x00,0xff,0xff,0xe1,0x00,0xff,0xff,0xe2,0x00, +0xff,0xff,0xe3,0x00,0xff,0xff,0xe4,0x00,0xff,0xff,0xe5,0x00,0xff,0xff,0xe6,0x00, +0xff,0xff,0xe7,0x00,0xff,0xff,0xe8,0x00,0xff,0xff,0xe9,0x00,0xff,0xff,0xea,0x00, +0xff,0xff,0xeb,0x00,0x51,0x04,0xff,0xff,0xec,0x00,0xff,0xff,0xed,0x00,0xff,0xff, +0xee,0x00,0xff,0xff,0xef,0x00,0x57,0x04,0xff,0xff,0xf0,0x00,0xff,0xff,0xf1,0x00, +0xff,0xff,0xf2,0x00,0xff,0xff,0x00,0x25,0x01,0x25,0x7e,0x25,0x7c,0x25,0x7a,0x25, +0x76,0x25,0x78,0x25,0x74,0x25,0xff,0xff,0x6c,0x25,0xff,0xff,0x3c,0x25,0x4b,0x25, +0x4a,0x25,0x49,0x25,0x48,0x25,0x47,0x25,0x46,0x25,0x45,0x25,0x44,0x25,0x43,0x25, +0x42,0x25,0x41,0x25,0x40,0x25,0x3f,0x25,0x3e,0x25,0x3d,0x25,0xff,0xff,0x14,0x25, +0x17,0x25,0x16,0x25,0x15,0x25,0xff,0xff,0x6a,0x25,0xff,0xff,0x88,0x25,0xff,0xff, +0x2c,0x25,0x33,0x25,0x32,0x25,0x31,0x25,0x30,0x25,0x2f,0x25,0x2e,0x25,0x2d,0x25, +0xff,0xff,0x1c,0x25,0x23,0x25,0x22,0x25,0x21,0x25,0x20,0x25,0x1f,0x25,0x1e,0x25, +0x1d,0x25,0xff,0xff,0x34,0x25,0x3b,0x25,0x3a,0x25,0x39,0x25,0x38,0x25,0x37,0x25, +0x36,0x25,0x35,0x25,0xff,0xff,0x0c,0x25,0x0f,0x25,0x0e,0x25,0x0d,0x25,0xff,0xff, +0xf3,0x00,0xff,0xff,0xf4,0x00,0xff,0xff,0xf5,0x00,0xff,0xff,0xf6,0x00,0xff,0xff, +0xf7,0x00,0xff,0xff,0xf8,0x00,0xff,0xff,0xf9,0x00,0xff,0xff,0xfa,0x00,0xff,0xff, +0xfb,0x00,0xff,0xff,0xfc,0x00,0xff,0xff,0xfd,0x00,0xff,0xff,0xfe,0x00,0xff,0xff, +0xff,0x00,0xff,0xff,0x1e,0x01,0xff,0xff,0x1f,0x01,0xff,0xff,0x30,0x01,0xff,0xff, +0x31,0x01,0xff,0xff,0x52,0x01,0xff,0xff,0x53,0x01,0xff,0xff,0x5e,0x01,0xff,0xff, +0x5f,0x01,0xff,0xff,0x60,0x01,0xff,0xff,0x61,0x01,0xff,0xff,0x78,0x01,0xff,0xff, +0x7d,0x01,0xff,0xff,0x7e,0x01,0xff,0xff,0x92,0x01,0xff,0xff,0xc6,0x02,0xff,0xff, +0xdc,0x02,0xff,0xff,0x14,0x20,0x15,0x20,0xff,0xff,0x18,0x20,0xff,0xff,0x19,0x20, +0xff,0xff,0x1a,0x20,0xff,0xff,0x1c,0x20,0xff,0xff,0x1d,0x20,0xff,0xff,0x1e,0x20, +0xff,0xff,0x20,0x20,0xff,0xff,0x21,0x20,0xff,0xff,0x22,0x20,0xcf,0x25,0xff,0xff, +0x26,0x20,0xff,0xff,0x30,0x20,0xff,0xff,0x39,0x20,0xff,0xff,0x3a,0x20,0xff,0xff, +0xac,0x20,0xff,0xff,0x60,0x22,0xff,0xff,0x48,0x22,0xff,0xff,0x16,0x21,0xff,0xff, +0x7f,0x20,0xff,0xff,0xa7,0x20,0xff,0xff,0xae,0x20,0xff,0xff,0x3c,0x20,0xff,0xff, +0x61,0x22,0xff,0xff,0x08,0x22,0xff,0xff,0x05,0x22,0xff,0xff, +}; diff --git a/src/default_icon_byte_array.h b/src/default_icon_byte_array.h new file mode 100644 index 0000000..77162f7 --- /dev/null +++ b/src/default_icon_byte_array.h @@ -0,0 +1,91 @@ +{ +0x42,0x4d,0x8a,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x8a,0x00,0x00,0x00,0x7c,0x00, +0x00,0x00,0x13,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x01,0x00,0x10,0x00,0x03,0x00, +0x00,0x00,0x00,0x05,0x00,0x00,0x13,0x0b,0x00,0x00,0x13,0x0b,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x00,0x00,0xe0,0x07,0x00,0x00,0x1f,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x47,0x52,0x73,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff, +0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0xff,0xff,0xff,0xff,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff, +0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff, +0xff,0xff,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff, +0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff, +0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff, +0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0xff,0xff,0x00,0x00,0x00,0x00, +0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x00, +0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff, +0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00, +0x00,0x00,0xff,0xff,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0xff,0xff,0x00,0x00,0x00,0x00, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0xff,0xff,0x00,0x00,0x00,0x00, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff, +0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff, +0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff, +0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff, +0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff, +0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff, +0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff, +0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00, +}; diff --git a/src/examples.h b/src/examples.h new file mode 100644 index 0000000..b3400bd --- /dev/null +++ b/src/examples.h @@ -0,0 +1,20 @@ +const fim_char_t * FIM_DEFAULT_EXAMPLE_FILE_CONTENTS = +"# jump to the third image:\n" +"3;\n" +"# jump to first image:\n" +"^;\n" +"# jump to last image:\n" +"$;\n" +"# magnify the image two times:\n" +"*2;\n" +"# scale the image to the 30% of the original:\n" +"30%;\n" +"# scale the image up by 30%:\n" +"+30%;\n" +"# scale the image down by 30%:\n" +"-30%;\n" +"# jump to the next image whose filename matches the \".*jpg\" regular expression:\n" +"/.*jpg;\n" +"# executes the \"date\" system command\n" +"!\"date\";\n" +""; diff --git a/src/fim.cpp b/src/fim.cpp new file mode 100644 index 0000000..c6ba3fd --- /dev/null +++ b/src/fim.cpp @@ -0,0 +1,1669 @@ +/* $LastChangedDate: 2017-07-29 11:04:00 +0200 (Sat, 29 Jul 2017) $ */ +/* + fim.cpp : Fim main program and accessory functions + + (c) 2007-2016 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "fim.h" +#include +#include +#ifdef FIM_READLINE_H +#include "readline.h" /* readline stuff */ +#endif /* FIM_READLINE_H */ +/* + * We use the STL (Standard Template Library) + */ +using std :: endl; +using std :: ifstream; +using std :: ofstream; +using std :: map; +using std :: multimap; +using std :: pair; +using std :: vector; + + +/* + * Global variables. + * */ + fim::string g_fim_output_device; + FlexLexer *lexer; + +/* + * (nearly) all Fim stuff is in the fim namespace. + * */ +namespace fim +{ + /* + * Globals : should be encapsulated. + * */ + fim::CommandConsole cc; + fim_char_t *default_fbdev=FIM_NULL,*default_fbmode=FIM_NULL; + int default_vt=-1; + fim_float_t default_fbgamma=-1.0; + fim_stream cout/*(1)*/; + fim_stream cerr(2); +} + +struct fim_options_t{ + const fim_char_t *name; + int has_arg; + int *flag; + int val; + const fim_char_t *desc;/* this is fim specific */ + const fim_char_t *optdesc;/* this is fim specific */ + const fim_char_t *mandesc;/* this is fim specific */ +}; + +/* + * Yet unfinished. + * This structure keeps hold of Fim's options flags. + */ +struct fim_options_t fim_options[] = { + {"autozoom", no_argument, FIM_NULL, 'a',"scale according to a best fit.",FIM_NULL, +"Enable autozoom. fim will automagically pick a reasonable zoom factor when loading a new image (as in fbi)." + }, +#if FIM_WANT_RAW_BITS_RENDERING + {FIM_OSW_BINARY, optional_argument, FIM_NULL, 'b',"view any file as either a 1 or 24 bpp bitmap.","[=24|1]", +"Display (any filetype) binary files contents as they were raw 24 or 1 bits per pixel pixelmaps.\n" +"Will arrange the image by rows long as specified by the " FIM_VID_PREFERRED_RENDERING_WIDTH " variable for the image width (unless a narrower image suffices).\n" +"Regard this as an easter bunny option.\n" + }, +#endif /* FIM_WANT_RAW_BITS_RENDERING */ +#if FIM_WANT_TEXT_RENDERING + {FIM_OSW_TEXT, no_argument, FIM_NULL, 0x74657874, "view any file as rendered text.",FIM_NULL, +"Display (any filetype) files contents as they were text.\n" +"Will only show printable characters.\n" +"Regard this as an easter bunny option.\n" + }, +#endif /* FIM_WANT_RAW_BITS_RENDERING */ + {"cd-and-readdir", no_argument, FIM_NULL, 0x4352,"step into the first loaded file directory and push other files.",FIM_NULL,"Step into the first loaded file directory and push other files."}, + {FIM_OSW_EXECUTE_COMMANDS, required_argument, FIM_NULL, 'c',"execute {commands} after initialization.","{commands}", +"The \\fBcommands\\fP string will be executed before entering the interactive loop.\n" +"Please note that if your commands are more complicated than a simple 'next' or 'pornview'\n" +"command, they must be quoted and escaped in a manner suitable for your shell!\n" +"\n" +"For example,\n" +"-c '*2;2pan_up;display;while(1){align \"bottom\";sleep \"1\" ; align \"top\"}'\n" +"(with the single quotes) will tell fim to first double the displayed image \n" +"size, then pan two times up, then display the image ; and then \n" +"do an endless loop consisting of bottom and top aligning, alternated.\n" + }, + {FIM_OSW_EXECUTE_COMMANDS_EARLY, required_argument, FIM_NULL, 'C',"execute {commands} after initialization, before any config loading.","{commands}", +"Just as the --" FIM_OSW_EXECUTE_COMMANDS " option, but commands will be executed before the loading of any config file.\n" +"\n" +"For example,\n" +"-C '" FIM_VID_SCALE_STYLE "=\" \"' will make fim start with no auto-scaling.\n" +"\n" + }, + {"device", required_argument, FIM_NULL, 'd',"specify a {framebuffer device}.","{framebuffer device}", +"Framebuffer device to use. Default is the one your vc is mapped to (as in fbi)." + }, + {"dump-reference-help", optional_argument /*no_argument*/, FIM_NULL, 0x6472690a,"dump reference info","[=man].", +"Will dump to stdout the language reference help." + }, + {"dump-default-fimrc", no_argument, FIM_NULL, 'D',"dump on standard output the default configuration.",FIM_NULL, +"The default configuration (the one hardcoded in the fim executable) is dumped on standard output and fim exits." + }, + {FIM_OSW_EXECUTE_SCRIPT, required_argument, FIM_NULL, 'E',"execute {scriptfile} after initialization.","{scriptfile}", +"The \\fBscriptfile\\fP will be executed right after the default initialization file is executed." + }, + {"etc-fimrc", required_argument, FIM_NULL, 'f',"etc-fimrc read.","{fimrc}", +"Specify an alternative system wide initialization file (default: " FIM_CNS_SYS_RC_FILEPATH "), which will be executed prior to any other configuration file.\n" + }, + {FIM_OSW_FINAL_COMMANDS, required_argument, FIM_NULL, 'F',"execute {commands} just before exit.","{commands}", +"The \\fBcommands\\fP string will be executed after exiting the interactive loop of the program (right before terminating the program)." + }, + {"help", optional_argument, FIM_NULL, 'h',"Print (short, descriptive, long, or complete man) program invocation help, and terminate.","[=s|d|l|m]", +FIM_NULL + }, +#if FIM_WANT_PIC_CMTS + {FIM_OSW_LOAD_IMG_DSC_FILE, required_argument, FIM_NULL, 0x6c696466, "load image descriptions file", "{filename}", "Load image descriptions from {filename}. In {filename} each line is the name of an image file (its basename will be taken), then a Tab character (unless --" FIM_OSW_IMG_DSC_FILE_SEPC " specifies otherwise), then the description text. Each description will be put in the " FIM_VID_COMMENT " variable of the image at load time. Will override the comment eventually loaded from the file (e.g. JPEG, PNG or TIFF comment)." +#if FIM_WANT_PIC_LVDN + " Special comment lines like \"#!fim:var=val\" will lead i:var to be assigned value val (unquoted) at image loading time." +#if FIM_WANT_PIC_RCMT + " Special description lines begin with markers: " + " with \"#!fim:=\" the last description line to be used;" + " with \"#!fim:+\" what follows + will be appended to the last description line;" + " with \"#!fim:^\" what follows ^ will be prepended to the last description line;" + " with \"#!fim:s/f/t\" the last description line will be used, but occurrences of string f will be substituted with string t (f and t can contain anything but not a /)." +#endif /* FIM_WANT_PIC_RCMT */ + " If val is empty that variable will be unset." +#if FIM_WANT_PIC_LBFL + " These variables are stored also in an internal index used by the " FIM_FLT_LIMIT " command." +#endif /* FIM_WANT_PIC_LBFL */ +#endif /* FIM_WANT_PIC_LVDN */ + " This option sets " FIM_VID_COMMENT_OI "=" FIM_XSTRINGIFY(FIM_OSW_LOAD_IMG_DSC_FILE_VID_COMMENT_OI_VAL) ", so that a caption will be displayed over the image." + }, + {FIM_OSW_IMG_DSC_FILE_SEPC, required_argument, FIM_NULL, 0x69646673, "image descriptions file separator character.", "{sepchar}", "A character to be used as a separator between the filename and the description part of lines specified just before a --" FIM_OSW_LOAD_IMG_DSC_FILE "." + }, +#endif /* FIM_WANT_PIC_CMTS */ +#ifdef FIM_READ_STDIN_IMAGE + {FIM_OSW_IMAGE_FROM_STDIN, no_argument, FIM_NULL, 'i',"read an image file from standard input.",FIM_NULL, +"Will read one single image from the standard input (the image data, not the filename). May not work with all supported file formats." +"\nIn the image list, this image will be displayed as \"" FIM_STDIN_IMAGE_NAME "\".\n" + }, +#endif /* FIM_READ_STDIN_IMAGE */ + {"mode", required_argument, FIM_NULL, 'm',"specify a video mode.","{vmode}", +"Name of the video mode to use video mode (must be listed in /etc/fb.modes). Default is not to change the video mode. In the past, the XF86 config file (/etc/X11/XF86Config) used to contain Modeline information, which could be fed to the modeline2fb perl script (distributed with fbset). On many modern xorg based systems, there is no direct way to obtain a fb.modes file from the xorg.conf file. So instead one could obtain useful fb.modes info by using the (fbmodes (no man page AFAIK)) tool, written by bisqwit. An unsupported mode should make fim exit with failure. But it is possible the kernel could trick fim and set a supported mode automatically, thus ignoring the user set mode." + }, + {"no-rc-file", no_argument, FIM_NULL, 'N',"do not read the personal initialization file at startup.",FIM_NULL, +"No personal initialization file will be read (default is " FIM_CNS_USR_RC_COMPLETE_FILEPATH ") at startup." + }, + {"no-etc-rc-file", no_argument, FIM_NULL, 0x4E4E,"do not read the system wide initialization file at startup.",FIM_NULL, +"No system wide initialization file will be read (default is " FIM_CNS_SYS_RC_FILEPATH ") at startup." + }, + {"no-internal-config", no_argument, FIM_NULL, 0x4E4E4E,"do not execute the internal default configuration at startup.",FIM_NULL, +"No internal default configuration at startup (uses internal variable " FIM_VID_NO_DEFAULT_CONFIGURATION "). Will only provide a minimal working configuration. " + }, + {"no-commandline", no_argument, FIM_NULL, 0x4E434C,"with internal command line mode disabled.",FIM_NULL, "With internal command line mode disabled."}, +#if FIM_WANT_HISTORY + {"no-history-save", no_argument, FIM_NULL, 0x4E4853,"do not save execution history.",FIM_NULL, +"Do not save execution history at finalization (uses internal variable " FIM_VID_SAVE_FIM_HISTORY "). " + }, + {"no-history-load", no_argument, FIM_NULL, 0x4E484C,"do not load execution history.",FIM_NULL, +"Do not load execution history at startup. " + }, + {"no-history", no_argument, FIM_NULL, 0x4E48,"do not load/save execution history.",FIM_NULL, +"Do not load or save execution history at startup. " + }, +#endif /* FIM_WANT_HISTORY */ + {FIM_OSW_SCRIPT_FROM_STDIN, no_argument, FIM_NULL, 'p',"read commands from standard input.",FIM_NULL, +"Will read commands from stdin prior to entering in interactive mode." + }, + {FIM_OSW_OUTPUT_DEVICE, required_argument, FIM_NULL, 'o',"specify the desired output driver (aka graphic mode).",FIM_DDN_VARS, +"Will use the specified \\fBdevice\\fP as fim video output device, overriding automatic checks." +"The available devices depend on the original configuration/compilation options, so you should\n" +"get the list of available output devices issuing \\fBfim --version\\fP.\n" +"The \\fBaa\\fP option may be specified as \\fBaa" FIM_SYM_DEVOPTS_SEP_STR "{['w']}\\fP ; the " FIM_MAN_fB("'w'") " character allows windowed mode in case of aalib running under X (otherwise, the DISPLAY environment variable will be unset for the current instance of fim).\n" +#if FIM_WANT_SDL_OPTIONS_STRING +"The \\fBsdl\\fP option may be specified as \\fBsdl" FIM_SYM_DEVOPTS_SEP_STR "{['w']['m']['r']['W']['M']['R']width:height}\\fP , where \\fBwidth\\fP is and \\fBheight\\fP are integer numbers specifying the desired resolution; the " FIM_MAN_fB("'w'") " character requests windowed mode; the " FIM_MAN_fB("'m'") " character requests mouse pointer display; the " FIM_MAN_fB("'r'") " character requests support for window resize; the same letters uppercase request explicit negation of the mentioned features.\n" +#endif /* FIM_WANT_SDL_OPTIONS_STRING */ +#ifdef FIM_WITH_LIBIMLIB2 +/* FIXME: shall document this */ +#endif /* FIM_WITH_LIBIMLIB2 */ + }, + {"offset", required_argument, FIM_NULL, 0x6f66660a, "will open the first image file at the specified offset.","{bytes-offset[{:upper-offset}|{+offset-range}]}", +"Will use the specified \\fBoffset\\fP (in bytes) for opening the specified files. If \\fB:upper-offset\\fP is specified, further bytes until \\fBupper-offset\\fP will be probed. If \\fB+offset-range\\fP is specified instead, that many additional bytes will be probed. Use this option to search damaged file systems for image files." + }, + {"text-reading", no_argument, FIM_NULL, 'P',"proceed scrolling as reading through a text document.",FIM_NULL, +"Enable textreading mode. This has the effect that fim will display images scaled to the width of the screen, and aligned to the top. Useful if the images you are watching text pages, all you have to do to get the next piece of text is to press space (in the default key configuration, of course)." + }, + {"scroll", required_argument, FIM_NULL, 's',"set scroll variable value.","{value}", +"Set scroll steps for internal variable " FIM_VID_STEPS " (default is " FIM_CNS_STEPS_DEFAULT ")." + }, + {"slideshow", required_argument, FIM_NULL, 0x7373,"interruptible slideshow mode.",FIM_CNS_EX_NUM_STRING, +"Interruptible slideshow mode; will wait for " FIM_CNS_EX_NUM_STRING " of seconds (assigned to the " FIM_VID_WANT_SLEEPS " variable after each loading; implemented by executing " FIM_CNS_SLIDESHOW_CMD " as a first command." + }, + {"sanity-check", no_argument, FIM_NULL, 'S',"perform a sanity check.",FIM_NULL, +"A quick sanity check before starting the interactive fim execution, but after the initialization." + }, /* NEW */ + {"no-framebuffer", no_argument, FIM_NULL, 't',"display images in text mode (as -o " FIM_DDN_INN_AA ").",FIM_NULL, +"Fim will not use the framebuffer but the aalib (ASCII art) driver instead (if you are curious, see (info aalib)).\n" +"If aalib was not enabled at tompile time, fim will work without displaying images at all." + }, + {"vt", required_argument, FIM_NULL, 'T',"specify a virtual terminal for the framebufer.","{terminal}", +"The \\fBterminal\\fP will be used as virtual terminal device file (as in fbi).\n" +"See (chvt (1)), (openvt (1)) for more info about this.\n" +"Use (con2fb (1)) to map a terminal to a framebuffer device.\n" + }, + {"sort", no_argument, FIM_NULL, 0x736f7274 ,"sort images by pathname.",FIM_NULL, +"Sort files list before browsing according to full filename." + }, + {"sort-basename", no_argument, FIM_NULL, 0x736f626e ,"sort images by basename.",FIM_NULL, +"Sort files list before browsing according to file basename's." + }, + {"random", no_argument, FIM_NULL, 'u',"randomize images order.",FIM_NULL, +"Randomly shuffle the files list before browsing (seed depending on time() function)." + }, + {"random-no-seed", no_argument, FIM_NULL, 0x7073,"randomize images order (always same sequence).",FIM_NULL, +"Randomly shuffle the files list before browsing (no seeding)." + }, + {"verbose", no_argument, FIM_NULL, 'v',"verbose mode.",FIM_NULL, +"Be verbose: show status bar." + }, + {"version", no_argument, FIM_NULL, 'V',"print program version.",FIM_NULL, +"Display program version, compile flags, enabled features, linked libraries information, supported filetypes/file loaders, and then terminate." + }, + {"autowidth", no_argument, FIM_NULL, 'w',"scale according to width.",FIM_NULL, +"Scale the image according to the screen width." + }, + {"no-auto-scale", no_argument, FIM_NULL,0x4E4053,"do not use any auto-scaling.",FIM_NULL, +"Do not scale the images after loading (will set '" FIM_VID_SCALE_STYLE "=\" \"';)." + }, + {"autowindow", no_argument, FIM_NULL,0x61757769,"adapt window to image size.",FIM_NULL, +"Will resize the window size (if supported) to the image size. Don't use this with other image scaling options." + }, + {"no-stat-push", no_argument, FIM_NULL,0x6e7363,"do not check file/dir existence with stat(2) at push time",FIM_NULL, +"Sets " FIM_VID_PRELOAD_CHECKS "=0 before initialization, thus disabling file/dir existence checks with stat(2) at push push time (and speeding up startup)." + }, + {"autoheight", no_argument, FIM_NULL, 'H',"scale according to height.",FIM_NULL, +"Scale the image according to the screen height." + }, + {FIM_OSW_DUMP_SCRIPTOUT, required_argument, FIM_NULL, 'W',"will record any executed command to the a {scriptfile}.","{scriptfile}", +"All the characters that you type are recorded in the file {scriptout}, until you exit Fim. This is useful if you want to create a script file to be used with \"fim -c\" or \":exec\" (analogous to Vim's -s and \":source!\"). If the {scriptout} file exists, it will be not touched (as in Vim's -w). " + }, +#ifdef FIM_READ_STDIN + {"read-from-stdin", no_argument, FIM_NULL, '-',"read an image list from standard input.",FIM_NULL, +"Read file list from stdin: each line one file.\n" + +"\n" +"Note that these the three standard input reading functionalities (-i,-p and -) conflict : if two or more of them occur in fim invocation, fim will exit with an error and warn about the ambiguity.\n" +"\n" +"See the section\n" +".B INVOCATION EXAMPLES\n" +"below to read some useful (and unique) ways of employing fim.\n" + }, + {"read-from-stdin-elds", required_argument, FIM_NULL, 0x72667373,"--read-from-stdin filenames endline delimiter string.",FIM_NULL, +"Specify an endline delimiter string for breaking lines read via -/--read-from-stdin. Line text before the delimiter will be treated as names of files to load; the text after will be ignored until a newline. This is useful e.g. to description files as filename list files.\n" + }, +#endif /* FIM_READ_STDIN */ + {"autotop", no_argument, FIM_NULL, 'A',"Align images to the top (UNFINISHED).",FIM_NULL, + FIM_NULL + }, +// {"gamma", required_argument, FIM_NULL, 'g',"set gamma (UNFINISHED)","{gamma}", +//" gamma correction. Can also be put into the FBGAMMA environment variable. Default is 1.0. Requires Pseudocolor or Directcolor visual, doesn't work for Truecolor." +// }, + {"quiet", no_argument, FIM_NULL, 'q',"Quiet mode.",FIM_NULL, "Quiet mode. Sets " FIM_CNS_QUIET_CMD ".\n" + }, + {"resolution", required_argument, FIM_NULL, 'r',"Set resolution (UNFINISHED).","{resolution}", + FIM_NULL + }, + {"recursive", no_argument, FIM_NULL, 'R',"Push files/directories to the files list recursively.", FIM_NULL, + FIM_NULL + }, +/* {"timeout", required_argument, FIM_NULL, 't',"",FIM_NULL},*/ /* timeout value */ /* fbi's */ +/* {"once", no_argument, FIM_NULL, '1',"",FIM_NULL},*/ /* loop only once */ +/* {"font", required_argument, FIM_NULL, 'f',"",FIM_NULL},*/ /* font */ +/* {"edit", no_argument, FIM_NULL, 'e',"",FIM_NULL},*/ /* enable editing */ /* fbi's */ +/* {"list", required_argument, FIM_NULL, 'l',"",FIM_NULL},*/ +// {"backup", no_argument, FIM_NULL, 'b',"",FIM_NULL}, /* fbi's */ +// {"debug", no_argument, FIM_NULL, 'D',"",FIM_NULL}, +// {"preserve", no_argument, FIM_NULL, 'p',"",FIM_NULL}, /* fbi's */ + + /* long-only options */ +// {"autoup", no_argument, &autoup, 1 }, +// {"autodown", no_argument, &autodown, 1 }, +// {"comments", no_argument, &comments, 1 }, + {0,0,0,0,0,0} +}; + +#if 0 +// leftovers from the old man file; shall adapt these using .\" + .TP + .B -f font + Set font. This can be either a pcf console font file or a X11 font + spec. Using X11 fonts requires a font server (The one specified in + the environment variable FONTSERVER or on localhost). The FBFONT + environment variable is used as default. If unset, fim will + fallback to 10x20 (X11) / lat1u-16.psf (console). + .TP + .B --autoup + Like autozoom, but scale up only. + .TP + .B --autodown + Like autozoom, but scale down only. + .TP + .B -u + Randomize the order of the filenames. + .TP + .B -e + Enable editing commands. + .TP + .B -b + create backup files (when editing images). + .TP + .B -p + preserve timestamps (when editing images). + .TP + .B --comments + Display comment tags (if present) instead of the filename. Probaby + only useful if you added reasonable comments yourself (using wrjpgcom + for example), otherwise you likely just find texts pointing to the + software which created the image. + P pause the slideshow (if started with -t, toggle) + {number}g jump to image {number} + .SH EDIT IMAGE + fim also provides some very basic image editing facilities. You have + to start fim with the -e switch to use them. + .P + .nf + Shift+D delete image + R rotate 90° clockwise + L rotate 90° counter-clock wise + .fi + .P + The delete function actually wants a capital letter 'D', thus you have + to type Shift+D. This is done to avoid deleting images by mistake + because there are no safety bells: If you ask fim to delete the image, + it will be deleted without questions asked. + .P + The rotate function actually works for JPEG images only because it + calls the jpegtran command to perform a lossless rotation if the image. + It is especially useful if you review the images of your digital + camera. +#endif + +const int fim_options_count=sizeof(fim_options)/sizeof(fim_options_t); +struct option options[fim_options_count]; + +fim::string fim_help_opt(const char*qs) +{ + string result; + + if( qs && qs[0] == '-' && !qs[1] ) + { + result += "The short command options of fim are: "; + for(size_t i=0;i"; + if(fim_options[i].optdesc) + ms+=" ",ms+=fim_options[i].optdesc; + else + ms+=" "; + break; + case optional_argument: + if(fim_options[i].optdesc) + ms+=fim_options[i].optdesc; + else + ms+="[=arg]"; + break; + default: + ; + }; + ms+=slom; + if(helparg&&*helparg=='d') + ms+="\t\t ",ms+=fim_options[i].desc; + if(helparg&&*helparg=='m') + { + if(fim_options[i].mandesc) + ms+=fim_options[i].mandesc; + else + { + ms+="\t\t "; + if(fim_options[i].desc) + ms+=fim_options[i].desc; + } + } + //if(helparg||*helparg!='m') ms+=FIM_SYM_ENDL; + ms+=sloe; + //if(helparg&&*helparg=='l') std::cout << "TODO: print extended help here\n"; + } + ms+="\n"; + return ms; +} + +int fim_dump_man_page(void) +{ + string mp= + string(".\\\"\n" + ".\\\" $Id""$\n" + ".\\\"\n" + ".TH fim 1 \"(c) 2007-" FIM_CNS_LCY " " FIM_AUTHOR_NAME "\"\n" + ".SH NAME\n" + "fim - \\fBf\\fPbi (linux \\fBf\\fPrame\\fBb\\fPuffer \\fBi\\fPmageviewer) \\fBim\\fPproved\n" + ".SH SYNOPSIS\n" + ".B fim [{options}] [--] {imagefile} [{imagefiles}]\n.fi\n" + ".B ... | fim [{options}] [--] [{imagefiles}] -\n.fi\n")+ +#ifdef FIM_READ_STDIN + string(".B fim [{options}] [--] [{files}] - < {file_name_list_text_file}\n.fi\n")+ +#endif /* FIM_READ_STDIN */ +#ifdef FIM_READ_STDIN_IMAGE + string(".B fim --" FIM_OSW_IMAGE_FROM_STDIN " [{options}] < {imagefile}\n.fi\n")+ +#endif /* FIM_READ_STDIN_IMAGE */ +#ifdef FIM_READ_STDIN + string(".B fim --" FIM_OSW_SCRIPT_FROM_STDIN " [{options}] < {scriptfile}\n.fi\n")+ +#endif /* FIM_READ_STDIN */ + string("\n" + ".SH DESCRIPTION\n" + ".B\nfim\nis a `swiss army knife' for displaying image files.\n" + "It is capable of displaying image files using different graphical devices while offering a uniform look and feel; it features an internal command language specialized to the image viewing purposes; it is capable of interacting with standard input and output; the internal command language is accessible via a command line capable of autocompletion and history; it features command recording, supports initialization files, customizable key bindings, internal variables and command aliases, vim-like autocommands, JPEG comments, EXIF tags display, EXIF rotation/orientation, and much more.\n\n" + "As a default,\n.B\nfim\ndisplays the specified file(s) on the detected graphical device (e.g. with SDL if X is detected, or the linux framebuffer device if not). " FIM_CNS_DSFF " formats are supported. \nFor 'XCF' (Gimp's) images, fim will try to use '" FIM_EPR_XCFTOPNM "'.\nFor '.FIG' vectorial images, fim will try to use '" FIM_EPR_FIG2DEV "'.\nFor '.DIA' vectorial images, fim will try to use '" FIM_EPR_DIA "'.\nFor '.SVG' vectorial images, fim will try to use '" FIM_EPR_INKSCAPE "'.\nFor other formats fim will try to use ImageMagick's '" FIM_EPR_CONVERT "' executable.\n" + "\n")+ +#ifdef FIM_READ_DIRS + string("\n""If " FIM_MAN_fB("{imagefile}") " is a directory, therein contained files of supported formats will be loaded. If " FIM_MAN_fB("{imagefile}") " contains a trailing slash (" FIM_CNS_SLASH_STRING "), it will be treated as a directory; otherwise a check will be made using " FIM_MAN_fB("stat(2)") ". To change this default, see description of the " FIM_VID_PUSHDIR_RE " variable and the --no-stat-push and --recursive options.\n\n")+ +#endif /* FIM_READ_DIRS */ + + string("\n""If configured at build time, fim will be capable of using SDL or aalib output.\n\n")+ + // string("Please note that a user guide of \n.B fim\nis in the " FIM_CNS_FIM_TXT " file distributed in the source package.\n\n")+ + string("This man page only describes the\n.B fim\ncommand line options.\n" + "See man " FIM_MAN_fR("fimrc") "(5) for a full specification of the \n.B\nfim\nlanguage, commands, variables, and an example configuration file.\n" + "\n" + ".SH USAGE\n" + "You may invoke\n.B\nfim\nfrom an interactive shell and control it with the keyboard, as you would do with any image viewer with reasonable key bindings.\n" + "\n.B\nfim\nis keyboard oriented: there are no user menus or buttons available.\n" + "If you need some feature or setting which is not accessible from the default keyboard configuration, you probably need a custom configuration or simply need to type a custom command. For these, you can use the internal command and configuration language.\n" + "The full specification for these is accessible at runtime using the internal help system (typing :help).\n" + "\n" + "\n.SH OPTIONS\n" + "Accepted command line \n.B\n{options}\n:\n"); + mp+=fim_dump_man_page_snippets(); + mp+=string(".SH PROGRAM RETURN STATUS\n" + "The program return status is ")+string(FIM_ERR_NO_ERROR)+string(" on correct operation; "); + mp+=string(FIM_PERR_UNSUPPORTED_DEVICE)+string(" on unsupported device specification; "); + mp+=string(FIM_PERR_BAD_PARAMS)+string(" on bad input; "); + mp+=string(FIM_PERR_GENERIC)+string(" on a generic error; "); + mp+=string(FIM_PERR_OOPS)+string(" on a signal-triggered program exit; "); + mp+=string(" or a different value in case of an another error.\n" + " The return status may be controlled by the use of the " FIM_FLT_QUIT " command.\n" + ".SH COMMON KEYS AND COMMANDS\n" +".nf\n" +"The following keys and commands are hardcoded in the minimal configuration. These are working by default before any config loading, and before the hardcoded config loading (see variable " FIM_VID_FIM_DEFAULT_CONFIG_FILE_CONTENTS ").\n\n" +//"cursor keys scroll large images\n" +//"h,j,k,l scroll large images left,down,up,right\n" +//"+, - zoom in/out\n" +//"ESC, q quit\n" +//"Tab toggle output console visualization\n" +//"PgUp,p previous image\n" +//"PgDn,n next image\n" +//"Space next image if on bottom, scroll down instead\n" +//"Return next image, write the filename of the current image to stdout on exit from the program.\n" +); + +#define FIM_ADD_DOCLINE_FOR_CMD(REP,CMD) if(cc.find_key_for_bound_cmd(CMD)!=""){if(REP!=1)mp+=FIM_XSTRINGIFY(REP);else mp+=" ";mp+=cc.find_key_for_bound_cmd(CMD);mp+=" ";if(REP!=1)mp+=FIM_XSTRINGIFY(REP);mp+=CMD;mp+="\n";} + FIM_ADD_DOCLINE_FOR_CMD(1,FIM_FLC_NEXT); + FIM_ADD_DOCLINE_FOR_CMD(1,FIM_FLC_PREV); + FIM_ADD_DOCLINE_FOR_CMD(1,FIM_FLC_NEXT_FILE); + FIM_ADD_DOCLINE_FOR_CMD(1,FIM_FLC_PREV_FILE); + FIM_ADD_DOCLINE_FOR_CMD(1,FIM_FLC_NEXT_PAGE); + FIM_ADD_DOCLINE_FOR_CMD(1,FIM_FLC_PREV_PAGE); + /* TODO: may use a search-based method for locating an keys to other commands... */ + FIM_ADD_DOCLINE_FOR_CMD(1,FIM_FLA_MAGNIFY); + FIM_ADD_DOCLINE_FOR_CMD(1,FIM_FLA_REDUCE); + //FIM_ADD_DOCLINE_FOR_CMD(1,FIM_FLC_MIRROR); + //FIM_ADD_DOCLINE_FOR_CMD(1,FIM_FLC_FLIP); + FIM_ADD_DOCLINE_FOR_CMD(1,FIM_FLC_PAN_LEFT); + FIM_ADD_DOCLINE_FOR_CMD(1,FIM_FLC_PAN_RIGHT); + FIM_ADD_DOCLINE_FOR_CMD(1,FIM_FLC_PAN_UP); + FIM_ADD_DOCLINE_FOR_CMD(1,FIM_FLC_PAN_DOWN); + FIM_ADD_DOCLINE_FOR_CMD(1,FIM_FLT_ROTATE); + FIM_ADD_DOCLINE_FOR_CMD(1,FIM_FLT_LIST); + FIM_ADD_DOCLINE_FOR_CMD(1,FIM_FLT_SCROLLDOWN); + FIM_ADD_DOCLINE_FOR_CMD(1,FIM_FLT_QUIT); + mp+="You can type a number before a command binding to iterate the assigned command:\n"; + FIM_ADD_DOCLINE_FOR_CMD(3,FIM_FLC_PAN_UP); + mp+=string( +//"d,x,D,X diagonal scroll\n" +//"C-w scale to the screen width\n" +//"H scale to the screen heigth\n" +"\n" +FIM_INTERNAL_LANGUAGE_SHORTCUT_SHORT_HELP +"\n" +//"C-n after entering in search mode (/) and submitting a pattern, C-n (pressing the Control and the n key together) will jump to the next matching filename\n" +//"C-c terminate instantaneously fim\n" +//"T split horizontally the current window\n" +//"V split vertically the current window\n" +//"C close the currently focused window\n" +//"H change the currently focused window with the one on the left\n" +//"J change the currently focused window with the lower\n" +//"K change the currently focused window with the upper\n" +//"L change the currently focused window with the one on the right\n" +//"U swap the currently focused window with the split sibling one (it is not my intention to be obscure, but precise : try V, m, U and see by yourself :) )\n" +//"d move the image diagonally north-west\n" +//"D move the image diagonally south-east\n" +//"x move the image diagonally north-east\n" +//"X move the image diagonally south-west\n" +//"m mirror\n" +//"f flip\n" +//"r rotate\n" +"\n" +"You can visualize all of the default bindings invoking fim --dump-default-fimrc | grep bind .\n" +"You can visualize all of the default aliases invoking fim --dump-default-fimrc | grep alias .\n" +"\n" +".fi\n" +".P\n" +"The Return vs. Space key thing can be used to create a file list while\n" +"reviewing the images and use the list for batch processing later on.\n" +"\n" +"All of the key bindings are reconfigurable; see the default \n" +".B fimrc\n" +"file for examples on this, or read the complete manual: the FIM.TXT file\n" +"distributed with fim.\n" + )+ + string( +".SH AFFECTING ENVIRONMENT VARIABLES\n" +".nf\n" +//"" FIM_ENV_FBFONT " (just like in fbi) a consolefont or a X11 (X Font Server - xfs) font file.\n" +"" FIM_ENV_FBFONT " (just like in fbi) a Linux consolefont font file.\n" +"If using a gzipped font, the " FIM_EPR_ZCAT " program will be used to uncompress it (via " FIM_MAN_fB("execvp(3)") ").\n" +"If not specified, the following files will be probed and the first existing will be selected:\n\n"); +mp+=get_default_font_list(); +#if FIM_WANT_HARDCODED_FONT +mp+="\nIf the special " FIM_DEFAULT_HARDCODEDFONT_STRING " string is specified, a hardcoded font will be used."; +#endif /* FIM_WANT_HARDCODED_FONT */ +mp+="\n"; +mp+=string( +//" For instance, /usr/share/consolefonts/LatArCyrHeb-08.psf.gz is a Linux console file.\n" +//" Consult 'man setfont' for your current font paths.\n" +//" NOTE : Currently xfs is disabled.\n" +"" FIM_ENV_FBGAMMA " (just like in fbi) gamma correction (applies to dithered 8 bit mode only). Default is " FIM_CNS_GAMMA_DEFAULT_STR ".\n" +"" FIM_ENV_FRAMEBUFFER " (just like in fbi) user set framebuffer device file (applies only to the " FIM_DDN_INN_FB " mode).\n" +"If unset, fim will probe for " FIM_DEFAULT_FB_FILE ".\n" +"" FIM_CNS_TERM_VAR " (only in fim) will influence the output device selection algorithm, especially if $" FIM_CNS_TERM_VAR "==\"screen\".\n" +#if defined(FIM_WITH_LIBSDL) +"" FIM_ENV_DISPLAY " If this variable is set, then the " FIM_DDN_INN_SDL " driver will be probed by default.\n" +#elif defined(FIM_WITH_LIBIMLIB2) +"" FIM_ENV_DISPLAY " If this variable is set, then the " FIM_DDN_INN_IL2 " driver will be probed by default.\n" +#endif /* FIM_WITH_LIBSDL */ +".SH COMMON PROBLEMS\n" +".B fim\n" +"needs read-write access to the framebuffer devices (/dev/fbN or /dev/fb/N), i.e you (our\n" +"your admin) have to make sure fim can open the devices in rw mode.\n" +"The IMHO most elegant way is to use pam_console (see\n" +"/etc/security/console.perms) to chown the devices to the user logged\n" +"in on the console. Another way is to create some group, chown the\n" +"special files to that group and put the users which are allowed to use\n" +"the framebuffer device into the group. You can also make the special\n" +"files world writable, but be aware of the security implications this\n" +"has. On a private box it might be fine to handle it this way\n" +"through.\n" +"\n" +"If using udev, you can edit :\n" +"/etc/udev/permissions.d/50-udev.permissions\n" +"and set these lines like here :\n" +" # fb devices\n" +" fb:root:root:0600\n" +" fb[0-9]*:root:root:0600\n" +" fb/*:root:root:0600\n" +".P\n" +"\n" +".B fim\n" +"also needs access to the linux console (i.e. /dev/ttyN) for sane\n" +"console switch handling. That is obviously no problem for console\n" +"logins, but any kind of a pseudo tty (xterm, ssh, screen, ...) will\n" +".B not\n" +"work.\n" +".SH INVOCATION EXAMPLES\n" +".B fim media/ \n" +".fi \n" +"# Will load files from the directory media.\n" +".P\n" +".P\n" +"\n" +".B fim -R media/ --sort \n" +".fi \n" +"# Will open files found by recursive traversal of directory media, then sorting the list.\n" +".P\n" +".P\n" +"\n" +".B\n" +".B find /mnt/media/ -name *.jpg | fim - \n" +".fi \n" +"# Will make fim read the file list from standard input.\n" +".P\n" +".P\n" +"\n" +".B\n" +"find /mnt/media/ -name *.jpg | shuf | fim -\n" +".fi\n" +"# will make fim read the file list from standard input, randomly shuffled.\n" +".P\n" +".P\n" +"\n" +".B\n" +"cat script.fim | fim -p images/*\n" +".fi\n" +"# Will make fim read the script file\n" +".B script.fim\n" +"from standard input prior to displaying files in the directory\n" +".B images\n" +".P\n" +".P\n" +#ifdef FIM_READ_STDIN_IMAGE +"\n" +".B \n" +"scanimage ... | tee scan.ppm | fim -i\n" +".fi\n" +"# Will make fim read the image scanned from a flatbed scanner as soon as it is read \n" +".P\n" +".P\n" +#endif /* FIM_READ_STDIN_IMAGE */ +"\n" +".B fim * > selection.txt\n" +".fi\n" +"# Will output the file names marked interactively with the '" FIM_FLT_LIST " \"mark\"' command in fim to a file.\n" +".P\n" +".P\n" +"\n" +".B fim * | fim -\n" +".fi\n" +"# will output the file names marked with 'm' in fim to a second instance of fim, in which these could be marked again.\n" +".P\n" +".P\n" +"\n" +".B fim\n-c 'pread \"vgrabbj -d /dev/video0 -o png\";reload'\n" +".fi\n" +"# will display an image grabbed from a webcam.\n" +".P\n" +".P\n" +"\n" +".B fim\n-o " FIM_DDN_INN_AA " -c 'pread \"vgrabbj -d /dev/video0 -o png\";reload;system \"fbgrab\" \"asciime.png\"'\n" +".fi\n" +"# if running in framebuffer mode, will save a png screenshot with an ASCII rendering of an image grabbed from a webcam.\n" +".P\n" +".P\n" +"\n" +".B fim\n" +"-c 'while(1){pread \"vgrabbj -d /dev/video0 -o png\";reload;sleep 1;};'\n" +".fi\n" +"# will display a sequence of images grabbed from a webcam; circa 1 per second.\n" +".P\n" +".P\n" +"\n" +".SH NOTES\n" +"This manual page is neither accurate nor complete. In particular, issues related to driver selection shall be described more accurately. Also the accurate sequence of autocommands execution, variables application is critical to understanding fim, and should be documented.\n" +#ifdef FIM_READ_STDIN_IMAGE +"The filename \"" FIM_STDIN_IMAGE_NAME "\" is reserved for images read from standard input (view this as a limitation), and thus handling files with such name may incur in limitations.\n" +#endif /* FIM_READ_STDIN_IMAGE */ +#ifdef FIM_WITH_LIBSDL +"The SDL driver is quite inefficient, for a variety of reasons. In particular, its interaction with the readline library can be problematic (e.g.: when running in sdl mode without a terminal). This shall be fixed.\n" +#endif /* FIM_WITH_LIBSDL */ +".SH BUGS\n" +".B fim\n" +"has bugs. Please read the \n" +".B BUGS\n" +"file shipped in the documentation directory to discover the known ones.\n" +".SH FILES\n" +"\n" +".TP 15\n" +".B " FIM_CNS_DOC_PATH "\n" +"The directory with \n" +".B Fim\n" +"documentation files.\n" +".TP 15\n" +".B " FIM_CNS_SYS_RC_FILEPATH "\n" +"The system wide\n" +".B Fim\n" +"initialization file (executed at startup, after executing the hardcoded configuration).\n" + +".TP 15\n" +".B " FIM_CNS_USR_RC_COMPLETE_FILEPATH "\n" +"The personal\n" +".B Fim\n" +"initialization file (executed at startup, after the system wide initialization file).\n" + +".TP 15\n" +".B ~/.inputrc\n" +"If\n.B Fim\n" +"is built with GNU readline support, it will be susceptible to chages in the user set ~/.inputrc configuration file contents. For details, see" +" (man " FIM_MAN_fR("readline") "(3))." +"\n" + )+ +string( +".SH SEE ALSO\n" +"Other \n" +".B Fim \n" +"man pages: " FIM_MAN_fR("fimgs") "(1), " FIM_MAN_fR("fimrc") "(1).\n" +".fi\n" +"Or related programs: " FIM_MAN_fR("fbset") "(1), " FIM_MAN_fR("con2fb") "(1), " FIM_MAN_fR("convert") "(1), " FIM_MAN_fR("vim") "(1), " FIM_MAN_fR("fb.modes") "(8), " FIM_MAN_fR("fbset") "(8), " FIM_MAN_fR("fbgrab") "(1), " FIM_MAN_fR("fbdev") "(4), " FIM_MAN_fR("setfont") "(8), " FIM_MAN_fR("xfs") "(1).\n" +".SH AUTHOR\n" +".nf\n" +FIM_AUTHOR" is the author of fim, \"fbi improved\". \n" +".fi\n" +".SH COPYRIGHT\n" +".nf\n" +"Copyright (C) 2007-" FIM_CNS_LCY " " FIM_AUTHOR " (author of fim)\n" +".fi\n" +"Copyright (C) 1999-2004 " FBI_AUTHOR " is the author of \"fbi\", upon which\n.B fim\nwas originally based. \n" +".P\n" +"This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\n" +".P\n" +"This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n" +".P\n" +"You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n" +)+ + string("\n"); + std::cout << mp; + return 0; +} + +fim_perr_t help_and_exit(const fim_char_t *argv0, fim_perr_t code=FIM_PERR_NO_ERROR, const fim_char_t*helparg=FIM_NULL) +{ + if(helparg&&*helparg=='b') + { + std::cout << "fim - No loadable images specified.\nUse `fim --help' for detailed usage information.\n"; + goto done; + } + if(helparg&&*helparg=='m') + { + fim_dump_man_page(); + goto done; + } + cc.printHelpMessage(argv0); + std::cout << " where OPTIONS are taken from :\n"; + if(helparg&&*helparg=='l') + std::cout << "(EXPERIMENTAL: long help ('l') printout still unsupported)\n"; + for(size_t i=0;i"; + if(fim_options[i].optdesc) + std::cout << " =" << fim_options[i].optdesc; else std::cout << " ="; + break; + case optional_argument: + if(fim_options[i].optdesc) + std::cout << " " << fim_options[i].optdesc; else std::cout << "[=arg]"; + break; + default: + ; + }; + if(helparg&&*helparg=='d') + std::cout << "\t\t " << fim_options[i].desc; + std::cout << FIM_SYM_ENDL; + //if(helparg&&*helparg=='l') std::cout << "TODO: print extended help here\n"; + } + std::cout << "\n Please read the documentation distributed with the program.\n" + << " For further help, consult the online help in fim (:" FIM_FLT_HELP "), and man fim (1), fimrc (5).\n" + << " For bug reporting read the " FIM_CNS_BUGS_FILE " file.\n"; +done: + std::exit(code); + return code; +} + + + public: + fim_perr_t main(int argc,char *argv[]) + { + fim_perr_t retcode=FIM_PERR_NO_ERROR; + /* + * an adapted version of the main function + * of the original version of the fbi program + */ + int opt_index = 0; + int i; + int want_random_shuffle=0; + #ifdef FIM_READ_STDIN + enum rsc { Nothing = 0, ImageFile = 1, FilesList = 2, Script = 3/*, Desc = 4*/ }; + int read_stdin_choice = Nothing; + int perform_sanity_check=0; + #endif /* FIM_READ_STDIN */ + int c; + int ndd=0;/* on some systems, we get 'int dup(int)', declared with attribute warn_unused_result */ + bool appendedPostInitCommand=false; + bool appendedPreConfigCommand=false; + const char * sa = FIM_NULL; + fim_flags_t pf = FIM_FLAG_DEFAULT; /* push flags */ +#if FIM_WANT_PIC_CMTS + fim_char_t sc = '\t'; /* separation character for --load-image-descriptions-file */ +#endif /* FIM_WANT_PIC_CMTS */ + + g_fim_output_device=FIM_CNS_EMPTY_STRING; + + setlocale(LC_ALL,""); //uhm.. + + { + int foi; + + for(foi=0;foi=0 && isdigit(*optarg)) + { + std::ostringstream tmp; + fim_int read_offset_u=0; + if(strchr(optarg,':')) + read_offset_u=fim_atoi(strchr(optarg,':')+1)-read_offset_l; + if(strchr(optarg,'+')) + read_offset_u=fim_atoi(strchr(optarg,'+')+1); + + tmp << FIM_VID_OPEN_OFFSET << "=" << read_offset_l << ";"; + tmp << FIM_VID_OPEN_OFFSET_RETRY<< "=" << read_offset_u << ";"; + cc.pre_autocmd_add(tmp.str()); + } + } + #endif /* FIM_AUTOCMDS */ + break; + case 'g': + //fbi's + default_fbgamma = fim_atof(optarg); + break; + case 'r': + cout << FIM_EMSG_UNFINISHED; + //fbi's + // TODO + // pcd_res = atoi(optarg); + break; + case 'R': + //fim's + pf = FIM_FLAG_PUSH_REC ; + break; + case 's': + if(fim_atoi(optarg)>0) + { + fim::string s=FIM_VID_STEPS"="; + s+=optarg; + s+=";"; + #ifdef FIM_AUTOCMDS + cc.pre_autocmd_add(s); + #endif /* FIM_AUTOCMDS */ + } + break; + // case 't': + //fbi's + // timeout = atoi(optarg); + // FIM_FPRINTF(stderr, "sorry, this feature will be implemented soon\n"); + // break; + case 'u': + want_random_shuffle=1; + break; + case 0x7073: + //FIM_FPRINTF(stderr, "sorry, this feature will be implemented soon\n"); + //fim's + want_random_shuffle=-1; + break; + case 0x736f626e: + //fim's + want_random_shuffle=c; + break; + case 0x736f7274: + //fim's + want_random_shuffle=c; + break; + case 'd': + //fbi's + default_fbdev = optarg; + break; + case 'i': + //fim's +#ifdef FIM_READ_STDIN_IMAGE + read_stdin_choice = ImageFile; +#else /* FIM_READ_STDIN_IMAGE */ + FIM_FPRINTF(stderr, FIM_EMSG_NO_READ_STDIN_IMAGE); +#endif /* FIM_READ_STDIN_IMAGE */ + break; + case 'm': + //fbi's + default_fbmode = optarg; + break; + //removed, editing features : + /* case 'f': + // fontname = optarg; + break; + case 'e': + // editable = 1; + break; + case 'b': + // backup = 1; + break; + case 'p': + // preserve = 1; + break;*/ + // case 'l': + //fbi's + // flist_add_list(optarg); + // FIM_FPRINTF(stderr, "sorry, this feature will be implemented soon\n"); + // break; + case 'T': + //fbi's virtual terminal + default_vt = atoi(optarg); + break; + case 'V': + show_version(); + return 0; + break; + case 0x4352: + //fim's + cc.appendPostInitCommand( "if(" FIM_VID_FILELISTLEN "==1){_ffn=i:" FIM_VID_FILENAME ";" FIM_FLT_CD " i:" FIM_VID_FILENAME ";" FIM_FLT_LIST " 'remove' i:" FIM_VID_FILENAME ";" FIM_FLT_BASENAME " _ffn;_bfn='./'." FIM_VID_LAST_SYSTEM_OUTPUT ";" FIM_FLT_LIST " 'pushdir' '.';" FIM_FLT_LIST " 'sort';" FIM_FLT_GOTO " '?'._bfn;" FIM_FLT_RELOAD ";" FIM_FLT_REDISPLAY ";}if(" FIM_VID_FILELISTLEN "==0){" FIM_FLT_STDOUT " 'No files loaded: exiting.';" FIM_FLT_QUIT " 0;}"); + appendedPostInitCommand=true; + break; + case 'c': + //fim's + cc.appendPostInitCommand(optarg); + appendedPostInitCommand=true; + break; + case 'C': + //fim's + cc.appendPreConfigCommand(optarg); + appendedPreConfigCommand=true; + break; + case 'W': + //fim's + cc.setVariable(FIM_VID_SCRIPTOUT_FILE,optarg); + #ifdef FIM_AUTOCMDS + cc.pre_autocmd_add(FIM_FLT_RECORDING" 'start';"); + cc.appendPostExecutionCommand(FIM_FLT_RECORDING" 'stop';"); + #endif /* FIM_AUTOCMDS */ + break; + case 'F': + //fim's + cc.appendPostExecutionCommand(optarg); + break; + case 'E': + //fim's + #ifndef FIM_WANT_NOSCRIPTING + cc.push_scriptfile(optarg); + #else /* FIM_WANT_NOSCRIPTING */ + cout << FIM_EMSG_NO_SCRIPTING; + #endif /* FIM_WANT_NOSCRIPTING */ + break; + case 'p': + //fim's (differing semantics from fbi's) + #ifndef FIM_WANT_NOSCRIPTING + read_stdin_choice = Script; + #else /* FIM_WANT_NOSCRIPTING */ + cout << FIM_EMSG_NO_SCRIPTING; + #endif /* FIM_WANT_NOSCRIPTING */ + break; + case 'D': + //fim's + // cc.setNoFrameBuffer(); // no framebuffer (debug) mode + cc.dumpDefaultFimrc(); + std::exit(0); + break; + case 'N': + //fim's + cc.setVariable(FIM_VID_NO_RC_FILE,(fim_int)1); + break; + case 0x4E4E4E:// NNN + //fim's + cc.setVariable(FIM_VID_NO_DEFAULT_CONFIGURATION,(fim_int)1); + break; + case 0x4E4E:// NN + //fim's + cc.setVariable(FIM_VID_LOAD_DEFAULT_ETC_FIMRC,(fim_int)0); + break; + case 0x4E434C:// NCL + //fim's + cc.setVariable(FIM_VID_CONSOLE_KEY,(fim_int)-1); + break; +#if FIM_WANT_HISTORY + case 0x4E484C:// NHL + //fim's + cc.setVariable(FIM_VID_LOAD_FIM_HISTORY,(fim_int)-1); + break; + case 0x4E4853:// NHS + //fim's + cc.setVariable(FIM_VID_SAVE_FIM_HISTORY,(fim_int)-1); + break; + case 0x4E48:// NH + //fim's + cc.setVariable(FIM_VID_SAVE_FIM_HISTORY,(fim_int)-1); + cc.setVariable(FIM_VID_LOAD_FIM_HISTORY,(fim_int)-1); + break; +#endif /* FIM_WANT_HISTORY */ + case 't': + //fim's + #ifdef FIM_WITH_AALIB + g_fim_output_device=FIM_DDN_INN_AA; + #else /* FIM_WITH_AALIB */ + std::cerr << "you should recompile fim with aalib support!\n"; + g_fim_output_device=FIM_DDN_INN_DUMB; + #endif /* FIM_WITH_AALIB */ + break; + case 'o': + //fim's + g_fim_output_device=optarg; +#if FIM_WANT_OUTPUT_DEVICE_STRING_CASE_INSENSITIVE + { + int si=g_fim_output_device.find(FIM_SYM_DEVOPTS_SEP_STR); + if(si>0);else si=g_fim_output_device.end()-g_fim_output_device.begin(); + transform(g_fim_output_device.begin(), si+g_fim_output_device.begin(), g_fim_output_device.begin(),(int (*)(int))tolower); + } +#endif /* FIM_WANT_OUTPUT_DEVICE_STRING_CASE_INSENSITIVE */ + break; + case 0x6472690a: + //fim's + { + args_t args; + if(optarg) + args.push_back(optarg); + cc.dump_reference_manual(args); + std::exit(0); + } + break; +#if FIM_WANT_PIC_CMTS + case 0x69646673: + if(optarg) + sc = *optarg; + break; + case 0x6c696466: + cc.id_.fetch(optarg,sc); + cc.setVariable(FIM_VID_COMMENT_OI,(fim_int)FIM_OSW_LOAD_IMG_DSC_FILE_VID_COMMENT_OI_VAL); + break; +#endif /* FIM_WANT_PIC_CMTS */ + #ifdef FIM_READ_STDIN + case '-': + //fim's + read_stdin_choice = FilesList; + break; + case 0x72667373: + sa = optarg; + break; + case 0: + //fim's + read_stdin_choice = FilesList; + break; + #endif /* FIM_READ_STDIN */ + default: + case 'h': + help_and_exit(argv[0],FIM_PERR_NO_ERROR,optarg); + } + } + for (i = optind; i < argc; i++) + { + #ifdef FIM_READ_STDIN + if(*argv[i]=='-'&&!argv[i][1]) + read_stdin_choice = FilesList; + else + #endif /* FIM_READ_STDIN */ + { + cc.push(argv[i],pf); + } + } + + lexer=new yyFlexLexer; //used by YYLEX + if(!lexer) + { + FIM_FPRINTF(stderr, "error while allocating the lexer!\n\n"); + retcode=-1; + goto ret; + } + + #ifdef FIM_READ_STDIN + if( ( read_stdin_choice == FilesList ) + + #ifdef FIM_READ_STDIN_IMAGE + ( read_stdin_choice == ImageFile ) + + #endif /* FIM_READ_STDIN_IMAGE */ + ( read_stdin_choice == Script ) > 1 ) + { + /* FIXME: this case is now useless. Shall rather implement a warning for when -p and -i overlap. */ + FIM_FPRINTF(stderr, "error : you shouldn't specify more than one standard input reading options among (-, -p" +#ifdef FIM_READ_STDIN_IMAGE + ", -i" +#endif /* FIM_READ_STDIN_IMAGE */ + ")!\n\n"); + retcode=help_and_exit(argv[0],FIM_PERR_NO_ERROR,"b");/* should return 0 or -1 ? */ + goto ret; + } + /* + * this is Vim's solution for stdin reading + * */ + if( read_stdin_choice == FilesList ) + { + bool wv = false; /*cc.pre_autocmd_add(FIM_VID_DISPLAY_STATUS"=...;");*/ /* or verbose ... */ + fim_char_t *lineptr=FIM_NULL; + size_t bs=0; + int fc=0; + + while(fim_getline(&lineptr,&bs,stdin)>0) + { + chomp(lineptr); + + if(sa && lineptr && strstr(lineptr,sa)) + *strstr(lineptr,sa) = FIM_SYM_CHAR_NUL; + cc.push(lineptr,pf); + // printf("%s\n",lineptr); + lineptr=FIM_NULL; + if(wv) + ++fc, printf("%s %d\n",FIM_CNS_CLEARTERM,fc); + } + if(lineptr) + fim_free(lineptr); + close(0); + ndd=dup(2); + } + #ifdef FIM_READ_STDIN_IMAGE + else + if( read_stdin_choice == ImageFile ) + { +#if !FIM_WANT_STDIN_FILELOAD_AFTER_CONFIG + cc.fpush(fim_fread_tmpfile(stdin)); + close(0); + ndd=dup(2); +#endif /* FIM_WANT_STDIN_FILELOAD_AFTER_CONFIG */ + } + #endif /* FIM_READ_STDIN_IMAGE */ + else + if( read_stdin_choice == Script ) + { + fim_char_t* buf; + buf=slurp_binary_fd(0,FIM_NULL); + if(buf) + cc.appendPostInitCommand(buf); + if(buf) + appendedPostInitCommand=true; + // if(buf) appendedPreConfigCommand=true; + if(buf) + fim_free(buf); + close(0); + ndd=dup(2); + } + #endif + if(want_random_shuffle== 1) + cc.browser_._random_shuffle(true); + if(want_random_shuffle==-1) + cc.browser_._random_shuffle(false); + if(want_random_shuffle==0x736f7274) + cc.browser_._sort(); + if(want_random_shuffle==0x736f626e) + cc.browser_._sort('b'); + + if(ndd==-1) + fim_perror(FIM_NULL); + + if(cc.browser_.empty_file_list() +#ifndef FIM_WANT_NOSCRIPTING + && !cc.with_scriptfile() +#endif /* FIM_WANT_NOSCRIPTING */ + && !appendedPostInitCommand + && !appendedPreConfigCommand + #ifdef FIM_READ_STDIN_IMAGE + && ( read_stdin_choice != ImageFile ) + #endif /* FIM_READ_STDIN_IMAGE */ + && !perform_sanity_check + ) + { + retcode=help_and_exit(argv[0],FIM_PERR_BAD_PARAMS,"b");goto ret; + } + + /* output device guess */ + if( g_fim_output_device==FIM_CNS_EMPTY_STRING ) + { + #if defined(FIM_WITH_LIBSDL) || defined(FIM_WITH_LIBIMLIB2) + /* check to see if we are under X */ + if( fim_getenv(FIM_ENV_DISPLAY) ) + { + #ifdef FIM_WITH_LIBIMLIB2 + g_fim_output_device=FIM_DDN_INN_IL2; + #endif /* FIM_WITH_LIBIMLIB2 */ + #ifdef FIM_WITH_LIBSDL + g_fim_output_device=FIM_DDN_INN_SDL; + #endif /* FIM_WITH_LIBSDL */ + } + else + #endif +#ifndef FIM_WITH_NO_FRAMEBUFFER + g_fim_output_device=FIM_DDN_INN_FB; +#else /* FIM_WITH_NO_FRAMEBUFFER */ + #ifdef FIM_WITH_AALIB + g_fim_output_device=FIM_DDN_INN_AA; + #else /* FIM_WITH_AALIB */ + g_fim_output_device=FIM_DDN_INN_DUMB ; + #endif /* FIM_WITH_AALIB */ +#endif //#ifndef FIM_WITH_NO_FRAMEBUFFER + } + + // TODO : we still need a good output device probing mechanism + + if((retcode=FIM_ERR_TO_PERR(cc.init(g_fim_output_device)))!=FIM_PERR_NO_ERROR) {goto ret;} +#ifdef FIM_READ_STDIN_IMAGE +#if FIM_WANT_STDIN_FILELOAD_AFTER_CONFIG + if( read_stdin_choice == ImageFile ) + { + cc.fpush(fim_fread_tmpfile(stdin)); + close(0); + //fclose(stdin); + ndd=dup(2); + } +#endif /* FIM_WANT_STDIN_FILELOAD_AFTER_CONFIG */ +#endif /* FIM_READ_STDIN_IMAGE */ + retcode=cc.executionCycle();/* note that this could not return */ +ret: + return retcode; + } + +}; + +fim_perr_t main(int argc,char *argv[]) +{ + /* + * FimInstance will encapsulate all of the fim's code someday. + * ...someday. + * */ + FimInstance fiminstance; + + fim::fim_var_help_db_init(); + return fiminstance.main(argc,argv); +} + + /* FIXME: we are including files here. + * this is a horrible programming practice and shall be fixed. */ +#ifdef FIM_WITH_LIBPNG +#include +#endif /* FIM_WITH_LIBPNG */ +#ifdef HAVE_LIBJPEG +#include +#endif /* HAVE_LIBJPEG */ +#ifdef FIM_HANDLE_TIFF +#include +#endif /* FIM_HANDLE_TIFF */ +#ifdef FIM_HANDLE_GIF +#include +#endif /* FIM_HANDLE_GIF */ +#ifdef FIM_USE_READLINE +#include "readline.h" +#endif /* FIM_USE_READLINE */ +#if 0 /* namespace clashes */ +#ifdef HAVE_LIBGRAPHICSMAGICK +#include +#include +#endif /* HAVE_LIBGRAPHICSMAGICK */ +#endif +///#ifdef HAVE_LIBPOPPLER +//#include // getPDFMajorVersion getPDFMinorVersion +//#endif /* HAVE_LIBPOPPLER */ + + void FimInstance::show_version(void) + { + FIM_FPRINTF(stderr, + FIM_CNS_FIM" " + #ifdef FIM_VERSION + FIM_VERSION + #endif /* FIM_VERSION */ + #ifdef SVN_REVISION + " ( repository version " + SVN_REVISION + " )" + #else /* SVN_REVISION */ + /* obsolete */ + # define FIM_REPOSITORY_VERSION "$LastChangedDate: 2017-07-29 11:04:00 +0200 (Sat, 29 Jul 2017) $" + # ifdef FIM_REPOSITORY_VERSION + " ( repository version " + FIM_REPOSITORY_VERSION + " )" + # endif /* FIM_REPOSITORY_VERSION */ + #endif /* SVN_REVISION */ + #ifdef FIM_AUTHOR + ", by " + FIM_AUTHOR + #endif /* FIM_AUTHOR */ +#define FIM_WANT_REPRODUCIBLE_BUILDS 1 +#if !FIM_WANT_REPRODUCIBLE_BUILDS + ", built on %s\n", + __DATE__ +#endif + " ( based on fbi version 1.31 (c) by 1999-2004 " FBI_AUTHOR_NAME " )\n" + #ifdef FIM_WITH_LIBPNG + #ifdef PNG_HEADER_VERSION_STRING + "Compiled with " PNG_HEADER_VERSION_STRING "" + #endif /* PNG_HEADER_VERSION_STRING */ + #endif /* FIM_WITH_LIBPNG */ + #ifdef FIM_HANDLE_GIF + #if defined(GIFLIB_MAJOR) && defined(GIFLIB_MINOR) && defined(GIFLIB_RELEASE) + "Compiled with libgif, " FIM_XSTRINGIFY(GIFLIB_MAJOR) "." FIM_XSTRINGIFY(GIFLIB_MINOR) "." FIM_XSTRINGIFY(GIFLIB_RELEASE) ".\n" + #else /* GIFLIB_MAJOR GIFLIB_MINOR GIFLIB_RELEASE */ + #ifdef GIF_LIB_VERSION + "Compiled with libgif, " GIF_LIB_VERSION ".\n" + #endif /* GIF_LIB_VERSION */ + #endif /* GIFLIB_MAJOR GIFLIB_MINOR GIFLIB_RELEASE */ + #endif /* FIM_HANDLE_GIF */ + #ifdef HAVE_LIBJPEG + #ifdef JPEG_LIB_VERSION + "Compiled with libjpeg, v." FIM_XSTRINGIFY(JPEG_LIB_VERSION) ".\n" + #endif /* JPEG_LIB_VERSION */ + #endif /* HAVE_LIBJPEG */ +#if 0 /* namespace clashes */ + #ifdef HAVE_LIBGRAPHICSMAGICK + #ifdef MagickLibVersionText + "Compiled with GraphicsMagick, v."MagickLibVersionText".\n" + #endif /* MagickLibVersionText */ + #endif /* HAVE_LIBGRAPHICSMAGICK */ +#endif + #ifdef FIM_USE_READLINE + // TODO: shall use RL_READLINE_VERSION instead + #if defined(RL_VERSION_MINOR) && defined(RL_VERSION_MAJOR) && ((RL_VERSION_MAJOR)>=6) + "Compiled with readline, v." FIM_XSTRINGIFY(RL_VERSION_MAJOR) "." FIM_XSTRINGIFY(RL_VERSION_MINOR) ".\n" + #else + "Compiled with readline, version unknown.\n" + #endif /* defined(RL_VERSION_MINOR) && defined(RL_VERSION_MAJOR) && ((RL_VERSION_MAJOR)>=6) */ + #endif /* FIM_USE_READLINE */ + // for TIFF need TIFFGetVersion + #ifdef FIM_CONFIGURATION + "Configuration invocation: " FIM_CONFIGURATION "\n" + #endif /* FIM_CONFIGURATION */ + #ifdef CXXFLAGS + "Compile flags: CXXFLAGS=" CXXFLAGS + #ifdef CFLAGS + " CFLAGS=" CFLAGS + #endif /* CFLAGS */ + "\n" + #endif /* CXXFLAGS */ + "Fim options (features included (+) or not (-)):\n" + #include "version.h" + /* i think some flags are missing .. */ + "\nSupported output devices (for --" FIM_OSW_OUTPUT_DEVICE "): " + #ifdef FIM_WITH_AALIB + " " FIM_DDN_INN_AA + #endif /* FIM_WITH_AALIB */ + #ifdef FIM_WITH_CACALIB + " " FIM_DDN_INN_CACA + #endif /* FIM_WITH_CACALIB */ + #ifdef FIM_WITH_LIBIMLIB2 + " " FIM_DDN_INN_IL2 + #endif /* FIM_WITH_LIBIMLIB2 */ + #ifdef FIM_WITH_LIBSDL + " " FIM_DDN_INN_SDL + #endif /* FIM_WITH_LIBSDL */ +#ifndef FIM_WITH_NO_FRAMEBUFFER + " " FIM_DDN_INN_FB +#endif //#ifndef FIM_WITH_NO_FRAMEBUFFER + #if 1 + " " FIM_DDN_INN_DUMB + #endif + "\n" + "\nSupported file formats: " +#ifdef ENABLE_PDF + " pdf" +#endif /* ENABLE_PDF */ +#ifdef HAVE_LIBSPECTRE + " ps" +#endif /* HAVE_LIBSPECTRE */ +#ifdef HAVE_LIBDJVU + " djvu" +#endif /* HAVE_LIBDJVU */ +#ifdef HAVE_LIBJPEG + " jpeg" +#endif /* HAVE_LIBJPEG */ +#ifdef FIM_HANDLE_TIFF + " tiff" +#endif /* FIM_HANDLE_TIFF */ +#ifdef FIM_HANDLE_GIF + " gif" +#endif /* FIM_HANDLE_GIF */ +#ifdef FIM_WITH_LIBPNG + " png" +#endif /* FIM_WITH_LIBPNG */ + " ppm" /* no library is needed for these */ + " bmp" +#ifdef HAVE_MATRIX_MARKET_DECODER + " mtx (Matrix Market)" +#endif /* HAVE_MATRIX_MARKET_DECODER */ + "\n" + ); + + fim_loaders_to_stderr(); + } + /* WARNING: PLEASE DO NOT WRITE ANY MORE CODE AFTER THIS DECLARATION (RIGHT ABOVE, AN UNCLEAN CODING PRACTICE WAS USED) */ + diff --git a/src/fim.h b/src/fim.h new file mode 100644 index 0000000..badf686 --- /dev/null +++ b/src/fim.h @@ -0,0 +1,936 @@ +/* $LastChangedDate: 2017-07-23 09:45:48 +0200 (Sun, 23 Jul 2017) $ */ +/* + fim.h : Fim main header file + + (c) 2007-2017 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +#ifndef FIM_FIM_H +#define FIM_FIM_H +#define NDEBUG 1 /* turns off assert() functionality */ + + +/* + * config.h is generated by autoconf and defines some symbols used by Fim + * */ +#ifdef HAVE_CONFIG_H +/* + * when we get rid of string.h we will use , too +#include +*/ +#include "../config.h" +#endif /* HAVE_CONFIG_H */ + +/* + * This is the main fim program header file. + * Estabilished 20061225 ( yes, i know what do you think about me now ) + * */ +#include /* standard C library definitions */ +#include /* standard C buffered I/O */ + +#include /* standard C string manipulation functions */ +#include /* C++ I/O stream manipulation ( cout,cin, ... ) */ +#include /* STL (Standard Template Library) algorithm library */ +#include /* STL (Standard Template Library) associative array template */ +#include /* STL (Standard Template Library) stack structure template */ + +#include /* STL (Standard Template Library) vector structure template */ +#include /* STL (Standard Template Library) ? */ +#include /* STL (Standard Template Library) list structure template */ +#include /* STL (Standard Template Library) set structure template */ +#include /* C assertions ( IEEE Std 1003.1-2001 aka Posix ) */ + +#ifndef USE_GNU_REGEX +# include /* the Posix (GNU implementation,not functionality) readline library */ +#else +# include "regex.h" /* the GNU (implementation and functionality) readline library */ +#endif /* USE_GNU_REGEX */ + +#ifdef HAVE_CLIMITS + #include + /* From: + * ISO C++ 14882: 18.2.2 Implementation properties: C library + * we get some more stuff than limits.h. */ +#else /* HAVE_CLIMITS */ + #ifdef HAVE_LIMITS_H + /* According to IEEE Std 1003.1-2001, + * this should define _POSIX_PATH_MAX + * */ + #include + #endif /* HAVE_LIMITS_H */ +#endif /* HAVE_LIMITS_H */ +#ifndef _POSIX_PATH_MAX + /* I don't know in what case could arise this situation + * (no limits.h nor climits : i guess a badly configured system), + * but this would be the fix :*/ + #define _POSIX_PATH_MAX 4096 +#endif /* _POSIX_PATH_MAX */ + +/* FIXME : should create some fim specific sys.h header, some day */ +#include /* stat */ +#include /* stat */ +#include /* stat */ +#ifdef FIM_WITH_PTHREADS +#include /* */ +#endif /* FIM_WITH_PTHREADS */ + +#if 0 +#ifdef HAVE_UNIX_H +# include +# ifndef _POSIX_PATH_MAX +# include +# ifndef _POSIX_PATH_MAX +/* a strict limit to pathname length */ +# define _POSIX_PATH_MAX 4096 +# endif +# endif +#else +#endif +#endif +#define FIM_PATH_MAX _POSIX_PATH_MAX + +#include /* general terminal interface (Posix) */ +#include /* file descriptor manipulation interface (Posix) */ +#include /* time related functionality (Posix) */ +#include "common.h" /* misc FIM stuff */ +/* #define FIM_USE_GPM 0 */ +#ifdef FIM_USE_GPM +#include /* mouse events */ +#endif /* FIM_USE_GPM */ +/*#include */ /* standard Posix symbolic constants and types */ +/*#include */ +/*#include */ +#include + +#define FIM_LINE_CERR std::cerr << "fatal error" << __FILE__ << ":" << __LINE__ << "\n"; +#define FIM_LINE_COUT std::cout << "in " <<__func__ << " # " << __FILE__ << ":" << __LINE__ << "\n"; +#define FIM_INT_PCNT(P,L) ((fim_int)ceilf((float)((P)*(L))/100.0)) //FIXME: gross errors may occur here +#define FIM_FLT_PCNT(P,L) ((fim_float_t)ceilf((float)((P)*(L))/100.0)) //FIXME: gross errors may occur here +#define FIM_INT_PCNT_OF_100(P,L) (FIM_MIN(FIM_INT_PCNT(P,L),L)) +#define FIM_FLT_PCNT_OF_100(P,L) (FIM_MIN(FIM_FLT_PCNT(P,L),L)) +#define FIM_INT_PCNT_SAFE(P,L) FIM_INT_PCNT(FIM_MIN(100,FIM_MAX(P,0)),(L)) +#define FIM_INT_DET_PCNT(P,T) ( (fim_int) ((((double)(P))/((double)(T)))*100.0) ) +#define FIM_DELIMIT_TO_100(X) FIM_MIN(FIM_MAX(X,0),100) +#define FIM_XOR(X,Y) ((X)^(Y)) + +#include "fim_types.h" +#include "fim_limits.h" +#include "fim_wrappers.h" + +#define FIM_WANT_REMEMBER_LAST_FILE_LOADER 1 /* TODO: shall use this feature to set a i:file_loader attribute; FIXME: move this down */ +#define FIM_WANT_BENCHMARKS 1 /* FIXME: move this down */ +#define FIM_ALLOW_LOADER_VERBOSITY 1 +#define FIM_WANT_FAT_BROWSER 1 +#define FIM_WANT_BDI 1 +#define FIM_WANT_EXPERIMENTAL_MIPMAPS 1 +#define FIM_WANT_GOTOLAST 1 +#define FIM_WANT_PIC_CMTS 1 +#define FIM_OSW_LOAD_IMG_DSC_FILE_VID_COMMENT_OI_VAL 2 +#define FIM_WANT_PIC_LVDN 1 /* pictures load variables description namespace (FIXME: experimental) */ +#define FIM_WANT_PIC_LBFL 1 /* limit browser file list (see FIM_FLT_LIMIT) */ +#define FIM_WANT_PIC_RCMT 1 /* remember last comment with special "#!fim:=" syntax */ +#define FIM_EXPERIMENTAL_IMG_NMSPC 1 +#define FIM_EXPERIMENTAL_VAR_EXPANDOS 1 +#define FIM_FONT_MAGNIFY_FACTOR 1 /* EXPERIMENTAL,UNFINISHED: this only works on SDL and breaks the rest. Keep to 1. */ + +#ifdef FIM_AUTOCMDS +#define FIM_AUTOCMD_EXEC autocmd_exec +#else /* FIM_AUTOCMDS */ +#define FIM_AUTOCMD_EXEC +#endif /* FIM_AUTOCMDS */ + + fim::string fim_help_opt(const char*qs); +namespace fim +{ + typedef std::map sym_keys_t; //symbol->code + void status(const fim_char_t *desc, const fim_char_t *info); + +class ViewportState +{ + public: + fim_off_t steps_,hsteps_,vsteps_,top_,left_,panned_ ; /* viewport variables */ + ViewportState() :steps_(0) ,hsteps_(0) ,vsteps_(0) ,top_(0) ,left_(0) ,panned_(0x0) {} +}; + + class Arg; + class Browser; + class FontServer; + class FramebufferDevice; + class CommandConsole; + class Command; + class Foo; + class Image; + class Var; + class MiniConsole; +#ifdef FIM_WINDOWS + class FimWindow; +#endif /* FIM_WINDOWS */ + class Viewport; + class fim_stream; +} + +namespace rl +{ + void initialize_readline (fim_bool_t with_no_display_device); +} + +/* using GCC builtins (__GNUC__ should be defined by gcc) */ + +#ifndef FIM_IS_SLOWER_THAN_FBI + #define FIM_UNLIKELY(expr) __builtin_expect(!!(expr),0) + #define FIM_LIKELY(expr) __builtin_expect(!!(expr),1) + #define FIM_ALIGNED __attribute__((aligned (64))) +#else /* FIM_IS_SLOWER_THAN_FBI */ + #define FIM_UNLIKELY(expr) (expr) + #define FIM_LIKELY(expr) (expr) + #define FIM_ALIGNED +#endif /* FIM_IS_SLOWER_THAN_FBI */ + +//#define FIM_FBI_PRINTF( ... ) fprintf(stderr, __VA_ARGS__ ) +/* " warning: anonymous variadic macros were introduced in C99" (here and elsewhere) */ +#define FIM_NO_OP_STATEMENT 1 +#define FIM_FBI_PRINTF( ... ) FIM_NO_OP_STATEMENT +#define FIM_VERB_PRINTF printf + +namespace fim{ +enum fim_image_source_t FIM_ENUM_BASE { FIM_E_FILE=-11, FIM_E_STDIN=-22}; /* these */ +enum fim_xflags_t /*FIM_ENUM_BASE*/ { FIM_X_NULL=0,FIM_X_HISTORY=1,FIM_X_QUIET=2,FIM_X_NOAUTOCMD=4}; /* TODO: may introduce 'sandbox' like flags, here (for instance, for no-system/pipe-interacting executions) */ +typedef std::pair cache_key_t; //the current cache key +enum FimDocRefMode FIM_ENUM_BASE { Txt, Man, DefRefMode=Txt}; +} +typedef std::vector args_t; +#define FIM_STDIN_IMAGE_NAME "" +/* should belong to a namespace different from the file name space, and possibly figuring alphabetically as the first one */ + + +/* + * Fim Symbols + * */ +#define FIM_SYM_CONSOLE_KEY ':' +#define FIM_SYM_CONSOLE_KEY_STR ":" +#define FIM_SYM_FW_SEARCH_KEY '/' +#define FIM_SYM_BW_SEARCH_KEY '?' +#define FIM_SYM_NULL_KEY 0 +#define FIM_SYM_NAMESPACE_SEP ':' +#define FIM_SYM_DEVOPTS_SEP '=' +#define FIM_SYM_DEVOPTS_SEP_STR "=" +#define FIM_SYM_NULL_NAMESPACE_CHAR '\0' +#define FIM_SYM_NAMESPACE_BROWSER_CHAR 'b' +#define FIM_SYM_NAMESPACE_IMAGE_CHAR 'i' +#define FIM_SYM_NAMESPACE_IMAGE_ALL_STR "i:*" +#define FIM_SYM_NAMESPACE_GLOBAL_CHAR 'g' +#define FIM_SYM_NAMESPACE_WINDOW_CHAR 'w' +#define FIM_SYM_NAMESPACE_VIEWPORT_CHAR 'v' +/* #define FIM_SYM_NAMESPACE_PREFIXES "'i:', 'b:', 'w:', 'v:', 'g:'" */ +/* #define FIM_SYM_NAMESPACE_PREFIXES_DSC "current image, browser, window, viewport, global" */ +/* #define FIM_SYM_NAMESPACE_REGEX "^[givbw]:" */ +#define FIM_SYM_NAMESPACE_PREFIXES "'i:'" /* removed g: because is not mandatory */ +#define FIM_SYM_NAMESPACE_PREFIXES_DSC "current image, global" +#define FIM_SYM_NAMESPACE_REGEX "^[gi]:" +#define FIM_SYM_PROMPT_CHAR ':' +#define FIM_SYM_PROMPT_SLASH '/' +#define FIM_SYM_PROMPT_NUL '\0' +#define FIM_SYM_CHAR_NUL '\0' +#define FIM_SYM_ESC 0x1B +#define FIM_SYM_ENTER 0x0D +#define FIM_SYM_FLIPCHAR 'F' +#define FIM_SYM_MIRRCHAR 'M' +#define FIM_SYM_TYPE_FLOAT 'f' +#define FIM_SYM_TYPE_INT 'i' +#define FIM_SYM_STRING_CONCAT '.' +#define FIM_SYM_DOT_CHAR '.' +#define FIM_SYM_SEMICOLON ';' +#define FIM_SYM_SEMICOLON_STRING ";" +#define FIM_SYM_ENDL "\n" +#define FIM_SYM_PIC_CMT_CHAR '#' + +/* + * External programs used by fim. + */ +#define FIM_EPR_FIG2DEV "fig2dev" +#define FIM_EPR_XCFTOPNM "xcftopnm" +#define FIM_EPR_DIA "dia" +#define FIM_EPR_INKSCAPE "inkscape" +#define FIM_EPR_CONVERT "convert" +#define FIM_EPR_ZCAT "zcat" + +/* + * Some Fim (internal) error codes. + */ +#define FIM_ERR_NO_ERROR 0 +#define FIM_ERR_GENERIC -1 +#define FIM_ERR_UNSUPPORTED -2 +#define FIM_ERR_BUFFER_FULL -1024 // FIXME: -2 seems in use +#define FIM_ERR_UNSUPPORTED_DEVICE -4 +#define FIM_ERR_BAD_PARAMS -8 +#define FIM_ERR_OOPS 42 + +#define FIM_ERR_TO_PERR(E) (((unsigned char)(E))) + +/* + * Some Fim (program) error codes. + */ +#define FIM_PERR_NO_ERROR FIM_ERR_TO_PERR(FIM_ERR_NO_ERROR) +#define FIM_PERR_GENERIC FIM_ERR_TO_PERR(FIM_ERR_GENERIC) +#define FIM_PERR_UNSUPPORTED FIM_ERR_TO_PERR(FIM_ERR_UNSUPPORTED) +//#define FIM_PERR_BUFFER_FULL FIM_ERR_TO_PERR(FIM_ERR_BUFFER_FULL) +#define FIM_PERR_UNSUPPORTED_DEVICE FIM_ERR_TO_PERR(FIM_ERR_UNSUPPORTED_DEVICE) +#define FIM_PERR_BAD_PARAMS FIM_ERR_TO_PERR(FIM_ERR_BAD_PARAMS) +#define FIM_PERR_OOPS FIM_ERR_TO_PERR(FIM_ERR_OOPS) + +/* + * Some Fim error messages. + */ +#define FIM_EMSG_NO_SCRIPTING "sorry, no scripting available!\n" +#define FIM_EMSG_NO_READ_STDIN_IMAGE "sorry, the reading of images from stdin was disabled at compile time\n" +#define FIM_EMSG_CACHING_STDIN "problems caching standard input image!\n" +#define FIM_EMSG_OUT_OF_MEM "out of memory\n" +#define FIM_EMSG_UNFINISHED "sorry, feature incomplete!\n" + +/* Command related error messages */ +#define FIM_EMSG_NOMARKUNMARK "sorry, mark/unmark functionality was opted out." + +/* + * Some environment variables used by Fim. + */ +#define FIM_ENV_DISPLAY "DISPLAY" +#define FIM_ENV_FRAMEBUFFER "FRAMEBUFFER" +#define FIM_ENV_FBGAMMA "FBGAMMA" +#define FIM_ENV_FBFONT "FBFONT" + +/* + * Fim Option (long) Switches + * */ +#define FIM_OSW_OUTPUT_DEVICE "output-device" +#define FIM_OSW_BINARY "binary" +#define FIM_OSW_TEXT "as-text" +#define FIM_OSW_EXECUTE_COMMANDS "execute-commands" +#define FIM_OSW_EXECUTE_COMMANDS_EARLY "execute-commands-early" +#define FIM_OSW_EXECUTE_SCRIPT "execute-script" +#define FIM_OSW_FINAL_COMMANDS "final-commands" +#define FIM_OSW_SCRIPT_FROM_STDIN "script-from-stdin" +#define FIM_OSW_IMAGE_FROM_STDIN "image-from-stdin" +#define FIM_OSW_DUMP_SCRIPTOUT "write-scriptout" +#define FIM_OSW_LOAD_IMG_DSC_FILE "load-image-descriptions-file" +#define FIM_OSW_IMG_DSC_FILE_SEPC "image-descriptions-file-separator" + +/* + * Fim Constants + * */ +#define FIM_CNS_FIM "FIM - Fbi IMproved" +#define FIM_CNS_LCY "2016" /* latest copyright year */ +//#define FIM_CNS_FIM_TXT "FIM.TXT" +#define FIM_CNS_BUGS_FILE "BUGS" +#define FIM_CNS_TERM_VAR "TERM" +#define FIM_CNS_HOME_VAR "HOME" +#define FIM_CNS_HIST_FILENAME ".fim_history" +#define FIM_CNS_HIST_COMPLETE_FILENAME "~/.fim_history" +#define FIM_CNS_SYS_RC_FILEPATH "@sysconfdir@/fimrc" +#define FIM_CNS_DOC_PATH "@docdir@" +#define FIM_CNS_USR_RC_FILEPATH ".fimrc" +#define FIM_CNS_USR_RC_COMPLETE_FILEPATH "~/.fimrc" +#define FIM_CNS_EXAMPLE_FILENAME "file.jpg" +#define FIM_CNS_SCALEFACTOR 1.322f +#define FIM_CNS_SCALEFACTOR_ONE 1.0f +#define FIM_CNS_ANGLE_ONE 1.0f +#define FIM_CNS_ANGLE_ZERO 0.0f +#define FIM_CNS_GAMMA_DEFAULT 1.0 +#define FIM_CNS_GAMMA_DEFAULT_STR FIM_XSTRINGIFY(FIM_CNS_GAMMA_DEFAULT) +#define FIM_CNS_SCALEFACTOR_MULTIPLIER 1.1f +#define FIM_CNS_SCALEFACTOR_DELTA 0.1f +#define FIM_CNS_SCALEFACTOR_ZERO 0.0f +//#define FIM_CNS_STEPS_DEFAULT 50 +#define FIM_CNS_SCROLL_DEFAULT "90%" +#define FIM_CNS_STEPS_DEFAULT_N 50 +#define FIM_CNS_STEPS_DEFAULT "20%" +#define FIM_CNS_STEPS_DEFAULT_P true /* FIXME */ +#define FIM_CNS_STEPS_MIN 1 +#define FIM_CNS_WGROW_STEPS_DEFAULT 1 +#define FIM_CNS_WENLARGE_STEPS_DEFAULT 10 +#define FIM_CNS_SCALEDELTA 0.01f +#define FIM_CNS_EMPTY_STRING "" +#define FIM_CNS_NEWLINE "\n" +//#define FIM_CNS_NEWLINE std::endl +#define FIM_CNS_DEFAULT_IFNAME FIM_CNS_EMPTY_STRING +#define FIM_CNS_SLASH_CHAR '/' /* directory delimiter */ +#define FIM_CNS_SLASH_STRING "/" /* directory delimiter */ +#define FIM_CNS_QU_MA_STRING "?" /* */ +#define FIM_CNS_DIRSEP_STRING FIM_CNS_SLASH_STRING +#define FIM_CNS_DIRSEP_CHAR FIM_CNS_SLASH_CHAR +#define FIM_CNS_FP_ZERO 0.0 +#define FIM_CNS_EMPTY_FP_VAL FIM_CNS_FP_ZERO +#define FIM_CNS_EMPTY_INT_VAL 0 +#define FIM_CNS_ERR_QUIT 0 +#define FIM_CNS_EMPTY_RESULT FIM_CNS_EMPTY_STRING +#ifdef SVN_REVISION +#define FIM_CNS_FIM_APPTITLE FIM_CNS_FIM ", v." PACKAGE_VERSION " (r." SVN_REVISION ")" +#else /* SVN_REVISION */ +#define FIM_CNS_FIM_APPTITLE FIM_CNS_FIM ", v." PACKAGE_VERSION "" +#endif /* SVN_REVISION */ +#ifdef SVN_REVISION_NUMBER +#define FIM_REVISION_NUMBER (SVN_REVISION_NUMBER) +#else /* SVN_REVISION_NUMBER */ +#define FIM_REVISION_NUMBER (-1) +#endif /* SVN_REVISION_NUMBER */ +#define FIM_CNS_EX_KSY_STRING "{keysym}" +#define FIM_CNS_EX_CMD_STRING "{command}" +#define FIM_CNS_EX_FN_STRING "{filename}" +#define FIM_CNS_EX_FNS_STRING "{filename(s)}" +#define FIM_CNS_EX_KC_STRING "{keycode}" +#define FIM_CNS_EX_ID_STRING "{identifier}" +#define FIM_CNS_EX_EXP_STRING "{expression}" +#define FIM_CNS_EX_PAT_STRING "{pattern}" +#define FIM_CNS_EX_CMDS_STRING "{commands}" +#define FIM_CNS_EX_EVT_STRING "{event}" +#define FIM_CNS_EX_ARGS_STRING "{args}" +#define FIM_CNS_EX_DSC_STRING "{description}" +#define FIM_CNS_EX_PATH_STRING "{path}" +#define FIM_CNS_EX_SYSC_STRING "{syscmd}" +#define FIM_CNS_EX_FCT_STRING "{factor}" +#define FIM_CNS_EX_RE_STRING "{regexp}" +#define FIM_CNS_EX_RES_STRING "{regexp(s)}" +#define FIM_CNS_EX_NUM_STRING "{number}" +#define FIM_CNS_EX_SCALE_STRING "{scale}" +#define FIM_CNS_SHELL "/bin/sh" +#define FIM_CNS_DSFF "JPEG,PNG,GIF,BMP,TIFF,PPM,PGM,PBM,PCX" /* FIXME: this shall depend on build options */ +#define FIM_CNS_PUSHDIR_RE "\\.JPG$|\\.PNG$|\\.GIF$|\\.BMP$|\\.TIFF$|\\.TIF$|\\.JPEG$|\\.JFIF$|\\.PPM$|\\.PGM$|\\.PBM$|\\.PCX$" /* FIXME: this shall depend on build options */ +#define FIM_CNS_ARCHIVE_RE ".*(RAR|ZIP|TAR|TAR.GZ|TGZ|TAR.BZ2|TBZ|TBZ2|CBR|CBZ|LHA|7Z|XAR|ISO)$" /* FIXME: there is much more: CAB.. */ +#define FIM_CNS_VERBOSITY_LOADER 1 /* a value for FIM_VID_VERBOSITY */ +#define FIM_CNS_BPP_INVALID 0 +#define FIM_CNS_K 1024 +#define FIM_CNS_M (FIM_CNS_K*FIM_CNS_K) +#define FIM_CNS_LAST FIM_MAX_INT +#define FIM_CNS_FIRST 0 +#define FIM_CNS_VICSZ FIM_CNS_K * 64 /* viewport info cache size */ +#define FIM_CNS_CSU FIM_CNS_K /* cache size unit */ +#define FIM_CNS_CLEARTERM "\x1B\x4D" /* FIXME: still unused */ +#define FIM_CNS_WHITE 0xFFFFFFFF /* Temporarily here. Will better need an enum or another portable solution. */ +#define FIM_CNS_BLACK 0x00000000 /* Temporarily here. Will better need an enum or another portable solution. */ + +#define FIM_MAX(x,y) ((x)>(y)?(x):(y)) +#define FIM_MIN(x,y) ((x)<(y)?(x):(y)) +#define FIM_MOD(X,C) ((((X)%(C))+(C))%(C)) +#define FIM_INT_FRAC(Q,D) (((Q)+((D)-1))/(D)) + +#define FIM_INTERNAL_LANGUAGE_SHORTCUT_SHORT_HELP \ +".nf\n"\ +":" " enter command line mode\n"\ +":" FIM_CNS_EX_NUM_STRING " jump to " FIM_CNS_EX_NUM_STRING "^th image in the list\n"\ +":^ jump to first image in the list\n"\ +":$ jump to last image in the list\n"\ +":*" FIM_CNS_EX_FCT_STRING " scale the image by " FIM_CNS_EX_FCT_STRING "\n"\ +":" FIM_CNS_EX_SCALE_STRING "% scale the image to the desired " FIM_CNS_EX_SCALE_STRING "\n"\ +":+" FIM_CNS_EX_SCALE_STRING "% scale the image up to the desired percentage " FIM_CNS_EX_SCALE_STRING " (relatively to the original)\n"\ +":-" FIM_CNS_EX_SCALE_STRING "% scale the image down to the desired percentage " FIM_CNS_EX_SCALE_STRING " (relatively to the original)\n"\ +"\n"\ +"/" FIM_CNS_EX_RE_STRING " entering the pattern " FIM_CNS_EX_RE_STRING " (with /) makes fim jump to the next image whose filename matches " FIM_CNS_EX_RE_STRING "\n"\ +"/*.png$ entering this pattern (with /) makes fim jump to the next image whose filename ends with 'png'\n"\ +"/png a shortcut for /.*png.*\n"\ +"\n"\ +"!" FIM_CNS_EX_SYSC_STRING " executes the " FIM_CNS_EX_SYSC_STRING " quoted string as a \"" FIM_CNS_SHELL "\" shell command\n"\ +"" + +#define FIM_MAX_MIPMAPS 32 /* pretty large ;-) */ +class fim_mipmap_t +{ + public: + size_t mmoffs[FIM_MAX_MIPMAPS]; /* mipmap offset */ + size_t mmsize[FIM_MAX_MIPMAPS]; /* mipmap size */ + fim_int mmw[FIM_MAX_MIPMAPS]; /* mipmap width */ + fim_int mmh[FIM_MAX_MIPMAPS]; /* mipmap height */ + int nmm; /* number of mipmaps */ + size_t mmb; /* mipmap bytes (total) */ + fim_byte_t* mdp; /* mipmap data pointer */ + + fim_mipmap_t(const fim_mipmap_t&mm){reset();} + fim_mipmap_t(void){reset();} + size_t byte_size(void)const{return mmb+sizeof(*this);} + void dealloc(void){if(mdp)fim_free(mdp);reset();} + ~fim_mipmap_t(void){this->dealloc();} + bool ok(void)const{return mmb > 0;} + private: + void reset(void){nmm=0;mmb=0;mdp=FIM_NULL;} +}; + +#include "fim_string.h" +#include "Command.h" +#include "Benchmarkable.h" +#include "Arg.h" +#include "FontServer.h" +#include "FbiStuff.h" +#include "Var.h" +#include "Namespace.h" +#include "Image.h" +#include "Cache.h" +#include "Viewport.h" +#include "FimWindow.h" +#include "Browser.h" +#include "DebugConsole.h" +#include "DummyDisplayDevice.h" +#ifdef FIM_WITH_LIBIMLIB2 +#include "Imlib2Device.h" +#endif /* FIM_WITH_LIBIMLIB2 */ +#ifdef FIM_WITH_LIBSDL +#include "SDLDevice.h" +#endif /* FIM_WITH_LIBSDL */ +#ifdef FIM_WITH_CACALIB +#include "CACADevice.h" +#endif /* FIM_WITH_CACALIB */ +#ifdef FIM_WITH_AALIB +#include "AADevice.h" +#endif /* FIM_WITH_AALIB */ +#include "FramebufferDevice.h" +#include "CommandConsole.h" +#include "fim_stream.h" + +namespace fim +{ + class Browser; + class CommandConsole; + extern fim_stream cout; + extern fim_stream cerr; + std::ostream& operator<<(std::ostream &os,const string& s); +} + +/* + * Fim language variable identifiers, with their help strings. + * TODO: shall specify more information about these variables + * */ +//#define FIM_VID_NEWLINE "_newline" /* "" */ +//#define FIM_VID_TAB "_tab" /* "" */ +#define FIM_VID_ARCHIVE_FILES "_archive_files" /* "[in,g:] Regular expression matching filenames to be treated as (multipage) archives. If empty, \"" FIM_CNS_ARCHIVE_RE "\" will be used. Within each archive, only filenames matching the regular expression in the " FIM_VID_PUSHDIR_RE " variable will be considered for opening." */ +#define FIM_VID_RANDOM "random" /* "[out] a pseudorandom number" */ +#define FIM_VID_BINARY_DISPLAY "_display_as_binary" /* "[in,g:] will force loading of the specified files as pixelmaps (no image decoding will be performed); if 1, using one bit per pixel; if 24, using 24 bits per pixel; otherwise will load and decode the files as usual" */ +#define FIM_VID_TEXT_DISPLAY "_display_as_rendered_text" /* "[in,g:] will force loading of the specified files as text files (no image decoding will be performed); if 1; otherwise will load and decode the files as usual" */ +#define FIM_VID_CACHE_STATUS "_cache_status" /* "[out,g:] string with current information on cache status" */ +#define FIM_VID_DISPLAY_CONSOLE "_display_console" /* "[in,g:] if 1, will display the output console" */ +#define FIM_VID_DEVICE_DRIVER "_device_string" /* "[out,g:] the current display device string" */ +#define FIM_VID_DISPLAY_STATUS "_display_status" /* "[in,g:] if 1, will display the status bar" */ +#define FIM_VID_DISPLAY_STATUS_FMT "_display_status_fmt" /* "[in,g:] custom info format string, displayed in the lower left corner of the status bar; if unset: full pathname; otherwise a custom format string specified just as _info_fmt_str." */ +#define FIM_VID_PUSH_PUSHES_DIRS "_push_pushes_dirs" /* "[in,g:] if 1, the push command will also accept and push directories (using pushdir)" */ +#define FIM_VID_SANITY_CHECK "_do_sanity_check" /* "[in,experimental,g:] if 1, will execute a sanity check on startup" */ +#define FIM_VID_LAST_SYSTEM_OUTPUT "_last_system_output" /* "[out,experimental,g:] the standard output of the last call to the system command" */ +#define FIM_VID_LOAD_DEFAULT_ETC_FIMRC "_load_default_etc_fimrc" /* "[in,g:] if 1 at startup, will load the system wide initialization file" */ +#define FIM_VID_DEFAULT_ETC_FIMRC "_sys_rc_file" /* "[in,g:] string with the global configuration file name" */ +#define FIM_VID_FILE_LOADER "_file_loader" /* "[in,i:,g:] if not empty, this string will force a file loader (among the ones listed in the -V switch output); [out] i:" FIM_VID_FILE_LOADER " stores the loader of the current image" */ +#define FIM_VID_RETRY_LOADER_PROBE "_retry_loader_probe" /* "[in,g:] if 1 and user specified a file loader and this fails, will probe for a different loader" */ +#define FIM_VID_NO_RC_FILE "_no_rc_file" /* "[in,g:] if 1, the ~/.fimrc file will not be loaded at startup" */ +#define FIM_VID_NO_EXTERNAL_LOADERS "_no_external_loader_programs" /* "[in,g:] if 1, no external loading programs will be tried for piping in an unsupported type image file" */ +#define FIM_VID_SCRIPTOUT_FILE "_fim_scriptout_file" /* "[in,g:] the name of the file to write to when recording sessions" */ +#define FIM_VID_PUSHDIR_RE "_pushdir_re" /* "[in] regular expression to match against when pushing files from a directory or an archive. By default this is \"" FIM_CNS_PUSHDIR_RE "\"." */ +#define FIM_VID_STATUS_LINE "_status_line" /* "[in,g:] if 1, will display the status bar" */ +#define FIM_VID_WANT_PREFETCH "_want_prefetch" /* "[in,g:] if 1, will prefetch further files just after display of the first file" */ +#define FIM_VID_WANT_SLEEPS "_want_sleep_seconds" /* "[in,g:] number of seconds of sleep during slideshow mode" */ +#define FIM_VID_WANT_EXIF_ORIENTATION "_want_exif_orientation" /* "[in,g:] if 1, will reorient images using information from EXIF metadata (and stored in in " FIM_VID_EXIF_ORIENTATION ", " FIM_VID_EXIF_MIRRORED ", " FIM_VID_EXIF_FLIPPED" )." */ +#define FIM_VID_EXIF_ORIENTATION "__exif_orientation" /* "[out,i:] orientation information in the same format of " FIM_VID_ORIENTATION ", read from the orientation EXIF tags (i:EXIF_Orientation)." */ +#define FIM_VID_EXIF_MIRRORED "__exif_mirrored" /* "[out,i:] mirroring information, read from the EXIF tags of a given image." */ +#define FIM_VID_EXIF_FLIPPED "__exif_flipped" /* "[out,i:] flipping information, read from the EXIF tags of a given image." */ +#define FIM_VID_AUTOTOP "_autotop" /* "[in,g:] if 1, will align to the top freshly loaded images" */ +#define FIM_VID_SCALE_STYLE "_scale_style" /* "[in,g:] if non empty, this string will be fed to the scale command" */ +#define FIM_VID_FILEINDEX "_fileindex" /* "[out,g:] the current image numeric index" */ +#define FIM_VID_LASTFILEINDEX "_lastfileindex" /* "[out,g:] the last visited image numeric index. Useful for jumping back and forth easily between two images with 'goto _lastfileindex'." */ +#define FIM_VID_FILELISTLEN "_filelistlen" /* "[out,g:] the length of the current image list" */ +#define FIM_VID_INFO_FMT_STR "_info_fmt_str" /* "[in,g:] custom info format string, displayed in the lower right corner of the status bar; may contain ordinary text and special 'expando' sequences. These are: %p for current scale, in percentage; %w for width; %h for height; %i for image index in list; %k for the value of i:_comment (comment description) variable in square brackets; %l for image list length; %L for flip/mirror/orientation information; %P for page information; %F for file size; %M for screen image memory size; %m for memory used by mipmap; %C for memory used by cache; %T for total memory used (approximation); %R for total max memory used (as detected by getrusage()); %n for the current file path name; %N for the current file path name basename; ; %c for centering information; %v for the fim program/version identifier string; %% for an ordinary %. A sequence like %?VAR?EXP? expands to EXP if i:VAR is set; EXP will be copied verbatim except for contained sequences of the form %:VAR:, which will be expanded to the value of variable i:VAR; this is meant to be used like in e.g. '%?EXIF_DateTimeOriginal?[%:EXIF_DateTimeOriginal:]?', where the EXIF-set variable EXIF_DateTimeOriginal (make sure you have libexif for this) will be used only if present." */ +#define FIM_VID_FILENAME "_filename" /* "[out,i:] the current file name string" */ +#define FIM_VID_FIM_DEFAULT_CONFIG_FILE_CONTENTS "_fim_default_config_file_contents"/* "[out,g:] the contents of the default (hardcoded) configuration file (executed after the minimal hardcoded config)" */ +#define FIM_VID_FIM_DEFAULT_GRAMMAR_FILE_CONTENTS "_fim_default_grammar_file_contents" /* "[out,g:] the contents of the default (hardcoded) grammar file" */ +#define FIM_VID_FRESH "fresh" /* "[in,out,i:,experimental] 1 if the image was loaded, before all autocommands (autocmd) execution" */ +#define FIM_VID_PAGE "page" /* "[out,experimental,g:] the current page" */ +#define FIM_VID_PAGES "pages" /* "[out,experimental,i:] the current number of pages of an image" */ +#define FIM_VID_OVERRIDE_DISPLAY "_inhibit_display" /* "[internal,g:] if 1, will inhibit display" */ +#define FIM_VID_MAX_ITERATED_COMMANDS "_max_iterated_commands" /* "[experimental,g:] the iteration limit for N in \"N[commandname]\" iterated command invocations" */ +#define FIM_VID_WANT_CAPTION_STATUS "_want_wm_caption_status" /* "[in,g:] this works only if supported by the display device (currently only SDL). if set to a number that is not 0, will show the status (or command) line in the window manager caption; if set to a non-empty string, will interpret it just as a file info format string (see _info_fmt_str); if empty, will show the program version." */ +#define FIM_VID_MAGNIFY_FACTOR "_magnify_factor" /* "[in,g:] the image scale multiplier used when magnifying images size" */ +#define FIM_VID_PWD "_pwd" /* "[out,g:] the current working directory; will be updated at startup and whenever the working directory changes" */ +#define FIM_VID_REDUCE_FACTOR "_reduce_factor" /* "[in,g:] the image scale multiplier used when reducing images size" */ +#define FIM_VID_SCALE_FACTOR_MULTIPLIER "_scale_factor_multiplier" /* "[in,g:] value used for scaling up/down the scaling factors" */ +#define FIM_VID_SCALE_FACTOR_DELTA "_scale_factor_delta" /* "[in,g:] value used for incrementing/decrementing the scaling factors" */ +#define FIM_VID_COMMENT "_comment" /* "[i:,out] the image comment, extracted from the image file (if any)" */ +#define FIM_VID_COMMENT_OI "_caption_over_image" /* "[experimental,in,g:] if _caption_over_image is set not to 0, will display the contents of i:_comment as a caption over the image; if larger than 1, with black background. " */ +#define FIM_VID_EXIFTOOL_COMMENT "_exiftool_comment" /* "[out,g:] comment extracted via the exiftool interface; see _use_exiftool." */ +#define FIM_VID_STEPS "_steps" /* "[in,g:] the default steps, in pixels, when panning images" */ +#define FIM_VID_VERSION "_fim_version" /* "[out,g:] fim version number; may be used for keeping compatibility of fim scripts across evolving versions." */ +#define FIM_VID_FBFONT "_fbfont" /* "[out,g:] The current console font file string. If the internal hardcoded font has been used, then its value is \"" FIM_DEFAULT_HARDCODEDFONT_STRING "\"." */ +#define FIM_VID_HSTEPS "_hsteps" /* "[in,g:] the default steps, in pixels, when panning images horizontally (overrides steps)" */ +#define FIM_VID_VSTEPS "_vsteps" /* "[in,g:] the default steps, in pixels, when panning images vertically (overrides steps)" */ +#define FIM_VID_CONSOLE_ROWS "_rows" /* "[in,g:] if >0, will set the number of displayed text lines in the console" */ +#define FIM_VID_CONSOLE_LINE_WIDTH "_lwidth" /* "[in,g:] if>0, will force the output console text width" */ +#define FIM_VID_CONSOLE_LINE_OFFSET "_console_offset" /* "[in,out,g:] position of the text beginning in the output console, expressed in lines" */ +#define FIM_VID_CONSOLE_BUFFER_LINES "_console_lines" /* "[out,g:] the number of buffered output console text lines" */ +#define FIM_VID_CONSOLE_BUFFER_TOTAL "_console_buffer_total" /* "[out,g:] amount of memory allocated for the output console buffer" */ +#define FIM_VID_CONSOLE_BUFFER_FREE "_console_buffer_free" /* "[out,g:] amount of unused memory in the output console buffer" */ +#define FIM_VID_CONSOLE_BUFFER_USED "_console_buffer_used" /* "[out,g:] amount of used memory in the output console buffer" */ +#define FIM_VID_VERBOSE_KEYS "_verbose_keys" /* "[in,g:] if 1, after each interactive mode key hit, the console will display the hit key raw keycode" */ +#define FIM_VID_CMD_EXPANSION "_command_expansion" /* "[in,g:] if 1, will enable autocompletion (on execution) of alias and command strings" */ +#define FIM_VID_VERBOSE_ERRORS "_verbose_errors" /* "[in,g:] if 1, will display on stdout internal errors, while parsing commands" */ +#define FIM_VID_VERBOSITY "_verbosity" /* "[in,experimental,g:] program verbosity" */ +#define FIM_VID_CONSOLE_KEY "_console_key" /* "[in,g:] the key binding (an integer variable) for spawning the command line; will have precedence over any other binding" */ +#define FIM_VID_IGNORECASE "_ignorecase" /* "[in,g:] if 1, will allow for case insensitive regexp-based match in autocommands (autocmd); " */ +#define FIM_VID_RE_SEARCH_OPTS "_re_search_opts" /* "[in,g:] affects regexp-based searches; if an empty string, defaults will apply; if contains 'i' ('I'), case insensitive (sensitive) searches will occur; if contains 'b', will match on basename, if contains 'f' on full pathname. " */ +#define FIM_VID_SAVE_FIM_HISTORY "_save_fim_history" /* "[in,g:] if 1 on exit, will save the " FIM_CNS_HIST_COMPLETE_FILENAME " file on exit" */ +#define FIM_VID_LOAD_FIM_HISTORY "_load_fim_history" /* "[in,g:] if 1 on startup, will load the " FIM_CNS_HIST_COMPLETE_FILENAME " file on startup" */ +#define FIM_VID_TERM "_TERM" /* "[out,g:] the environment TERM variable" */ +#define FIM_VID_NO_DEFAULT_CONFIGURATION "_no_default_configuration" /* "[in,g:] if 0, a default, hardcoded configuration will be executed at startup, after the minimal hardcoded one. " */ +#define FIM_VID_DISPLAY_STATUS_BAR "_display_status_bar" /* "[in,g:] if 1, will display the status bar" */ +#define FIM_VID_DISPLAY_BUSY "_display_busy" /* "[in,g:] if 1, will display a message on the status bar when processing" */ +#define FIM_VID_WANT_MIPMAPS "_use_mipmaps" /* "[in,g:] if >0, will use mipmaps to speed up downscaling of images (this has a memory overhead equivalent to one image copy); mipmaps will not be cached. " */ +#define FIM_VID_EXIFTOOL "_use_exiftool" /* "[in,g:] if >0 and supported, exiftool will be used to get additional information. if 1, this will be appened to _comment; if 2, will go to _exiftool_comment" */ +#define FIM_VID_SCALE "scale" /* "[in,i:] the scale of the current image" */ +#define FIM_VID_ASCALE "ascale" /* "[in,out,i:] the asymmetric scaling of the current image" */ +#define FIM_VID_ANGLE "angle" /* "[in,out,i:] a floating point number specifying the rotation angle, in degrees" */ +#define FIM_VID_ORIENTATION "_orientation" /* "[internal,i:] Orthogonal clockwise rotation (orientation) is controlled by: 'i:_orientation', 'g:_orientation' and applied on a per-image basis. In particular, the values of the three variables are summed up and the sum is interpreted as the image orientation. If the sum is 0, no rotation will apply; if it is 1, a single ( 90') rotation will apply; if it is 2, a double (180') rotation will apply; if it is 3, a triple (270') rotation will apply. If the sum is not one of 0,1,2,3, the value of the sum modulo 4 is considered. Therefore, \":i:_orientation=1\" and \":i:_orientation=5\" are equivalent: they rotate the image one time by 90'." */ +#define FIM_VID_WIDTH "width" /* "[out,i:] the current image original width" */ +#define FIM_VID_HEIGHT "height" /* "[out,i:] the current image original height" */ +#define FIM_VID_SWIDTH "swidth" /* "[out,i:] the current image scaled width" */ +#define FIM_VID_SHEIGHT "sheight" /* "[out,i:] the current image scaled height" */ +#define FIM_VID_AUTOFLIP "_autoflip" /* "[in,g:] if 1, will flip images by default" */ +#define FIM_VID_AUTONEGATE "_autonegate" /* "[in,g:] if 1, will negate images by default" */ +#define FIM_VID_AUTODESATURATE "_autodesaturate" /* "[in,g:] if 1, will desaturate images by default" */ +#if FIM_WANT_REMEMBER_LAST_FILE_LOADER +#define FIM_VID_LAST_FILE_LOADER "_last_file_loader" /* "[out,g:] after each image load, " FIM_VID_LAST_FILE_LOADER " will be set to the last file loader used" */ +#endif /* FIM_WANT_REMEMBER_LAST_FILE_LOADER */ +#define FIM_VID_FLIPPED "flipped" /* "[out,i:] 1, if the image is flipped" */ +#define FIM_VID_NEGATED "negated" /* "[out,i:] 1, if the image is negated" */ +#define FIM_VID_DESATURATED "desaturated" /* "[out,i:] 1, if the image is desaturated" */ +#define FIM_VID_FIM_BPP "_fim_bpp" /* "[out,g:] the bits per pixel count" */ +#define FIM_VID_AUTOMIRROR "_automirror" /* "[in,g:] if 1, will mirror images by default" */ +#define FIM_VID_MIRRORED "mirrored" /* "[out,i:] 1, if the image is mirrored " */ +#define FIM_VID_WANT_AUTOCENTER "_want_autocenter" /* "[in,g:] if 1, the image will be displayed centered " */ +#define FIM_VID_MAX_CACHED_IMAGES "_max_cached_images" /* "[in,experimental,g:] the maximum number of images after which evictions will be forced. Setting this to 0 (no limits) is ok provided _max_cached_memory is set meaningfully." */ +#define FIM_VID_MAX_CACHED_MEMORY "_max_cached_memory" /* "[in,experimental,g:] the maximum amount of memory (in KiB) at which images will be continued being added to the cache. Setting this to 0 (no limit) will lead to a crash (there is no protection currently)." */ +#define FIM_VID_CACHED_IMAGES "_cached_images" /* "[out,g:] the number of images currently cached." */ +#define FIM_VID_SCREEN_WIDTH "_screen_width" /* "[out,g:] the screen width" */ +#define FIM_VID_SCREEN_HEIGHT "_screen_height" /* "[out] the screen height" */ +#define FIM_VID_DBG_AUTOCMD_TRACE_STACK "_autocmd_trace_stack" /* "[in,g:] dump to stdout autocommands (autocmd) stack trace during their execution (for debugging purposes)" */ +#define FIM_VID_DBG_COMMANDS "_debug_commands" /* "[in,g:] print out each command before its execution (for debugging purposes)" */ +#define FIM_VID_OPEN_OFFSET "_open_offset" /* "[in,optional,g:,i:] offset (specified in bytes) used when opening a file; [out] i:" FIM_VID_OPEN_OFFSET " will be assigned to images opened at a nonzero offset " */ +#define FIM_VID_OPEN_OFFSET_RETRY "_open_offset_retry" /* "[in,optional,g:] number of adjacent bytes to probe in opening the file " */ +#define FIM_VID_SEEK_MAGIC "_seek_magic" /* "[optional,g:] will seek for a magic signature before opening a file (for now, use like this: fim -C '_seek_magic=MAGIC_STRING;push filename' ) " */ +#define FIM_VID_PREFERRED_RENDERING_WIDTH "_preferred_rendering_width" /* "[in,optional,g:] if >0, bit based rendering will use this value for a default document width (instead of a default value) " */ +#define FIM_VID_PREFERRED_RENDERING_DPI "_preferred_rendering_dpi" /* "[in,optional,g:] if >0, pdf, ps, djvu rendering will use this value for a default document dpi (instead of a default value) " */ +#define FIM_VID_PRELOAD_CHECKS "_push_checks" /* "[in,experimental,g:] if 1 (default), will check with stat() existence of input files before push'ing them (set this to 0 to speed up loading very long file lists; in these cases a trailing slash (/) will have to be used to tell fim a pathname is a directory). This only works after initialization (thus, after command line files have been push'ed); use --no-stat-push if you wish to set this to 0 at command line files specification " */ + +/* + * Fim Keyboard Descriptions + * */ +#define FIM_KBD_TAB "Tab" +#define FIM_KBD_ENTER "Enter" +#define FIM_KBD_PAUSE "Pause" +#define FIM_KBD_MENU "Menu" +#define FIM_KBD_BACKSPACE "BackSpace" +#define FIM_KBD_BACKSPACE_ "Backspace" +#define FIM_KBD_SPACE " " +#define FIM_KBD_DEL "Del" +#define FIM_KBD_INS "Ins" +#define FIM_KBD_HOME "Home" +#define FIM_KBD_END "End" +#define FIM_KBD_ANY "Any" +#define FIM_KBD_ESC "Esc" +#define FIM_KBD_LEFT "Left" +#define FIM_KBD_RIGHT "Right" +#define FIM_KBD_UP "Up" +#define FIM_KBD_DOWN "Down" +#define FIM_KBD_PAGEUP "PageUp" +#define FIM_KBD_PAGEDOWN "PageDown" +#define FIM_KBD_COLON ":" +#define FIM_KBD_SEMICOLON ";" +#define FIM_KBD_MOUSE_LEFT "MouseLeft" +#define FIM_KBD_MOUSE_RIGHT "MouseRight" +#define FIM_KBD_PLUS "+" +#define FIM_KBD_MINUS "-" +#define FIM_KBD_SLASH "/" +#define FIM_KBD_ASTERISK "*" +#define FIM_KBD_GT ">" +#define FIM_KBD_LT "<" +#define FIM_KBD_UNDERSCORE "_" + +/* + * Fim Display Driver Names + * Note: When adding a new driver, you shall update FIM_DDN_VARS as well. + * p.s.: ICI = If Configured In + * */ +#define FIM_DDN_INN_FB "fb" +#define FIM_DDN_VAR_FB "fb" +#ifndef FIM_WITH_NO_FRAMEBUFFER +#define FIM_DDN_ICI_FB "fb|" +#else /* FIM_WITH_NO_FRAMEBUFFER */ +#define FIM_DDN_ICI_FB "" +#endif /* FIM_WITH_NO_FRAMEBUFFER */ + +#define FIM_DDN_INN_SDL "sdl" +#define FIM_DDN_VAR_SDL "sdl" +#ifdef FIM_WITH_LIBSDL +#define FIM_DDN_ICI_SDL "sdl|" +#else /* FIM_WITH_LIBSDL */ +#define FIM_DDN_ICI_SDL "" +#endif /* FIM_WITH_LIBSDL */ + +#define FIM_DDN_INN_IL2 "imlib2" +#define FIM_DDN_VAR_IL2 "imlib2" +#ifdef FIM_WITH_LIBIMLIB2 +#define FIM_DDN_ICI_IL2 "imlib2|" +#else /* FIM_WITH_LIBIMLIB2 */ +#define FIM_DDN_ICI_IL2 "" +#endif /* FIM_WITH_LIBIMLIB2 */ + +#define FIM_DDN_INN_AA "aa" +#define FIM_DDN_VAR_AA "aa" +#ifdef FIM_WITH_AALIB +#define FIM_DDN_ICI_AA "aa|" +#else /* FIM_WITH_AALIB */ +#define FIM_DDN_ICI_AA "" +#endif /* FIM_WITH_AALIB */ + +#define FIM_DDN_INN_CACA "caca" +#define FIM_DDN_VAR_CACA "caca" +#ifdef FIM_WITH_CACALIB +#define FIM_DDN_ICI_CACA "|caca" +#else /* FIM_WITH_CACALIB */ +#define FIM_DDN_ICI_CACA "" +#endif /* FIM_WITH_CACALIB */ + +#define FIM_DDN_INN_DUMB "dumb" +//#define FIM_DDN_VAR_DUMB "dummy" +#define FIM_DDN_VAR_DUMB "dumb" + +#define FIM_DDN_VARS "[" FIM_DDN_INN_FB"|" FIM_DDN_INN_SDL "|" FIM_DDN_INN_AA "|" FIM_DDN_INN_IL2 "|" FIM_DDN_INN_CACA "|" FIM_DDN_INN_DUMB "]" +#define FIM_DDN_VARS_IN "[" FIM_DDN_ICI_FB FIM_DDN_ICI_SDL FIM_DDN_ICI_AA FIM_DDN_ICI_IL2 FIM_DDN_ICI_CACA FIM_DDN_INN_DUMB "]" + +/* + * Fim Autocommands + * FIXME: need autodocumentation for these. + * */ +//#define FIM_ACM_POSTSCREENRESIZE "PostScreenResize" /* "" */ +//#define FIM_ACM_PRESCREENRESIZE "PreScreenResize" /* "" */ +#define FIM_ACM_POSTSCALE "PostScale" /* "" */ +#define FIM_ACM_PRESCALE "PreScale" /* "" */ +#define FIM_ACM_PREPAN "PrePan" /* "" */ +#define FIM_ACM_POSTPAN "PostPan" /* "" */ +#define FIM_ACM_PREREDISPLAY "PreRedisplay" /* "" */ +#define FIM_ACM_POSTREDISPLAY "PostRedisplay" /* "" */ +#define FIM_ACM_PREDISPLAY "PreDisplay" /* "" */ +#define FIM_ACM_POSTDISPLAY "PostDisplay" /* "" */ +#define FIM_ACM_PREPREFETCH "PrePrefetch" /* "" */ +#define FIM_ACM_POSTPREFETCH "PostPrefetch" /* "" */ +#define FIM_ACM_POSTRELOAD "PostReload" /* "" */ +#define FIM_ACM_PRERELOAD "PreReload" /* "" */ +#define FIM_ACM_POSTLOAD "PostLoad" /* "" */ +#define FIM_ACM_PRELOAD "PreLoad" /* "" */ +#define FIM_ACM_POSTGOTO "PostGoto" /* "" */ +#define FIM_ACM_PREGOTO "PreGoto" /* "" */ +#define FIM_ACM_PRECONF "PreConfigLoading" /* "before loading any configuration file" */ +#define FIM_ACM_POSTCONF "PostConfigLoading" /* "after loading any configuration file" */ +#define FIM_ACM_PREHFIMRC "PreHardcodedConfigLoading" /* "before loading hardcoded configuration" */ +#define FIM_ACM_POSTHFIMRC "PostHardcodedConfigLoading" /* "after loading hardcoded configuration" */ +#define FIM_ACM_PREUFIMRC "PreUserConfigLoading" /* "before loading user configuration file" */ +#define FIM_ACM_POSTUFIMRC "PostUserConfigLoading" /* "after loading user configuration file" */ +#define FIM_ACM_PREGFIMRC "PreGlobalConfigLoading" /* "before loading global configuration file" */ +#define FIM_ACM_POSTGFIMRC "PostGlobalConfigLoading" /* "after loading global configuration file" */ +#define FIM_ACM_PREINTERACTIVECOMMAND "PreInteractiveCommand" /* "" */ +#define FIM_ACM_POSTINTERACTIVECOMMAND "PostInteractiveCommand" /* "" */ +#define FIM_ACM_PREEXECUTIONCYCLE "PreExecutionCycle" /* "" */ +#define FIM_ACM_PREEXECUTIONCYCLEARGS "PreExecutionCycleArgs" /* "" */ +#define FIM_ACM_POSTEXECUTIONCYCLE "PostExecutionCycle" /* "" */ +#define FIM_ACM_PREWINDOW "PreWindow" /* "" */ +#define FIM_ACM_POSTWINDOW "PostWindow" /* "" */ +//#define FIM_ACM_PREROTATE "PreRotate" /* "" */ +//#define FIM_ACM_POSTROTATE "PostRotate" /* "" */ + +/* + * Fim Language Tokens + * */ +#define FIM_FLT_ALIAS "alias" /* not in vim */ +#define FIM_FLT_ALIGN "align" /* not in vim */ +#define FIM_FLT_AUTOCMD "autocmd" /* in vim */ +#define FIM_FLT_AUTOCMD_DEL "autocmd_del" /* not in vim */ +#define FIM_FLT_BIND "bind" /* not in vim */ +#define FIM_FLT_BASENAME "basename" /* not in vim */ +#define FIM_FLT_CD "cd" /* in vim */ +#define FIM_FLT_CLEAR "clear" /* not in vim */ +#define FIM_FLT_COMMANDS "commands" /* not in vim */ +#define FIM_FLT_DESATURATE "desaturate" /* not in vim */ +#define FIM_FLT_DISPLAY "display" /* in vim, with another meaning */ +#define FIM_FLT_DUMP_KEY_CODES "dump_key_codes" /* not in vim */ +#define FIM_FLT_DESC "desc" /* not in vim */ +#define FIM_FLT_ECHO "echo" /* in vim */ +#define FIM_FLT_ELSE "else" /* in vim */ +#define FIM_FLT_EXEC "exec" /* not in vim */ +#define FIM_FLT_EVAL "eval" /* not in vim */ +#define FIM_FLT_FILE "file" /* in vim */ +#define FIM_FLT_GETENV "getenv" /* not in vim */ +#define FIM_FLT_GOTO "goto" /* in vim */ +#define FIM_FLT_HELP "help" /* in vim */ +#define FIM_FLT_IF "if" /* in vim */ +#define FIM_FLT_INFO "info" /* not in vim */ +#define FIM_FLT_LOAD "load" /* not in vim */ +#define FIM_FLT_LIMIT "limit" /* not in vim */ +#define FIM_FLT_LIST "list" /* not in vim */ +#define FIM_FLT_NEGATE "negate" /* not in vim */ +#define FIM_FLT_NO_IMAGE "no_image" /* not in vim */ +#define FIM_FLT_PAN "pan" /* not in vim */ +#define FIM_FLT_POPEN "popen" /* not in vim */ +#define FIM_FLT_PREAD "pread" /* not in vim */ +#define FIM_FLT_PREFETCH "prefetch" /* in vim */ +#define FIM_FLT_PWD "pwd" /* in vim */ +#define FIM_FLT_REDISPLAY "redisplay" /* not in vim */ +#define FIM_FLT_RELOAD "reload" /* not in vim */ +#define FIM_FLT_ROTATE "rotate" /* not in vim */ +#define FIM_FLT_SCALE "scale" /* not in vim */ +#define FIM_FLT_SCROLLDOWN "scrolldown" /* not in vim */ +#define FIM_FLT_SCROLLFORWARD "scrollforward" /* not in vim */ +#define FIM_FLT_SET "set" /* in vim */ +#define FIM_FLT_SET_INTERACTIVE_MODE "set_interactive_mode" /* not in vim */ +#define FIM_FLT_SET_CONSOLE_MODE "set_commandline_mode" /* not in vim */ +#define FIM_FLT_STATUS "status" /* not in vim */ +#define FIM_FLT_STDOUT "stdout" /* not in vim */ +#define FIM_FLT_QUIT "quit" /* in vim */ +#define FIM_FLT_RECORDING "recording" /* not in vim */ +#define FIM_FLT_SYSTEM "system" /* not in vim */ +#define FIM_FLT_SLEEP "sleep" /* in vim */ +#define FIM_FLT_USLEEP "usleep" /* not in vim */ +#define FIM_FLT_UNALIAS "unalias" /* not in vim */ +#define FIM_FLT_UNBIND "unbind" /* not in vim */ +#define FIM_FLT_VARIABLES "variables" /* not in vim */ +#define FIM_FLT_WHILE "while" /* in vim */ +#define FIM_FLT_WINDOW "window" /* not in vim */ + +/* composite commands or hardcoded aliases */ +#define FIM_FLA_NEXT_FILE "next_file" /* not in vim */ // WAS: FIM_FLT_NEXT_PIC +#define FIM_FLA_PREV_FILE "prev_file" /* not in vim */ // WAS: FIM_FLT_PREC_PIC +#define FIM_FLA_NEXT_PAGE "next_page" /* not in vim */ +#define FIM_FLA_PREV_PAGE "prev_page" /* not in vim */ +#define FIM_FLA_NEXT "next" /* in vim */ +#define FIM_FLA_PREV "prev" /* in vim */ +#define FIM_FLA_MAGNIFY "magnify" /* not in vim */ +#define FIM_FLA_REDUCE "reduce" /* not in vim */ +#define FIM_FLC_NEXT "goto '+1'" /* in vim */ +#define FIM_FLC_PREV "goto '-1'" /* in vim */ +#define FIM_FLC_MIRROR "mirror" /* not in vim */ +#define FIM_FLC_FLIP "flip" /* not in vim */ +#define FIM_FLC_PAN_UP "pan 'up'" /* not in vim */ +#define FIM_FLC_PAN_DOWN "pan 'down'" /* not in vim */ +#define FIM_FLC_PAN_LEFT "pan 'left'" /* not in vim */ +#define FIM_FLC_PAN_RIGHT "pan 'right'" /* not in vim */ +#define FIM_FLC_NEXT_FILE "goto '+1f'" /* not in vim */ // WAS: FIM_FLT_NEXT_PIC +#define FIM_FLC_PREV_FILE "goto '-1f'" /* not in vim */ // WAS: FIM_FLT_PREC_PIC +#define FIM_FLC_NEXT_PAGE "goto '+1p'" /* not in vim */ +#define FIM_FLC_PREV_PAGE "goto '-1p'" /* not in vim */ +#define FIM_FLC_MAGNIFY "scale '+'" /* not in vim */ +#define FIM_FLC_REDUCE "scale '-'" /* not in vim */ + +/* Help messages for Fim internal commands. */ +#define FIM_CMD_HELP_ALIGN FIM_FLT_ALIGN " bottom : align to the lower side the current image; " FIM_FLT_ALIGN " top : align to the upper side the current image; " +#define FIM_CMD_HELP_LIST FIM_FLT_LIST " : display the files list; " FIM_FLT_LIST " 'random_shuffle': randomly shuffle the file list; " FIM_FLT_LIST " 'reverse': reverse the file list; " FIM_FLT_LIST " 'clear': clear the file list; " FIM_FLT_LIST " 'sort': sort the file list; " FIM_FLT_LIST " 'sort_basename': sort the file list according to the file base name; " FIM_FLT_LIST " 'pop' : pop the last file from the files list; " FIM_FLT_LIST " 'remove' [" FIM_CNS_EX_FNS_STRING "] : remove the current file, or the " FIM_CNS_EX_FNS_STRING ", if specified " "; " FIM_FLT_LIST " 'push' " FIM_CNS_EX_FNS_STRING " : push " FIM_CNS_EX_FNS_STRING " to the back of the files list; " FIM_FLT_LIST " 'filesnum': display the number of files in the files list; " FIM_FLT_LIST " 'mark' [{args}] : mark image file names for stdout printing at exit, with {args} mark the ones matching according to the rules of the '" FIM_FLT_LIMIT "' command, otherwise the current file; " FIM_FLT_LIST " 'unmark' [{args}] : unmark marked image file names, with {args} unmark the ones matching according to the rules of the '" FIM_FLT_LIMIT "' command, otherwise the current file; " FIM_FLT_LIST " 'marked': show which files have been marked so far; " FIM_FLT_LIST " 'pushdir'; {dirname}: will push all the files in {dirname}, when matching the regular expression in variable " FIM_VID_PUSHDIR_RE " or, if empty, from constant regular expression " FIM_CNS_PUSHDIR_RE "; " FIM_FLT_LIST " 'pushdirr' {dirname}: like pushdir, but will also push encountered directory entries recursively. " +#define FIM_CMD_HELP_CD FIM_FLT_CD " " FIM_CNS_EX_PATH_STRING ": change the current directory to " FIM_CNS_EX_PATH_STRING ". " FIM_FLT_CD " - will change to the previous current directory (before the last \":" FIM_FLT_CD " " FIM_CNS_EX_PATH_STRING "\" command)" +#define FIM_CMD_HELP_SET FIM_FLT_SET ": returns a list of variables which are set; " FIM_FLT_SET " " FIM_CNS_EX_ID_STRING ": returns the value of variable " FIM_CNS_EX_ID_STRING "; " FIM_FLT_SET " " FIM_CNS_EX_ID_STRING " " FIM_CNS_EX_CMDS_STRING ": sets variable " FIM_CNS_EX_ID_STRING " to value " FIM_CNS_EX_CMDS_STRING "; " +#define FIM_CMD_HELP_PWD FIM_FLT_PWD" : print the current directory name, and updates the " FIM_VID_PWD " variable" +#define FIM_CMD_HELP_EVAL FIM_FLT_EVAL " " FIM_CNS_EX_ARGS_STRING " : evaluate " FIM_CNS_EX_ARGS_STRING " as commands, executing them" +#define FIM_CMD_HELP_SYSTEM FIM_FLT_SYSTEM " " FIM_CNS_EX_SYSC_STRING ": get the output of the shell command " FIM_CNS_EX_SYSC_STRING ". (uses popen())" +#if FIM_DISABLE_WINDOW_SPLITTING +#define FIM_CMD_HELP_WINDOW FIM_FLT_WINDOW " " FIM_CNS_EX_ARGS_STRING " : this command is disabled. It shall be re-enabled in a future version." +#else /* FIM_DISABLE_WINDOW_SPLITTING */ +//#define FIM_CMD_HELP_WINDOW FIM_FLT_WINDOW " " FIM_CNS_EX_ARGS_STRING " : manipulates the window system windows; each value of " FIM_CNS_EX_ARGS_STRING " shall be one of ['split' | 'hsplit' | 'vsplit' | 'normalize' | 'enlarge' | 'venlarge' | 'henlarge' | 'up' | 'down' | 'left' | 'right' | 'close' | 'swap']" +#endif /* FIM_DISABLE_WINDOW_SPLITTING */ +#define FIM_CMD_HELP_GOTO FIM_FLT_GOTO " {['+'|'-']" FIM_CNS_EX_NUM_STRING "['%']['f'|'p']} | {/" FIM_CNS_EX_RE_STRING "/} | {'+//'}: jump to an image; if " FIM_CNS_EX_NUM_STRING " is given, and not surrounded by any specifier, will go to image at index " FIM_CNS_EX_NUM_STRING " ; if followed by '%', the effective index will be computed as a percentage to the current available images; if prepended by '-' or '+', the jump will be relative to the current index; the 'f' specifier asks for the jump to occur within the files; the 'p' specifier asks for the jump to occur in terms of pages, within the current file; if /" FIM_CNS_EX_RE_STRING "/ is given, will jump to the first image matching the given /" FIM_CNS_EX_RE_STRING "/ regular expression pattern; if given '+//', will jump to the first different image matching the last given regular expression pattern. Match will occur on both file name and description, eventually loaded via " FIM_FLT_DESC " or --" FIM_OSW_LOAD_IMG_DSC_FILE "." +#define FIM_CMD_HELP_SCALE FIM_FLT_SCALE " {['+'|'-']{value}['%']|'*'{value}|'w'|'h'|'a'|'b'|'+[+-*/]'} : scale the image according to a scale {value} (e.g.: 0.5,40%,'w','h','a','b'); if given '*' and a value, will multiply the current scale by that value; if given 'w', will scale according to the screen width; if given 'h', scale to the screen height; if given 'a', to the minimum of 'w' and 'h'; if given 'b', like 'a', provided that the image width exceeds 'w' or 'h'; if {value} is a number, will scale relatively to the original image width; if the number is followed by '%', the relative scale will be treated on a percent scale; " "if given '++'('+-'), will increment (decrement) the \"" FIM_VID_MAGNIFY_FACTOR "\", \"" FIM_VID_REDUCE_FACTOR "\" variables by \"" FIM_VID_SCALE_FACTOR_DELTA "\"; " "if given '+*'('+/'), will multiply (divide) the \"" FIM_VID_MAGNIFY_FACTOR "\", \"" FIM_VID_REDUCE_FACTOR "\" variables by \"" FIM_VID_SCALE_FACTOR_MULTIPLIER "\"; " +#define FIM_CMD_HELP_HELP FIM_FLT_HELP " [" FIM_CNS_EX_ID_STRING "] : provide online help, assuming " FIM_CNS_EX_ID_STRING " is a variable, alias, or command identifier. If " FIM_CNS_EX_ID_STRING " begins with " FIM_CNS_SLASH_STRING ", the search will be on the help contents and a list of matching items will be given instead. A list of commands can be obtained simply invoking \"" FIM_FLT_COMMANDS "\"; a list of aliases with \"" FIM_FLT_ALIAS "\"; a list of bindings with \"" FIM_FLT_BIND "\"." +#define FIM_FLT_HELP_DESC FIM_FLT_DESC " 'load' {filename} [{sepchar}] : load description file {filename}, using the optional {sepchar} character as separator. See documentation of --" FIM_OSW_LOAD_IMG_DSC_FILE " for the format of {filename}." +#define FIM_FLT_HELP_DISPLAY FIM_FLT_DISPLAY " ['reinit' {string}]|'resize' {w} {h}] : display the current file contents; if 'reinit' switch is supplied, the '{string}' specifier will be used to reinitialize (e.g.: change resolution, window system options) the display device; see documentation for the --" FIM_OSW_OUTPUT_DEVICE " command line switch for allowed values of {string}; if 'resize' and no argument, will ask the window manager to size the window like the image; if 'resize' and two arguments, these will be used as width and height of window, to set. " + +#define FIM_CNS_SLIDESHOW_CMD "while(" FIM_VID_FILEINDEX "<" FIM_VID_FILELISTLEN "){sleep " FIM_VID_WANT_SLEEPS "; next;}" +#define FIM_CNS_QUIET_CMD FIM_VID_DISPLAY_STATUS "=0;" FIM_VID_DISPLAY_BUSY "=0;" + +/* + * Some Fim compilation defaults + */ +#define FIM_WANT_SDL_PROOF_OF_CONCEPT_MOUSE_SUPPORT 1 /* experimental mouse support in sdl mode */ +#define FIM_WANT_SCREEN_KEY_REMAPPING_PATCH 1 +#define FIM_WANT_OVERLY_VERBOSE_DUMB_CONSOLE 0 +#define FIM_WANT_MILDLY_VERBOSE_DUMB_CONSOLE 1 +#define FIM_WANT_SINGLE_SYSTEM_INVOCATION 1 +#define FIM_WANT_SDL_OPTIONS_STRING 1 +#define FIM_WANT_OUTPUT_DEVICE_STRING_CASE_INSENSITIVE 1 +#define FIM_WANT_HISTORY 1 +#define FIM_WANT_AVOID_FP_EXCEPTIONS 1 +#define FIM_WANT_CAPTION_CONTROL 1 +#define FIM_WANT_READLINE_CLEAR_WITH_ESC 1 +#define FIM_WANT_DOUBLE_ESC_TO_ENTER 0 /* if enabled in the console mode, would require three presses the first time; two later on; this is non consistent, so we keep it disabled until we find a fix */ +#define FIM_WANT_EXPERIMENTAL_PLUGINS 1 /* unfinished */ +#define FIM_WANT_STDIN_FILELOAD_AFTER_CONFIG 1 +#define FIM_WANT_KEEP_FILESIZE 1 +#define FIM_WANT_DISPLAY_FILESIZE (FIM_WANT_KEEP_FILESIZE && 0) +#define FIM_WANT_DISPLAY_MEMSIZE 0 +/* #define FIM_WANT_CUSTOM_INFO_STRING 1 */ +#define FIM_STREAM_BUFSIZE 4096 +#define FIM_MAXLINE_BUFSIZE 1024 +#define FIM_PRINTFNUM_BUFSIZE 32 +#define FIM_PRINTINUM_BUFSIZE 4*sizeof(fim_int) /* for fim_int */ +#define FIM_METAINFO_BUFSIZE 256 +#define FIM_EXIF_BUFSIZE FIM_METAINFO_BUFSIZE +#define FIM_RL_COMPLETION_BUFSIZE 256 +#define FIM_LIBERR_BUFSIZE 1024 +#define FIM_LINUX_LINKFILENAME_BUFSIZE 64 +#define FIM_STRING_BUFSIZE 4096 +#define FIM_PIPE_BUFSIZE 1024 +#define FIM_PIPE_CMD_BUFSIZE 1024 +#define FIM_FILE_PROBE_BLKSIZE 512 +#define FIM_CONSOLE_BLOCKSIZE 1024 +#define FIM_CONSOLE_DEF_WIDTH 128 +#define FIM_BITRENDERING_DEF_WIDTH 1024 +#define FIM_DEFAULT_WINDOW_WIDTH 640 +#define FIM_DEFAULT_WINDOW_HEIGHT 512 +#define FIM_RENDERING_DPI 200 +#define FIM_RENDERING_MAX_ROWS 1024 +#define FIM_RENDERING_MAX_COLS 1024 +#define FIM_CONSOLE_DEF_ROWS 24 +#define FIM_VERBOSE_KEYS_BUFSIZE 64 +#define FIM_FILE_BUF_SIZE (1024*256) +#define FIM_ATOX_BUFSIZE (32) +#define FIM_STATUSLINE_BUF_SIZE (2*128) +#define FIM_FBI_PPM_LINEBUFSIZE (1024) +#define FIM_LINUX_CONSOLEFONTS_DIR "/usr/share/consolefonts" +#define FIM_LINUX_STDIN_FILE "/dev/stdin" +#define FIM_LINUX_STDOUT_FILE "/dev/stdout" +#define FIM_LINUX_RAND_FILE "/dev/urandom" +#define FIM_FBDEV_FILE_MAX_CHARS 16 +#define FIM_DEFAULT_FB_FILE "/dev/fb0" +#define FIM_DEFAULT_AS_BINARY_BPP 24 +#define FIM_DEFAULT_HARDCODEDFONT_STRING "fim://" + +/* + * Various Fim messages. + */ +#define FIM_MSG_CONSOLE_FIRST_LINE_BANNER "=== This is the fim output console. You can scroll it up and down. ===\n" +#define FIM_MSG_CONSOLE_LONG_LINE "\n============================================================\n" +#define FIM_MSG_WAIT_PIPING "please wait while piping through" + +/* + * Some Fim internals flags. + */ +#define FIM_FLAG_MIRROR 1 +#define FIM_FLAG_FLIP 2 +#define FIM_FLAG_RGB2GRAY 4 +#define FIM_FLAG_RGB2GRAYGRAYGRAY 8 + + +/* FIM_XSTRINGIFY evaluates to a string with the supplied preprocessor symbol value */ +#define FIM_XSTRINGIFY(X) FIM_STRINGIFY(X) +/* FIM_STRINGIFY evaluates to a string with the supplied preprocessor symbol identifier */ +#define FIM_STRINGIFY(X) #X +#define FIM_MAN_fB(X) "\\fB" X "\\fP" +#define FIM_MAN_fR(X) "\\fR\\fI" X "\\fR" + +#endif /* FIM_FIM_H */ diff --git a/src/fim_limits.h b/src/fim_limits.h new file mode 100644 index 0000000..2d5b076 --- /dev/null +++ b/src/fim_limits.h @@ -0,0 +1,37 @@ +/* $LastChangedDate: 2013-07-04 23:07:07 +0200 (Thu, 04 Jul 2013) $ */ +/* + fim_limits.h : Basic Fim types limits + + (c) 2011-2013 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef FIM_LIMITS_FIM_H +#define FIM_LIMITS_FIM_H + +namespace fim +{ +#define FIM_IS_SIGNED(T) (((T)0) > (((T)-1))) +#define FIM_PROBABLY_SAME_TYPES(T1,T2) ((FIM_IS_SIGNED(T1)==FIM_IS_SIGNED(T2)) && sizeof(T1)==sizeof(T2)) +#define FIM_IS_UNSIGNED(T) (!FIM_IS_SIGNED(T)) +#define FIM_MAX_UNSIGNED(T) ((T)-1) +#define FIM_MAX_SIGNED(T) (FIM_HALF_MAX_SIGNED(T) - 1 + FIM_HALF_MAX_SIGNED(T)) +#define FIM_MIN_SIGNED(T) (-1 - FIM_MAX_SIGNED(T)) +#define FIM_MAX_VALUE_FOR_TYPE(T) (FIM_IS_SIGNED(T)?FIM_MAX_SIGNED(T):FIM_MAX_UNSIGNED(T)) +#define FIM_CHAR_BITS (8) +#define FIM_BYTES_COUNT (1<<(sizeof(T)*FIM_CHAR_BITS)) +} +#endif /* FIM_LIMITS_FIM_H */ diff --git a/src/fim_plugin.cpp b/src/fim_plugin.cpp new file mode 100644 index 0000000..82e4361 --- /dev/null +++ b/src/fim_plugin.cpp @@ -0,0 +1,164 @@ +/* $LastChangedDate: 2015-12-19 01:44:41 +0100 (Sat, 19 Dec 2015) $ */ +/* + fim_plugin.cpp : Fim plugin stuff + + (c) 2011-2015 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/* FIXME: this code is still at embryonic stage + * to test the sample opencv 'plugin', shall include -I/usr/include/opencv and link to -lcv -lcvaux (OpenCV version 1 API) + * e.g.: + * http://opencv.itseez.com/modules/core/doc/old_basic_structures.html?highlight=iplimage#void cvSetData(CvArr* arr, void* data, int step) + * */ + +#include "fim_plugin.h" + +#define FIM_WANT_OPENCV_EXAMPLE 0 + +#if FIM_WANT_OPENCV_EXAMPLE +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define FIM_INVERT_BYTE(x) x=~x +#define FIM_BLAKEN_BYTE(x) x=0 +#define FIM_PROCESS_BYTE(x) FIM_BLAKEN_BYTE(x) + +extern fim::CommandConsole fim::cc; + +static void fim_opencv_detect_and_draw( IplImage* img, struct ida_image *iimg ) +{ + /* + * this code is based on the example from the OpenCV wiki at: + * http://opencv.willowgarage.com/wiki/FaceDetection + * */ + CvPoint pt1, pt2; + int i; + fim_coo_t w=iimg->i.width; + static CvMemStorage* storage=FIM_NULL; + static CvHaarClassifierCascade* cascade=FIM_NULL; + static int haar_file_existent=-1; + const fim_char_t*haarfile="haarcascade_frontalface_alt.xml"; + string haarpath; + const fim_char_t*FIM_HAAR_PATH="FIM_HAAR_PATH"; + + if(haar_file_existent==0) + return; + storage=cvCreateMemStorage(0); + cvClearMemStorage(storage); + haarpath=fim::cc.getStringVariable(FIM_HAAR_PATH); +#ifdef HAVE_GETENV + if(haarpath==FIM_CNS_EMPTY_STRING) + haarpath=getenv(FIM_HAAR_PATH); +#endif /* HAVE_GETENV */ + haarpath+=haarfile; + + if(is_file(haarpath)) + haar_file_existent=1; + else + haar_file_existent=0; + /* Usage : + export FIM_HAAR_PATH=~/OpenCV-2.3.1/data/haarcascades/ fim ... + or + fim -C 'FIM_HAAR_PATH="~/OpenCV-2.3.1/data/haarcascades/"' ... + */ + if(!cascade ) + cascade=(CvHaarClassifierCascade*)cvLoad(haarpath.c_str(),FIM_NULL,FIM_NULL,FIM_NULL); + if( cascade ) + { + CvSeq*faces=cvHaarDetectObjects(img,cascade,storage,1.1,2,CV_HAAR_DO_CANNY_PRUNING,cvSize(40,40)); + CvRect * fr=FIM_NULL; + if(faces) + for(i=0;i<(faces ? faces->total:0);i++) + if(fr=(CvRect*)cvGetSeqElem(faces,i)) + { + pt1.x=fr->x; + pt2.x=fr->x+fr->width; + pt1.y=fr->y; + pt2.y=fr->y+fr->height; + for(fim_coo_t r=pt1.y;rdata[3*(r*w+c)+0]); + FIM_PROCESS_BYTE(iimg->data[3*(r*w+c)+1]); + FIM_PROCESS_BYTE(iimg->data[3*(r*w+c)+2]); + } + } + if(faces) + cvClearSeq(faces); + /* FIXME: The OpenCV documentation says that cvClearSeq() does not deallocate anything; + am not fully sure whether this code is completely correct, then. + */ + faces=FIM_NULL; + } + if(cascade) + cvReleaseHaarClassifierCascade(&cascade); + cascade=FIM_NULL; +} + +static fim_err_t fim_opencv_plugin_example(struct ida_image *img, const fim_char_t *filename) +{ + fim_coo_t r,c,h=img->i.height,w=img->i.width; + const int b=30; + IplImage*cvimage=FIM_NULL; + int depth=IPL_DEPTH_8U; + int channels=3; + CvSize size; + + if(!img) + goto err; +#if 0 + cvimage=cvLoadImage(filename,1); +#else + size.width=img->i.width; + size.height=img->i.height; + cvimage = cvCreateImage(size,depth,channels); + cvSetData(cvimage,img->data,3*img->i.width); +#endif + if(cvimage) + fim_opencv_detect_and_draw(cvimage,img); + else + goto err; + + return FIM_ERR_NO_ERROR; +err: + return FIM_ERR_GENERIC; +} +#endif /* FIM_WANT_OPENCV_EXAMPLE */ + +#if FIM_WANT_EXPERIMENTAL_PLUGINS +fim_err_t fim_post_read_plugins_exec(struct ida_image *img, const fim_char_t * filename) +{ + /* FIXME: here shall call all registered post-read plugins */ + /* as a first thing, need here a function drawing random boxes */ +#if FIM_WANT_OPENCV_EXAMPLE + return fim_opencv_plugin_example(img,filename); +#else + return FIM_ERR_NO_ERROR; +#endif /* FIM_WANT_OPENCV_EXAMPLE */ +} +#endif /* FIM_WANT_EXPERIMENTAL_PLUGINS */ + diff --git a/src/fim_plugin.h b/src/fim_plugin.h new file mode 100644 index 0000000..c6e6a6c --- /dev/null +++ b/src/fim_plugin.h @@ -0,0 +1,29 @@ +/* $LastChangedDate: 2013-07-04 23:07:07 +0200 (Thu, 04 Jul 2013) $ */ +/* + fim_plugin.h : Fim plugin definitions + + (c) 2011-2013 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef FIM_PLUGIN_FIM_H +#define FIM_PLUGIN_FIM_H +#include "fim.h" + +#if FIM_WANT_EXPERIMENTAL_PLUGINS +fim_err_t fim_post_read_plugins_exec(struct ida_image *img, const fim_char_t * filename); +#endif /* FIM_WANT_EXPERIMENTAL_PLUGINS */ +#endif /* FIM_PLUGIN_FIM_H */ diff --git a/src/fim_stream.cpp b/src/fim_stream.cpp new file mode 100644 index 0000000..2a7f171 --- /dev/null +++ b/src/fim_stream.cpp @@ -0,0 +1,97 @@ +/* $LastChangedDate: 2015-02-11 08:49:13 +0100 (Wed, 11 Feb 2015) $ */ +/* + fim_stream.cpp : Textual output facility + + (c) 2007-2015 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + + +#include "fim.h" +#include "fim_stream.h" + +namespace fim +{ + fim_stream::fim_stream(fim_str_t fd):fd_(fd) + { + } + + fim_stream& fim_stream::operator<<(const fim_byte_t* s) + { + *this<<(const fim_char_t*)s; + return *this; + } + + + fim_stream& fim_stream::operator<<(const fim::string&s) + { + *this<<(const fim_char_t*)(s.c_str()); + return *this; + } + + + fim_stream& fim_stream::operator<<(float f) + { + fim_char_t s[FIM_ATOX_BUFSIZE];sprintf(s,"%f",f); + *this<<(const fim_char_t*)s; + return *this; + } + + fim_stream& fim_stream::operator<<(int i) + { + fim_char_t s[FIM_ATOX_BUFSIZE];sprintf(s,"%d",i); + *this<=2) + std::cerr << s ; + } + } + } + //else if(s)printf("%s",s); + + return *this; + } +} + diff --git a/src/fim_stream.h b/src/fim_stream.h new file mode 100644 index 0000000..de84ee1 --- /dev/null +++ b/src/fim_stream.h @@ -0,0 +1,56 @@ +/* $LastChangedDate: 2015-02-11 08:43:28 +0100 (Wed, 11 Feb 2015) $ */ +/* + fim_stream.h : Textual output facility + + (c) 2007-2013 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +#ifndef FIM_FIM_STREAM_H +#define FIM_FIM_STREAM_H +#include "fim.h" +namespace fim +{ + /* + * this class is a stream used in Fim and should output to an internal console. + * + * TODO: error and to file dump. maybe, some day. + * move here the console handling functionalities. + * TODO: introduce an enum for output selection + * */ + + class fim_stream + { + fim_str_t fd_; + public: + fim_stream(fim_str_t fd=-1); + + fim_stream& operator<<(const fim_char_t* s); + + fim_stream& operator<<(const fim_byte_t* s); + + fim_stream& operator<<(const fim::string&s); + + fim_stream& operator<<(float f); + +#if FIM_WANT_LONG_INT + fim_stream& operator<<(int i); +#endif /* FIM_WANT_LONG_INT */ + + fim_stream& operator<<(fim_int i); + + }; +} +#endif /* FIM_FIM_STREAM_H */ diff --git a/src/fim_string.cpp b/src/fim_string.cpp new file mode 100644 index 0000000..8a52894 --- /dev/null +++ b/src/fim_string.cpp @@ -0,0 +1,618 @@ +/* $LastChangedDate: 2016-01-13 18:50:01 +0100 (Wed, 13 Jan 2016) $ */ +/* + string.cpp : A reimplementation of string class + + (c) 2007-2016 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +#include "fim.h" + +#define FIM_WANT_DEBUG_REGEXP 0 + +namespace fim +{ +#ifndef _FIM_STRING_WRAPPER + /* + * FIX ME : + * this string should be dynamic as soon as possible, + * without breaking the rest of the program. + */ + + void string::_string_init(void) + { + /* the string is initialized as unallocated and blank */ +#ifdef _FIM_DYNAMIC_STRING + s=FIM_NULL; + len=0; +#else + *s='\0'; +#endif /* _FIM_DYNAMIC_STRING */ + } + + std::ostream& operator<<(std::ostream &os,const string& s) + { + return s.print(os); + } + + std::ostream& operator<<(std::ostream &os, const std::vector & v) + { + os<<"{"; + for(size_t i=0;iassign(s.c_str()); + } + + string::string(const fim_char_t *str) + { + _string_init(); + this->assign(str); + } + + string::~string(void) + { +#ifdef _FIM_DYNAMIC_STRING + if(s && len==0){std::cout <<"anomalia\n";exit(-1);} + + if(s) + { + fim_free(s); + } +#else /* _FIM_DYNAMIC_STRING */ +#endif /* _FIM_DYNAMIC_STRING */ + } + + string::string(const int i) + { + _string_init(); + fim_char_t buf[FIM_CHARS_FOR_INT]; + sprintf(buf,"%d",i); + assign(buf); + } + + string::string(const fim_int i) + { + _string_init(); + fim_char_t buf[FIM_CHARS_FOR_INT]; + if(sizeof(fim_int)==sizeof(int)) + sprintf(buf,"%d",(int)i); + else + sprintf(buf,"%lld",(long long int)i); + assign(buf); + } + + string::string(const unsigned int i) + { + _string_init(); + fim_char_t buf[FIM_CHARS_FOR_INT]; + sprintf(buf,"%u",i); + assign(buf); + } + + const fim_char_t*string::c_str(void)const + { + if( this->isempty() == true ) return ""; + return s; /* yes, a heap allocated reference */ + } + + /* + * null or empty is the same for us + */ + bool string::operator==(const string& s)const + { + return ((*this) == s.c_str()); + } + + bool string::operator==(const fim_char_t * s)const + { + /* both empty ? */ + if(fim_empty_string(s) && this->isempty())return true; + /* if one only is empty then are not equal */ + if(fim_empty_string(s) || this->isempty())return false; + return strcmp(this->s, s)==0; + } + + bool string::operator!=(const string& s)const + { + return !((*this)==s); + } + + bool string::operator<=(const string& s)const + { + return ((*this)=(const string& s)const + { + return ((*this)>s)||((*this)==s); + } + + bool string::operator <(const string& s)const + { + return ((*this)(const string& s)const + { + return ((*this)>s.c_str()); + } + + bool string::operator >(const fim_char_t *s)const + { + if(this->isempty())return false; + if(!s || !*s)return true; + /* this is not an empty string */ + return (strcmp(this->s,s) >0); + } + + bool string::operator <(const fim_char_t *s)const + { + if(this->isempty()) + { + if( s && *s )return true; + else return false; + } + /* this is not an empty string */ + if(s && !*s)return false; + return (strcmp(this->s,s) <0); + } + + string& string::operator =(const string& s) + { + assign(s); + return *this; + } + + /* + * essentially, realloc for a l chars long string + * + * returns the new allocated size + * in case of allocation error, returns the available allocated space (could be >= 0) + * */ + int string::reallocate(int l=0) + { + if(l<=0)return reset(0); +#ifdef _FIM_DYNAMIC_STRING + ++l; + if(llen)fim_bzero(s+len,l-len); + len=l; + } + //if realloc fails, we keep the old one +#else /* _FIM_DYNAMIC_STRING */ +#endif /* _FIM_DYNAMIC_STRING */ + return this->size(); + } + + string string::operator+=(const string& s) + { + + int r,n;// returned, needed + n = ( this->length() + s.length() ); + r = this->reallocate( n ); + if(r < n || r==0) + { + return *this; // ! FIXME ! + } + int tlen=strlen(this->s), + slen=strlen(s.c_str()), + flen=this->size()-1-slen-tlen; + strncat(this->s+tlen,s.c_str(),slen); + return string(*this); + } + + /* allocates a new object and returns it */ + string string::operator+(const string& s)const + { + string res(*this); + res+=s; + return res; + } + + /* reports the effective used space */ + int string::length(void)const + { + if(isempty())return 0; + return strlen(s); + } + + /* reports the effective allocated space */ + int string::size(void)const + { +#ifdef _FIM_DYNAMIC_STRING + if(!s)return 0; + return len; +#else /* _FIM_DYNAMIC_STRING */ + return sizeof(s); +#endif /* _FIM_DYNAMIC_STRING */ + } + + int string::find(const string&str)const + { + return find(str.c_str()); + } + + /* + * returns the new length + * */ + int string::assign(const string&str) + { + return assign(str.c_str()); + } + + /* + * returns the new length + * */ + int string::assign(const fim_char_t *s) + { + int l,r; + if(!s || !*s) // length is zero in these cases + { + return this->reset(0); + } + l=strlen(s);//at least 1, as the string is not empty + + /* + * the string is reset, and should allocate some bytes for us (or have already allocated).. + * */ + if((r=reset(l))<1 || l<1 ) + { + return this->reset(0); + } + + strncpy(this->s,s,r); //r can be longer than strlen(s) + + this->s[max((min(r-1,l)),0)]='\0'; /* remember r is the size of the allocated space */ + + return (this->size()); /* the effective allocated memory */ + } + + /* + * empty or null string is always found + * */ + int string::find(const fim_char_t*ss)const + { + if( this->isempty() && !ss )return 0; + if( this->isempty() && *ss!='\0')return -1; + if(!this->isempty() && *ss=='\0')return 0; + + const fim_char_t*p=strstr(s,ss);if(!p)return -1;return p-s; + } + + std::ostream& string::print(std::ostream &os)const + { + if(this->isempty())return os; + return os<s; + } + + operator string::int()const{return atoi(s);} + operator string::fim_int()const{return fim_atoi(s);} + operator string::float()const{return fim_atof(s);} + + /* + * a string is empty if FIM_NULL or allocated to zero bytes (if possible) + * */ + bool string::isempty(void)const + { +#ifdef _FIM_DYNAMIC_STRING + return (s==FIM_NULL || len==0 || *s=='\0'); +#else /* _FIM_DYNAMIC_STRING */ + return *s=='\0'; +#endif /* _FIM_DYNAMIC_STRING */ + } + + /* + * make room for a string long at most l + * + * moreover, the allocated space is cleared and the maximum + * returns the new allocated size + * in case of allocation error, returns the available allocated space (could be >= 0) + */ + int string::reset(int l) + { + l=min(l,max_string()); /* etica professionale */ + +#ifdef _FIM_DYNAMIC_STRING + //blanking + if(s){fim_free(s); s=FIM_NULL;len=0;} + //do we need some allocation? only if l was already > 0 + if(l+10) + { + +#if 1 + // this is a sort of buffering + #define BUFSIZE TOKSIZE + l=(lsize()); + } +#else /* _FIM_STRING_WRAPPER */ + std::ostream& operator<<(std::ostream &os,const string& s) + { + return os << s.c_str(); + } + + std::ostream& operator<<(std::ostream &os, const std::vector & v) + { + std::cout<<"{"; + for(size_t i=0;ic_str());} +#endif /* FIM_WANT_LONG_INT */ + string::operator fim_int (void)const{return fim_atoi(this->c_str());} + string::operator float(void)const{return fim_atof(this->c_str());} + + int string::find_re(const fim_char_t*r, int *mbuf)const + { + /* + * each occurrence of regular expression r will be substituted with t + * + * FIXME : return values could be more informative + * NOTE: mbuf is int, but pmatch->rm_so and pmatch->rm_eo are regoff_t from regex.h + * */ + regex_t regex; + const size_t nmatch=1; + regmatch_t pmatch[nmatch]; + + if( !r || !*r ) + return -1; + + if( regcomp(®ex,r, 0 | REG_EXTENDED | REG_ICASE ) != 0 ) + return -1; + + if(regexec(®ex,c_str(),nmatch,pmatch,0)==0) + { + regfree(®ex); + if(mbuf) + { + mbuf[0]=pmatch->rm_so; + mbuf[1]=pmatch->rm_eo; + } + return pmatch->rm_so; + } + regfree(®ex); + return -1; + } + + void string::substitute(const fim_char_t*r, const fim_char_t* s, int flags) + { + /* + * each occurrence of regular expression r will be substituted with s + * + * FIXME : return values could be more informative + * FIXME : not efficient + * */ + regex_t regex; + const int nmatch=1; + regmatch_t pmatch[nmatch]; + int off=0,sl=0; + std::string rs =FIM_CNS_EMPTY_STRING; + int ts=this->size(); + + if( !r || !*r || !s ) + return; + + if( regcomp(®ex,r, 0 | REG_EXTENDED | REG_ICASE | flags ) != 0 ) + return; + + sl=strlen(s); + //const int s_len=strlen(s); + while(regexec(®ex,off+c_str(),nmatch,pmatch,REG_NOTBOL)==0) + { + /* + * please note that this is not an efficient substitution implementation. + * */ + if(FIM_WANT_DEBUG_REGEXP)std::cerr << "rm_so :"<rm_so<< " rm_eo:"<rm_eo<<"\n"; + if(FIM_WANT_DEBUG_REGEXP)std::cerr << "pasting "<rm_so<<"\n"; + if(pmatch->rm_so>0) + rs+=substr(off,pmatch->rm_so); + if(FIM_WANT_DEBUG_REGEXP)std::cerr << "forward to "<rm_eo,ts); + if(FIM_WANT_DEBUG_REGEXP)std::cerr << "match at "<rm_so << " to " << off+pmatch->rm_eo<< ", off="<rm_eo; + if(FIM_WANT_DEBUG_REGEXP)std::cerr << "forward to "<off) + rs+=substr(off,ts); + if(FIM_WANT_DEBUG_REGEXP)std::cerr << "res is "<0); + } + + fim::string string::line(int ln)const + { + /* + * returns the ln'th line of the string, if found, or "" + * */ + const fim_char_t*s,*f; + s=this->c_str(); + f=s; + if(ln< 0 || !s)return ""; + while( ln && ((f=strchr(s,'\n'))!=FIM_NULL ) ) + { + --ln; + s=f+1; + } + if(!ln) + { + const fim_char_t *se=s; + if(!*s)se=s+strlen(s); + else se=strchr(s,'\n'); + fim::string rs; + rs=substr(s-this->c_str(),se-s).c_str(); + return rs; + } + return ""; + } +#endif /* _FIM_STRING_WRAPPER */ +} + diff --git a/src/fim_string.h b/src/fim_string.h new file mode 100644 index 0000000..b75c5e5 --- /dev/null +++ b/src/fim_string.h @@ -0,0 +1,156 @@ +/* $LastChangedDate: 2015-12-19 01:58:26 +0100 (Sat, 19 Dec 2015) $ */ +#ifndef FIM_STRING_H +#define FIM_STRING_H +/* + string.h : Fim's own string implementation header file + + (c) 2007-2015 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/* + * the rest of the program waits still for a proper adaptation of dynamic strings. + */ +//#define _FIM_DYNAMIC_STRING 1 +#define _FIM_STRING_WRAPPER 1 + + +#define FIM_CHARS_FOR_INT 32 /* should fit a pointer address printout */ + +namespace fim +{ +#ifndef _FIM_STRING_WRAPPER + +#define fim_free(x) {free(x);} +//#define fim_free(x) {std::cout<<"freeing "<<(int*)x<<"\n";free(x);x=FIM_NULL;std::cout<<"freeed!\n";} +#define fim_realloc(x,n) realloc((x),(n)) +#define fim_empty_string(s) (!(s) || !(*(s))) + + /* + * Allocation and duplication of a single string + */ + static fim_char_t * fim_dupstr (const fim_char_t* s); + + class string{ + /* + * this is a declaration of my love to the STL.. (i wrote this dumb code + * in dumb 10 minutes after spending dumb hours messing with the original + * STL string template .. ) ( am i dumb ? ghghhh.. probably .. ) + * + * FIX ME : all of this should be made dynamic, but with the right semantics. + */ + static const int TOKSIZE=128*8*4*2; //max len.NUL included +#ifdef _FIM_DYNAMIC_STRING + fim_char_t*s; /* the string : can be FIM_NULL */ + int len; /* the allocated amount */ + std::string ss; +#else /* _FIM_DYNAMIC_STRING */ + fim_char_t s[TOKSIZE]; +#endif /* _FIM_DYNAMIC_STRING */ + public : + void _string_init(void); + + int reallocate(int l); + + int reset(int l); + + bool isempty(void)const; + + virtual ~string(void);//virtual, as -Weffc++ suggests + string(void); + string(const string& s); + string(const fim_char_t *str); + string(const int i); + string(const unsigned int i); + const fim_char_t*c_str(void)const; + bool operator==(const string& s)const; + bool operator==(const fim_char_t * s)const; + bool operator!=(const string& s)const; + bool operator<=(const string& s)const; + bool operator>=(const string& s)const; + bool operator <(const string& s)const; + bool operator >(const string& s)const; + bool operator >(const fim_char_t *s)const; + bool operator <(const fim_char_t *s)const; + + string& operator =(const string& s); + string operator+=(const string& s); + string operator+(const string& s)const; + int reinit(const int n)const; + int length(void)const; + static int max_string(void){return TOKSIZE-1;} + int size(void)const; + int find(const string&str)const; + int assign(const string&str); + int assign(const fim_char_t*str); + int find(const fim_char_t*ss)const; + std::ostream& print(std::ostream &os)const; +// int operator=(int &i,const string& s){i=-1;return i;} + operator int(void)const; + operator float(void)const; + }; +#else /* _FIM_STRING_WRAPPER */ + class string:public std::string + { + public: + string(); + + /* a virtual destructor will behave correctly when destroying this class + * objects with base pointers .. */ + ~string(){} + + /* + if not, exception: + terminate called after throwing an instance of 'std::logic_error' + what(): basic_string::_S_construct FIM_NULL not valid + */ + string(const std::string&s):std::string(s){} + string(const fim_char_t*s):std::string(s?s:""){} + + string(fim_char_t c); +#if FIM_WANT_LONG_INT + string(int i); +#endif /* FIM_WANT_LONG_INT */ + string(fim_int i); + string(float i); + string(int * i); + string(size_t i); + +/* + the following two operators are very nice to use but pose unexpected problems. +*/ + operator fim_int (void)const; +#if FIM_WANT_LONG_INT + operator int (void)const; +#endif /* FIM_WANT_LONG_INT */ + operator float(void)const; + + string operator+(const string s)const; + /* copy constructor */ + string(const string& s); + bool re_match(const fim_char_t*r)const; + void substitute(const fim_char_t*r, const fim_char_t* s, int flags=0); + fim::string line(int ln)const; + size_t lines(void)const; + int find_re(const fim_char_t*r,int *mbuf=FIM_NULL)const; + }; + + +#endif /* _FIM_STRING_WRAPPER */ +} + + +#endif /* FIM_STRING_H */ diff --git a/src/fim_types.h b/src/fim_types.h new file mode 100644 index 0000000..3c66422 --- /dev/null +++ b/src/fim_types.h @@ -0,0 +1,90 @@ +/* $LastChangedDate: 2015-12-19 12:03:27 +0100 (Sat, 19 Dec 2015) $ */ +/* + fim_types.h : Basic Fim type declarations + + (c) 2011-2015 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/* This file will grow, as definitions will be moved there from fim.h */ + +#ifndef FIM_TYPES_FIM_H +#define FIM_TYPES_FIM_H + +#if defined(__GNUC__) +#define FIM_RSTRCT __restrict__ +#else /* defined(__GNUC__) */ +#define FIM_RSTRCT +#endif /* defined(__GNUC__) */ +#ifdef HAVE_CONFIG_H +#include +#endif /* HAVE_CONFIG_H */ +#if FIM_WANT_LONG_INT +#include +#endif /* FIM_WANT_LONG_INT */ + +//namespace fim +//{ +#if FIM_WANT_LONG_INT + typedef int64_t fim_int; /* a type for fim's internal integer type, always signed */ +#else /* FIM_WANT_LONG_INT */ + typedef int fim_int; /* a type for fim's internal integer type, always signed */ +#endif /* FIM_WANT_LONG_INT */ + typedef int fim_pan_t; /* a type for pixel offsets (neg/pos) */ + typedef int fim_off_t; /* a type for pixel offsets (positive) */ + typedef float fim_scale_t; /* a type for image scaling */ + typedef float fim_angle_t; /* a type for angles */ + typedef float fim_float_t; /* a type for floats */ + typedef fim_int fim_page_t; /* a type for multipage document pages */ + typedef int fim_pgor_t; /* a type for page orientation */ + typedef bool fim_bool_t; /* a type for bolean expressions */ + typedef int fim_coo_t; /* a type for coordinates */ + typedef int fim_cc_t; /* a type for console control */ + typedef int fim_flags_t; /* a type for display flags */ + typedef int fim_bpp_t; /* a type for bits Per Pixel */ + typedef int fim_key_t; /* a type for keycodes */ + typedef int fim_err_t; /* a type for errors */ + typedef int fim_perr_t; /* a type for program errors */ + typedef int fim_status_t; /* a type for fim's status */ + typedef int fim_cycles_t; /* a type for fim's cycles */ + typedef int fim_cmd_type_t; /* a type for fim's command types */ + typedef int fim_var_t; /* a type for fim's variable types */ + typedef int fim_str_t; /* a type for stdin/stdout streams */ + typedef int fim_sys_int; /* always int */ + typedef int fim_color_t; /* >= 4 bytes */ + + typedef int fim_ts_t; /* a type for time, in seconds */ + typedef int fim_tms_t; /* a type for time, in milliseconds */ + typedef double fim_fms_t; /* a type for time, in milliseconds, floating point */ + typedef unsigned long fim_tus_t; /* a type for time, in microseconds */ + typedef char fim_char_t; /* a type for chars */ + typedef unsigned char fim_byte_t; /* a type for bytes */ + typedef size_t fim_size_t; /* always size_t */ + enum fim_redraw_t { FIM_REDRAW_UNNECESSARY=0, FIM_REDRAW_NECESSARY=1}; +//} + +/* we wait for variadic macros support in standard C++ */ +#define FIM_FPRINTF fprintf + +#if FIM_USE_CXX11 +#define FIM_NULL nullptr +#define FIM_ENUM_BASE : fim_flags_t /* In the future might want to add the class attribute to make the enums scoped. */ +#else /* FIM_USE_CXX11 */ +#define FIM_NULL NULL +#define FIM_ENUM_BASE +#endif /* FIM_USE_CXX11 */ + +#endif /* FIM_TYPES_FIM_H */ diff --git a/src/fim_wrappers.h b/src/fim_wrappers.h new file mode 100644 index 0000000..db1cd39 --- /dev/null +++ b/src/fim_wrappers.h @@ -0,0 +1,34 @@ +/* $LastChangedDate: 2016-05-10 10:40:12 +0200 (Tue, 10 May 2016) $ */ +/* + fim_wrappers.h : Some wrappers + + (c) 2011-2016 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef FIM_WRAPPERS_H +#define FIM_WRAPPERS_H +namespace fim +{ +/* symbolic wrappers for memory handling calls */ +#define fim_calloc(x,y) calloc((x),(y)) /* may make this routine aligned in the future */ +#define fim_stralloc(x) (fim_char_t*) calloc((x),(1)) /* ensures that first char is NUL */ +#define fim_malloc(x) malloc(x) +#define fim_free(x) free(x) +#define fim_memset(x,y,z) memset(x,y,z) +#define fim_bzero(x,y) fim_memset(x,0,y) /* bzero has been made legacy by POSIX.2001 and deprecated since POSIX.2004 */ +} +#endif /* FIM_WRAPPERS_H */ diff --git a/src/fimgs b/src/fimgs new file mode 100755 index 0000000..959a441 --- /dev/null +++ b/src/fimgs @@ -0,0 +1,319 @@ +#!/bin/bash +# $Id: fimgs 1265 2017-06-17 12:44:48Z dezperado $ + +# (c) 2007-2013 Michele Martone + +# This is a modified version of the original fbgs script,by Gerd Knorr +# and is capable of displaying pdf, eps, ps, and dvi files. +# Now enhanced for viewing .cbr and .cbz files :)! +# +# Note : it won't probably work on bash, version < 3.0 because of regular expressions. + +# this script wants a temporary directory to stores rendered/wget'ed files +# this directory is named after the process ID + +# 20070925 regular expressions failed on some configurations, so were 'cut'.. :-( +# 20090917 TODO: should work with no rar or no unzip +# 20091214 TODO: and options to wget ? +# 20090525 should use -o option to rename files to a known filename before loading them, in the temporary directory. + +DIR="${TMPDIR-/var/tmp}/fbps-$$" +#GSRESOLUTION="" +#GSRESOLUTION=${GSRESOLUTION:--r240x240} +GSRESOLUTION=${GSRESOLUTION:-120x120} +shopt -s nocasematch + + +# we must have write permissions in that directory +mkdir -p $DIR || exit 1 + +# we want that directory clean after this script execution, no matter what happens +trap "rm -rf $DIR" EXIT + +# useless for now :) +# declare -f + +# useless, too +# export -f + +# as advised in man which, for mysterious reasons ( C compatible ) +which () +{ + ( alias; declare -f ; ) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot $@ +} + +#export -f which + +# checks if the first supplied argument is in the current $PATH +function check_in_path() +{ + local cmd="$1"; + [[ -z "$cmd" ]] && return 0 + [[ -z $(which "$cmd" 2>/dev/null) ]] && return -1 + return 0 +} + +# output functions +function info() { echo ' [+]' "$@" 1>&2 ; } +function einfo() { echo ' [-]' "$@" 1>&2 ; } +function die() { einfo "ERROR : "$@ 1>&2 ; exit -1 ; } + +# our favourite framebuffer viewing program :) +FBI=fim + +check_in_path $FBI || die "no fim in \$PATH" +check_in_path sort || die "no sort in \$PATH" +check_in_path echo || die "no echo in \$PATH" +check_in_path find || die "no find in \$PATH" +check_in_path wget || die "no wget in \$PATH" +check_in_path gs || die "no gs (ghostscript) in \$PATH" +check_in_path tar || die "no tar in \$PATH" +check_in_path basename || die "no basename in \$PATH" +check_in_path md5sum || die "no md5sum in \$PATH" +#check_in_path rar || die "no rar in \$PATH" +#check_in_path unzip || die "no unzip in \$PATH" +#check_in_path scp || die "no scp in \$PATH" + + +# parse options +fbiopts="-w" +gsopts="-q" +passwd="" +opt=1 + +# in this way odd filenames are kept intact, be WARNED +while test "$opt" = "1" +#set -- `getopt "" "$@"` +#while [ ! -z "$1" ] +do + case "$1" in +# -l) gsopts="$gsopts -r100x100" +# shift +# ;; +# -xl) gsopts="$gsopts -r120x120" +# shift +# ;; +# -xxl) gsopts="$gsopts -r150x150" +# shift +# ;; +# -q | -a) +# fbiopts="$fbiopts $1" +# shift +# ;; +# -d | -m | -t | -g | -f) +# fbiopts="$fbiopts $1 $2" +# shift; shift +# ;; + # explicit option passing +# -t) fbiopts="$fbiopts --no-framebuffer" +# shift +# ;; + -r) GSRESOLUTION="$2"; + shift ; shift + ;; +# -c) fbiopts="$fbiopts --execute-commands $2" +# shift; shift +# ;; +# -F) fbiopts="$fbiopts --final-commands $2" +# shift; shift +# ;; + -p) GSPASSWORD="$2" + shift; shift + ;; + -m) shift +cat << EOF +.TH fimgs 1 "(c) 2007-2011 Michele Martone" +.SH NAME +fimgs - poor man's [http://]PostScript/pdf/dvi/cbr/rar/cbz/zip viewer for the linux +framebuffer console +.SH SYNOPSIS +.B fimgs [ {fimgs-options} ] file [-- [{fim-options}]] +.SH DESCRIPTION +.B fimgs +is a simple wrapper script which takes a PostScript or pdf or .cbr or .rar or .cbz or .zip or .dvi or any of the above prefixed with http:// or https:// or ssh:// as input, renders the pages using ghostscript into a temporary directory and finally calls \fB $FBI\fP to display them. + +In case of compressed archives (in zip or rar formats), the images are decompressed into a directory and displayed using \fB fim\fP. +In this latter case, only images contained in the archive will be displayed (no nested archives or pdf's or ps's or dvi's). + +The temporary directory name is taken from the \$TMPDIR environment variable. + +.SH OPTIONS +To pass through options to \fB fim\fP, you may specify them after "--". + +.B -r {resolution} +Specify resolution for the 'gs' -r option (e.g.: 96x96; default $GSRESOLUTION). +.TP + +.B -m +Dump a man page for fimgs. +.TP + +.B -p {password} +Specify password for the 'gs' -p (password) option. +.TP + +.B -h +Will display a help message. +.\" Additionally you can specify -l, -xl or -xxl to get the pages +.\" rendered with 100, 120 or 150 dpi (default is 75). +.SH SEE ALSO +fim(1), fimrc(1), gs(1), fbi(1), fbgs(1), bash(1) +.SH AUTHOR +Michele Martone . +EOF + exit; + ;; + -h) + #help text + echo "$0 [{fimgs-options}] {files} [-- [fim-options]] " + echo -e "\nNote that any file in {files} may be a (correctly named) :" + echo -e " PDF (.pdf) file" + echo -e " Postscript (.ps) file" + echo -e " TAR (.tar) archive" + echo -e " BZ2 (.bz2) archive" + echo -e " GZIP (.gz) archive" + echo -e " https:// resource (web resource)" + echo -e " http:// resource (web resource)" + echo -e "\nNote that you cannot view files named like options (no -- meta-option apply to fimgs)." + echo -e "\n \`man fimgs\` will give you more info." + exit 1 + ;; + *) + [[ "$1" =~ '^-.*' ]] && fbiopts="$fbiopts $1"; + break;; +# -*) echo "unknown option: $1" +# exit 1 +# ;; +# *) opt=0 +# ;; + esac +# shift +done +############################################################################### +############################################################################### +## HANDLING OF CBR AND CBZ ARCHIVES +############################################################################### +UNCBZ="unzip" ; ZOPT="-x '*/*'" # suits for Info-ZIP implementation +UNCBR="rar x" # suits for Alexander Roshal's RAR 3.51 +UNTAR="tar xf" +UNTGZ="tar xzf" +UNBZ="tar xjf" +#while [[ "$1" != "" ]] +#while [[ "$#" -gt "0" ]] +while test x"$opt" = x"1" +#while shift +do + f="$1"; + if test x"$f" == x"--" ; then shift; while test "$#" -gt "0" ; do f="$1"; fbiopts="$fbiopts $1" ; shift; done; f=/dev/null ; fi + shift; + [[ "$f" =~ 'https://' ]] && { fn="$DIR"/"`basename $f`" && wget "$f" -O "$fn" && trap "rm $fn" EXIT ; f="$fn"; } + [[ "$f" =~ 'http://' ]] && { fn="$DIR"/"`basename $f`" && wget "$f" -O "$fn" && trap "rm $fn" EXIT ; f="$fn"; } + [[ "$f" =~ 'ssh:' ]] && { bfn="`basename ${f/#ssh:/}`" && fn="$DIR"/"`echo $bfn | sed s/^.*://`" && scp "${f/ssh:/}" "$fn" && trap "rm $fn" EXIT ; f="$fn"; } + [[ -z "$f" ]] && break ; + #while [[ ! -f "$f" ]] ; do shift ; [[ "$#" -lt 0 ]] && break 2 ; done +############################################################################### +## HANDLING OF DVI,PS AND PDF FILES +############################################################################### +#[[ "$f" =~ .dvi$ ]] && f="/tmp/$$.ps" && dvips -q "$f" -o "$f" && trap "rm $f ; rm -fR $DIR" EXIT +#[[ -f "$f" ]] || { echo "an option!" ; fbiopts="$fbiopts $f" ; break ; } # not a file, but an option + + +[[ "$f" =~ .dvi$ ]] && fbiopts=" -P $fbiopts" +[[ "$f" =~ .pdf$ ]] && fbiopts=" -P $fbiopts" +[[ "$f" =~ .ps$ ]] && fbiopts=" -P $fbiopts" +[[ "$f" =~ .eps$ ]] && fbiopts=" -P $fbiopts" + +if ( [[ "$f" =~ .ps$ ]] || [[ "$f" =~ .pdf$ ]] ) || ( [[ "$f" =~ .eps$ ]] || [[ "$f" =~ .dvi$ ]] ) +then + +BDIR='' +if check_in_path md5sum +then + DIRS=$(echo "$f" | md5sum ) + DIRS=${DIRS// /} + DIRS=${DIRS//-/} + BDIR="$DIR/$DIRS" + # this means that giving duplicate input files will overwrite the original render directory... +else + BDIR="$DIR/"$(basename "$f") +fi +mkdir -p $BDIR || die "failed mkdir $BDIR" +info "rendering $f to $BDIR.." + +#this is a workaround for gs's .. bug .. + +[[ "$f" =~ "^\.\." ]] && f="$PWD/$f" + +# note : we cannot render gs renderable documents with more than 1000 pages... +gs -dSAFER -dNOPAUSE -dBATCH \ + -sPDFPassword="$GSPASSWORD" \ + -sDEVICE=png256 -r${GSRESOLUTION} -sOutputFile=$BDIR/ps%03d.png \ + $gsopts \ + "$f" || die "ghostscript failed rendering!" +# still unused options : +# -sDEVICE=tiffpack \ +# -sOutputFile=$DIR/ps%03d.tiff + +# tell the user we are done :-) +#echo -ne "\\007" +#echo stuff : `ls -l $DIR` +#echo "contents of $DIR:" +#$FBI $fbiopts -P $DIR/ps*.png +#$FBI $fbiopts -P $DIR/ps*.png 2>/dev/null +#fbi $fbiopts -P $DIR/ps*.tiff +# sanity check +#pages=`ls $DIR/ 2>/dev/null | wc -l` +#if test "$pages" -eq "0"; then +# echo +# echo "Oops: ghostscript wrote no pages ($pages)?" +# echo +# exit 1 +#elif ( ( [[ "$f" =~ \\.cbr$ ]] || [[ "$f" =~ \\.cbz$ ]] ) || ( [[ "$f" =~ \\.rar$ ]] || [[ "$f" =~ \\.zip$ ]] ) || ( [[ "$f" =~ \\.tgz$ ]] || [[ "$f" =~ \\.tar.gz$ ]] ) || ( [[ "$f" =~ \\.tar$ ]] || [[ "$f" =~ \\.tar.bz2$ ]] ) ) && ! [[ "$f" =~ '^http://' ]] +elif ( ( [[ "$f" =~ .CBR$ ]] || [[ "$f" =~ .CBZ$ ]] || [[ "$f" =~ .cbr$ ]] || [[ "$f" =~ .cbz$ ]] ) || ( [[ "$f" =~ .rar$ ]] || [[ "$f" =~ .zip$ ]] ) || ( [[ "$f" =~ .tgz$ ]] || [[ "$f" =~ .tar.gz$ ]] ) || ( [[ "$f" =~ .tar$ ]] || [[ "$f" =~ .tar.bz2$ ]] ) ) && ! [[ "$f" =~ 'http://' ]] && ! [[ "$f" =~ 'https://' ]] +then +# in the case of an archive ... +# an ideal fimgs script would unpack recursively in search for interesting files.. + + +# 20070925 there were problems with '\\.' so i put '.' only :/ +[[ "$f" =~ .cbr$ ]] && ( $UNCBR "$f" "$DIR" ) +#[[ "$f" =~ .CBR$ ]] && ( $UNCBR "$f" "$DIR" ) +[[ "$f" =~ .rar$ ]] && ( $UNCBR "$f" "$DIR" ) +[[ "$f" =~ .cbz$ ]] && ( $UNCBZ "$f" $ZOPT -d "$DIR" ) +#[[ "$f" =~ .CBZ$ ]] && ( $UNCBZ "$f" $ZOPT -d "$DIR" ) +[[ "$f" =~ .zip$ ]] && ( $UNCBZ "$f" $ZOPT -d "$DIR" ) +[[ "$f" =~ .tgz$ ]] && ( $UNTGZ "$f" -C "$DIR" ) +[[ "$f" =~ .tar.gz$ ]] && ( $UNTGZ "$f" -C "$DIR" ) +[[ "$f" =~ .tar$ ]] && ( $UNTAR "$f" -C "$DIR" ) +[[ "$f" =~ .tar.bz2$ ]] && ( $UNBZ "$f" -C "$DIR" ) + +# ... but this fimgs script is lazy and it gets satisfied with a bare decompress ! + +# lone file handling.. +#[[ "$?" == 0 ]] || echo "this script is not suited for file $f" +else + [[ -f "$DIR/`basename $f`" ]] || cp -- "$f" "$DIR" || die "problems copying $f to $DIR" +fi +#fi +done +# show pages +#fbiopts= +#$FBI $fbiopts -P -- $DIR/* $DIR/*/* $DIR/*/*/* $DIR/*/*/*/* $DIR/*/*/*/*/* $DIR/*/*/*/*/*/* $DIR/*/*/*/*/*/*/* +#echo "options are $fbiopts" + +# there should be some filter to avoid feed garbage to fim ... +find $DIR/ -type f -iname '*.jpg' -or -iname '*.jpeg' -or -iname '*.png' -or -iname '*.gif' -or -iname '*.bmp' -or -iname '*.tiff' | sort -n | $FBI $fbiopts -- - + +# when no framebuffer device is available, we could invoke another console viewer, couldn't we ? +# cacaview $DIR/* + +# the old syntax +# $FBI $fbiopts -P `find $DIR -iname '*.png' -or -iname '*.jpg' -or -iname '*.gif' -or -iname '*.jpeg' -or -iname '*.tiff' -or -iname '*.bmp'` + +# or the older one .. +#$FBI $fbiopts -P -- $files + +# or the ancient one +#fbi $fbiopts -P $DIR/ps*.tiff + + diff --git a/src/fimrc b/src/fimrc new file mode 100644 index 0000000..16a2255 --- /dev/null +++ b/src/fimrc @@ -0,0 +1,302 @@ +# $LastChangedDate: 2016-02-04 19:53:36 +0100 (Thu, 04 Feb 2016) $ +# Contents of the default 'fimrc' file, hardcoded in the fim executable. +# Read the documentation (man fimrc) to discover how to change this default hardcoded file and how to make your own. +# Note that usually a ~/.fimrc file is read after these options take effect, so you could reset all of this with ease. +# Lines beginning with a pound (#) are ignored by fim (they are treated as comments). +# +# Internal variables. +# Some of these variables influence Fim's behaviour (input variables), some are set by Fim (output variables). +# It is wise the input variables are set at the beginning of the file, so the bottom may issue commands correctly affected by them. +if(_debug_commands==''){_debug_commands=0;} +if(_command_expansion==''){_command_expansion=1;} +if(_display_status==''){_display_status=0;} +if(_max_cached_images==''){_max_cached_images=5;} +if(_max_cached_memory==''){_max_cached_memory=81920;} +if(_max_iterated_commands==''){_max_iterated_commands=100;} +if(_want_prefetch==''){_want_prefetch=1;} +if(_no_external_loader_programs==''){_no_external_loader_programs=0;} +if(_scale_style==''){_scale_style='b';} +if(_save_fim_history==''){_save_fim_history=1;} +if(_load_fim_history==''){_load_fim_history=1;} +if(_verbose_keys==''){_verbose_keys=0;} +if(_display_busy==''){_display_busy=1;} +if(_ignorecase==''){_ignorecase=1;} +if(_re_search_opts==''){_re_search_opts='bi';} +if(_console_offset==''){_console_offset=0;} +if(_console_key==''){_console_key=58;} +if(_display_as_binary==''){_display_as_binary=0;} +if(_push_checks==''){_push_checks=1;} +#if(_want_wm_caption_status==''){_want_wm_caption_status=0;} +if(_want_exif_orientation==''){_want_exif_orientation=1;} +if(ascale==''){ascale="1.0";} +if(_use_mipmaps==''){_use_mipmaps=1;} +# +# External variables (not used internally). +if(allow_round_scroll==''){allow_round_scroll=0;} +if(console_scroll_n==''){console_scroll_n=3;} +# +alias "toggleautoflip" "_autoflip=1-_autoflip;" ""; +alias "toggleautonegate" "_autonegate=1-_autonegate;" ""; +alias "toggleflip" "i:flipped=1-i:flipped;" ""; +alias "flip" "toggleflip;redisplay;" "flip the current image along the horizontal axis"; +alias "fliponce" "flip;toggleflip;" ""; +alias "toggleautomirror" "_automirror=1-_automirror;" ""; +alias "togglemirror" "i:mirrored=1-i:mirrored;" ""; +alias "mirror" "togglemirror;redisplay;" "mirror the image along the vertical axis" ""; +alias "mirroronce" "mirror;togglemirror;" ""; +alias 'toggleLimitMarked' '__pre_limit_fileindex=_fileindex;_limit_mode=1-_limit_mode; if(_limit_mode==1){limit "!";} else { limit; } if(_filelistlen<1){_limit_mode=0;limit;goto __pre_limit_fileindex;} i:fresh=1;redisplay; ' "toggle between limiting file list to the marked files and the full list"; +# Warning : binding to C-s, C-z and C-c won't make effect, as these +# codes are get caught by the console driver and will have no effect in fim. +# Moreover, C-z will crash fim and C-c will terminate it. +# Some other combinations (e.g.:C-l) may have similar problems in your console. +bind 'f' "flip;"; +bind 'F' "fliponce;"; +bind 'm' "mirror;"; +bind 'M' "mirroronce;"; +bind 'q' "quit"; +bind 'Esc' "quit"; +#bind 'n' "next_file;"; +#bind 'n' "next;"; +bind 'C-h' "help"; +#bind '?' "help"; # assigned to back-search +#bind '/' "help"; # assigned to forward-search +bind '=' "scale '100%'"; +#bind 'p' "prev_file;"; +bind 'Del' "list 'pop';reload;"; +#bind 's' "list 'sort'"; +bind 's' "scrollforward"; +bind 'C-s' "swap;redisplay;"; +bind 'S' "toggleDisplayStatus"; +bind 'I' "toggleautonegate"; +bind 'i' "negate;redisplay;"; +bind 'g' "desaturate;redisplay;"; +bind 'G' "toggleDesaturate;"; +#bind 'R' "reload"; +#bind 'R' "redisplay"; +bind 'r' "rotate90;"; +bind 'R' "rotate270;"; +#bind 'R' "rotate10;display;"; +#bind 'r' "rotate10_ccw;display;"; +#bind 'r' "reload;"; +#bind 'C-d' "display"; +bind '+' "magnify"; +#bind 'C-+' "angle=angle+10.0;display;"; +bind 'a' "scale 'a';"; +bind 'H' "scale 'H';"; +bind 'Tab' "toggleVerbosity"; +bind 'Menu' "toggleVerbosity"; +#bind 'C-k' "_want_wm_caption_status=1-_want_wm_caption_status;status ' '"; +bind 'v' "toggleDisplayStatus"; +bind 'A' "A"; +bind 'C-m' "list 'mark'"; +bind 'u' "list 'unmark'"; +bind 'Enter' "list 'mark';next"; +bind '-' "reduce"; +bind "Up" "pan_up"; +bind 'k' "pan_up"; +#bind 'C-k' "pan_up"; +bind "Right" "pan_right"; +bind 'l' "pan_right"; +bind "Down" "pan_down"; +bind 'j' "pan_down"; +bind "Left" "pan_left"; +bind 'h' "pan_left"; +bind ' ' "scrolldown"; +bind 't' "align 'top';"; +bind 'C-g' "system 'fbgrab fim.png'"; +bind 'C-r' "recording 'start';"; +bind 'Q' "recording 'stop'"; +bind 'D' "recording 'dump';"; +bind 'E' "recording 'execute';"; +bind 'C-e' "recording 'execute';"; +bind 'C-x' "recording 'execute';"; +bind '.' "recording 'repeat_last';"; +bind '`' "toggleLimitMarked;"; +alias "toggleVerbosity" "_display_console=1-_display_console;i:fresh=1;redisplay;" ""; +alias "toggleKeyVerbosity" "_verbose_keys=1-_verbose_keys;redisplay;" ""; +alias "toggleDesaturate" "_autodesaturate=1-_autodesaturate;redisplay;" ""; +alias "idempotent_cmd" "goto '+0p';"; +# +# autocommands are essential to Fim's automated behaviour +# examples: +#autocmd "PostInteractiveCommand" "fim.png" "echo '\\nmatched an interactive command on fim.png\\n';"; +#autocmd "PostDisplay" ".*png" "echo 'this is a png file';"; +#autocmd "PostDisplay" ".*jpg" "echo 'this is a jpg file';"; +#autocmd "PostDisplay" ".*gif" "echo 'this is a gif file';"; +#autocmd "PostDisplay" "" "echo '\\nthis is a file\\n'"; +#autocmd "PostGoto" "" "set_interactive_mode;"; +autocmd "PostGoto" "" "reload;"; +#autocmd "PostGoto" "" "load;"; +#autocmd "PostDisplay" "" "i:fresh=1" ; +#autocmd "PreWindow" "" ""; +autocmd "PostWindow" "" "display;"; +autocmd "PreRedisplay" "" "i:_will_display=1;"; +autocmd "PreRedisplay" "" "if(_scale_style!='' && i:fresh){i:fresh=0;scale _scale_style ;i:fresh=0;}"; +autocmd "PostRedisplay" "" "i:_will_display=0;"; +# Display device specific config +alias "aalib_fix_do" "{if(aascale==''){ascale='2.0';}else{ascale=aascale;} i:fresh=1;display;if(_TERM=~'screen'){echo 'screen+aalib?expect binding problems!'}}" "See aalib_fix."; +alias "aalib_fix" "if(_device_string=='aa'){aalib_fix_do;scale 'a';}" "When using the aalib (ASCII art) library we face a problem: glyph proportions are seldom square (as pixels are), and are tricky to detect; for this reason, we need to reshape the image with respect to the font ratio, but we have to make a guess in the scaling factor to compensate. If at runtime a better value is known for the terminal font height/with ratio, it may be fed in the 'aascale' variable for an accurate scaling."; +#alias "exif_fix" "i:_orientation=exif_orientation;exif_orientation='';i:mirrored=exif_mirrored;exif_mirrored='';i:flipped=exif_flipped;exif_flipped='';" ""; +#autocmd "PostReload" "" "aalib_fix;exif_fix;"; +#autocmd "PostLoad" "" "aalib_fix;exif_fix;"; +autocmd "PostReload" "" "aalib_fix;"; +autocmd "PostLoad" "" "aalib_fix;"; +bind "F11" "if(_device_string=='sdl' && !_fullscreen){_old_sw=_screen_width;_old_sh=_screen_height;display 'reinit' 'MW0:0';_fullscreen=1;}else if(_device_string=='sdl' && _old_sw*_old_sh*_fullscreen){display 'reinit' 'rwm'._old_sw.':'._old_sh;_fullscreen=0;}"; + +autocmd "PostReload" "" "i:fresh=1" ; +autocmd "PostScale" "" "if(0==i:_will_display){i:fresh=1;display;}" ; +#autocmd "PostScale" "" "{i:fresh=1;display;}" ; +autocmd "PostPan" "" "{i:fresh=1;display;}" ; +autocmd "PostReload" "" "if(i:fresh){redisplay;}"; +autocmd "PostInteractiveCommand" "" "if(i:fresh){display;i:fresh=0;}"; +autocmd "PostInteractiveCommand" "" "if(_want_prefetch){prefetch;}"; +autocmd "PostInteractiveCommand" "" "if(_display_console==0 && i:fresh){redisplay;i:fresh=0;}"; +autocmd "PostInteractiveCommand" "" "idempotent_cmd;"; # Bug workaround: without it console scroll is broken. + +alias "next10" "i=0;while(i<10){i=i+1;next;display;sleep '1';};" "goes forward 10 images"; +bind 'N' 'next10'; +bind 'P' 'prev10'; +bind 'C-n' "goto '+//'"; +bind 'C-p' "goto '-//'"; +bind 'C-b' "goto '-//'"; # Warning: C-b cannot be detected on many configurations. +bind 'W' "display 'resize';" "if supported, resizes the window to match the current image pixels size"; +bind 'C-w' "scale '100%';display 'resize';" "if supported, scales the image to 100% and resizes the window to match its size (if fits)"; +alias "endless_slideshow" "while(1){display;sleep '1';next;};" "performs an automated slideshow, endlessly"; +alias "bookview" "while(1){display;sleep '2';scrolldown;};" ""; +alias "comicview" "while(1){display;sleep '1';scrolldown;};" ""; +alias "read" "while(1){display;sleep '1';scrollforward;};" ""; +alias "slowread" "while(1){display;sleep '2';scrollforward;};" ""; +alias "fastread" "while(1){display;scrollforward;};" ""; +alias "pornview" "echo 'press any key repeatedly to terminate' ;endless_slideshow;" ""; +#bind "C-p" "pornview"; +#bind "C-b" "bookview"; +autocmd "PreExecutionCycle" "/fbps-" "_display_busy=0;_display_status=0;" ; +autocmd "PreExecutionCycle" "" "i:fresh=1;reload;"; +#autocmd "PreExecutionCycle" "" "redisplay;"; +autocmd "PreExecutionCycle" "/fbps-.*ps001.png" "i:fresh=1;redisplay;"; +#autocmd "PostInteractiveCommand" "" "i:fresh=0;"; +#autocmd "PostInteractiveCommand" "" "prefetch;"; +bind '*' "scale '100%'"; +bind 'w' "scale 'w'"; +bind '<' "rotate10_ccw;display;"; +bind '>' "rotate10;display;"; +bind '_' "_scale_style='';scale '100%';"; +bind ',' "_display_console=1;echo _last_system_output;"; +bind 'C-a' "if(_scale_style!='a'){_scale_style='a';scale 'a';}else{_scale_style='';scale '100%';}"; +#bind 'h' "scale 'h'"; +# +alias "pan_nw" "pan 'nw';" "pans the image to the upper left"; +alias "pan_ne" "pan 'ne';" "pans the image to the upper right"; +alias "pan_se" "pan 'se';" "pans the image to the lower left"; +alias "pan_sw" "pan 'sw';" "pans the image to the lower right"; +alias "pan_down" "pan 'down';" "pans the image down"; +alias "pan_up" "pan 'up';" "pans the image up"; +alias "pan_left" "pan 'left';" "pans the image left"; +alias "pan_right" "pan 'right';" "pans the image right"; +# +alias "diagonal_nw" "pan_nw;" "pans the image to the upper left"; +alias "diagonal_ne" "pan_ne;" "pans the image to the upper right"; +alias "diagonal_se" "pan_se;" "pans the image to the lower left"; +alias "diagonal_sw" "pan_sw;" "pans the image to the lower right"; +bind 'd' "diagonal_nw;"; +bind 'D' "diagonal_se;"; +bind 'x' "diagonal_ne;"; +bind 'X' "diagonal_sw;"; +alias "toggleDisplayStatus" "_display_status=1-_display_status;" ""; +alias "toggleDisplayBusy" "_display_busy=1-_display_busy;" ""; +alias "sort" "list 'sort'" "sorts the files list ordered"; +#toggleVerbosity; +#bind 'f' "next;display;"; +#bind 'b' "prev;display;"; +bind 'o' "sort"; +bind 'b' "prev;"; +bind 'B' "toggleDisplayBusy"; +alias "random_slideshow" "while(1){goto random;}" "performs a shuffled slideshow"; +alias "rotate90_ccw" "i:_orientation=i:_orientation+3;i:fresh=1;i:fresh=1;redisplay;" ""; +alias "rotate90_cw" "i:_orientation=i:_orientation+1;i:fresh=1;i:fresh=1;redisplay;" ""; +alias "rotate180" "i:_orientation=i:_orientation+2;i:fresh=1;i:fresh=1;redisplay;" ""; +alias "rotate90" "rotate90_cw;display;" ""; +alias "rotate270" "rotate90_ccw;display;" ""; +alias "rotate10" "rotate '10';display;" ""; +alias "rotate10_ccw" "rotate -10;display;" ""; + +# window related aliases and commands +alias "wu" "window 'up'" "selects the window upwards the current"; +alias "wd" "window 'down'" "selects the window under the current"; +alias "wl" "window 'left'" "selects the window at left of the current"; +alias "wr" "window 'right'" "selects the window at right of the current"; +#bind 'K' "wu"; +bind 'K' 'if(_display_console==0){echo i:_filename.": ".i:_comment;toggleVerbosity}else{toggleVerbosity;}'; +# Note : on many consoles C-j is by default equivalent to Enter.. so this may not work :) +#bind 'C-j' "wd"; +#bind 'J' "wd"; +#bind 'H' "wl"; +#bind 'L' "wr"; +#alias "split" "window 'split'" "split the current window horizontally"; +#alias "vsplit" "window 'vsplit'" "split the current window vertically"; +#alias "swap" "window 'swap'" "swap the enclosing window subwindows"; +#alias "ws " "window 'swap'" "see swap"; +#bind 'T' "split;redisplay;"; +##don't use C-s : it will be usually caught by the console driver, and fim won't get it! +##bind 'C-s' "split;"; +#bind 'V' "vsplit;redisplay;"; +#bind 'U' "swap;redisplay;"; +#alias 'venlarge' 'window "venlarge"' ""; +#alias 'henlarge' 'window "henlarge"' ""; +#alias 'wnormalize' 'window "normalize"' ""; +#alias 'wclose' 'window "close"' ""; +#alias 'wc' 'window "close"' "closes the current window"; +#bind 'C' "wc;redisplay;"; + +alias 'cache' 'echo _cache_status;' "displays cached images status"; +#bind 'c' 'cache;'; +bind 'c' 'align "center";'; +alias 'widen' 'i:ascale=i:ascale*"1.1";*1.0;' "widen the current image"; +alias 'narrow' 'i:ascale=i:ascale/"1.1";*1.0;' "narrow the current image"; +alias 'contract' 'narrow'; +bind 'y' "widen" "widens horizontally the image"; +bind 'Y' "narrow" "shrinks horizontally the image"; +#alias 'scu' 'scroll_console_up;' ""; +#alias 'scd' 'scroll_console_down;' ""; +#alias 'console_scroll_up' 'if(_console_offset<_console_lines){_console_offset=_console_offset+1;}'; +#alias 'console_scroll_down' 'if(_console_offset>0){_console_offset=_console_offset-1;}'; +alias 'console_scroll_up' 'if(_console_offset<_console_lines+console_scroll_n-_rows){_console_offset=_console_offset+console_scroll_n;}'; +alias 'console_scroll_down' 'if(allow_round_scroll || (_console_offset>=console_scroll_n)){_console_offset=_console_offset-console_scroll_n;}'; +alias 'console_scroll_reset' '{_console_offset=0;}'; +alias 'scu' 'console_scroll_up;' ""; +alias 'scd' 'console_scroll_down;' ""; +alias 'scz' 'console_scroll_reset;' ""; +alias 'center' 'align "center"'; +alias 'left' 'align "left"'; +alias 'right' 'align "right"'; +alias 'top' 'align "top"'; +alias 'bottom' 'align "bottom"'; +bind "PageUp" "if(_display_console==0){prev;}else{scu;}"; +bind "PageDown" "if(_display_console==0){next;}else{scd;}"; +bind "Home" "0;"; +bind "End" "$;"; +bind "^" "0;"; +bind "$" "$;"; +bind "Backspace" "prev;"; +bind "'" "goto _lastfileindex"; +_display_status=1; +_want_wm_caption_status="fim:%N@%p%%%L[%i/%l]"; +_info_fmt_str="%p%% %wx%h%L %i/%l%P %F %T %c"; +_display_status_fmt="%N%?EXIF_DateTimeOriginal?[%:EXIF_DateTimeOriginal:]?%?EXIF_ExposureTime?[%:EXIF_ExposureTime:]?%?EXIF_FNumber?[%:EXIF_FNumber:]?%?EXIF_ApertureValue?[%:EXIF_ApertureValue:]?%?EXIF_ISOSpeedRatings?[ISO%:EXIF_ISOSpeedRatings:]?:%k"; +#_display_status_fmt="%N:%k"; # +#_use_exiftool=0; +echo "WELCOME : to switch to the command line interface press ':' "; +# Some more examples: +#alias "plisten" 'popen "nc -l -p 9999 "' "executes fim commands coming from port 9999 on this computer"; +#alias "wlisten" "while(1){sleep;plisten;}" "listen to a pipe, endlessly"; +#alias "musicplay" "system 'mpc play'" ""; +#alias "musicpause" "system 'mpc pause'" ""; +#alias "rdjpgcom" 'system "rdjpgcom" i:_filename'; +# offsetscan usage : need a mechanism for popping all images before. +#alias "offsetscan" "while(i:width<1){list 'push' offimage;_open_offset=_open_offset+1;reload;}"; +#alias "offsetscan" "while(i:width<1){list 'push' '/home/dez/mostro.jpg';stdout _open_offset ;_open_offset=_open_offset+1;reload;}"; +#alias "webcam" "pread 'vgrabbj -d /dev/video0';"; +#alias "webcam_cycle" "while(1){webcam;reload;sleep 1;};"; +#This is a FIM initialization file. +#Without one of these FIM is nothing. +#So feel free to modify it, but with caution! diff --git a/src/grammar.h b/src/grammar.h new file mode 100644 index 0000000..a397bf1 --- /dev/null +++ b/src/grammar.h @@ -0,0 +1,81 @@ +const fim_char_t * FIM_DEFAULT_GRAMMAR_FILE_CONTENTS = +" program: %empty\n" +" | statement_list\n" +"\n" +" statement_list: statement\n" +" | statement ';' statement_list\n" +" | non_atomic_statements_block statement_list\n" +" | statements_block\n" +"\n" +" non_atomic_statements_block: '{' statement_list '}'\n" +" | INTEGER '{' statement_list '}'\n" +" | conditional_statement\n" +"\n" +" statements_block: atomic_statements_block\n" +" | non_atomic_statements_block\n" +"\n" +" conditional_statement: if_statement\n" +" | loop_statement\n" +"\n" +" if_statement: 'if' '(' expression ')' statements_block\n" +" | 'if' '(' expression ')' statements_block 'else' statements_block\n" +"\n" +" loop_statement: 'while' '(' expression ')' statements_block\n" +" | 'do' statements_block 'while' '(' expression ')'\n" +"\n" +" atomic_statements_block: statement ';'\n" +" | statement ';' ';'\n" +" | statement ';' ';' ';'\n" +"\n" +" statement: '!' arguments\n" +" | INTEGER IDENTIFIER\n" +" | SLASH_AND_REGEXP\n" +" | '+' UNQUOTED_FLOAT '%'\n" +" | '+' QUOTED_FLOAT '%'\n" +" | '+' INTEGER '%'\n" +" | '*' UNQUOTED_FLOAT\n" +" | '*' QUOTED_FLOAT\n" +" | '*' INTEGER\n" +" | UNQUOTED_FLOAT '%'\n" +" | QUOTED_FLOAT '%'\n" +" | INTEGER '%'\n" +" | '-' UNQUOTED_FLOAT '%'\n" +" | '-' QUOTED_FLOAT '%'\n" +" | '-' INTEGER '%'\n" +" | INTEGER\n" +" | '-' INTEGER\n" +" | IDENTIFIER\n" +" | IDENTIFIER FILE_PATH\n" +" | IDENTIFIER arguments\n" +" | INTEGER IDENTIFIER arguments\n" +" | IDENTIFIER '=' expression\n" +"\n" +" arguments: expression\n" +" | expression arguments\n" +"\n" +" expression: '(' expression ')'\n" +" | expression '.' expression\n" +" | '!' expression\n" +" | expression '%' expression\n" +" | expression '+' expression\n" +" | expression '-' expression\n" +" | expression '*' expression\n" +" | expression '/' expression\n" +" | expression '<' expression\n" +" | expression '>' expression\n" +" | expression '||' expression\n" +" | expression BOR expression\n" +" | expression '&&' expression\n" +" | expression BAND expression\n" +" | expression '>=' expression\n" +" | expression '<=' expression\n" +" | expression '!=' expression\n" +" | expression '==' expression\n" +" | expression '=~' expression\n" +" | '-' expression\n" +" | IDENTIFIER\n" +" | INTEGER\n" +" | QUOTED_FLOAT\n" +" | UNQUOTED_FLOAT\n" +" | STRING\n" +""; diff --git a/src/help-acm.cpp b/src/help-acm.cpp new file mode 100644 index 0000000..087805e --- /dev/null +++ b/src/help-acm.cpp @@ -0,0 +1,5 @@ +//#ifdef FIM_WANT_INLINE_HELP + +#define FIM_AUTOCOMMANDS_LIST \ +FIM_ACM_POSTSCALE", " FIM_ACM_PRESCALE", " FIM_ACM_PREPAN", " FIM_ACM_POSTPAN", " FIM_ACM_PREREDISPLAY", " FIM_ACM_POSTREDISPLAY", " FIM_ACM_PREDISPLAY", " FIM_ACM_POSTDISPLAY", " FIM_ACM_PREPREFETCH", " FIM_ACM_POSTPREFETCH", " FIM_ACM_POSTRELOAD", " FIM_ACM_PRERELOAD", " FIM_ACM_POSTLOAD", " FIM_ACM_PRELOAD", " FIM_ACM_POSTGOTO", " FIM_ACM_PREGOTO", " FIM_ACM_PRECONF", " FIM_ACM_POSTCONF", " FIM_ACM_PREHFIMRC", " FIM_ACM_POSTHFIMRC", " FIM_ACM_PREUFIMRC", " FIM_ACM_POSTUFIMRC", " FIM_ACM_PREGFIMRC", " FIM_ACM_POSTGFIMRC", " FIM_ACM_PREINTERACTIVECOMMAND", " FIM_ACM_POSTINTERACTIVECOMMAND", " FIM_ACM_PREEXECUTIONCYCLE", " FIM_ACM_PREEXECUTIONCYCLEARGS", " FIM_ACM_POSTEXECUTIONCYCLE", " FIM_ACM_PREWINDOW", " FIM_ACM_POSTWINDOW", " +//#endif diff --git a/src/help.cpp b/src/help.cpp new file mode 100644 index 0000000..d1ba07b --- /dev/null +++ b/src/help.cpp @@ -0,0 +1,112 @@ +#ifdef FIM_WANT_INLINE_HELP + +fim_var_help_db[FIM_VID_ARCHIVE_FILES]= "[in,g:] Regular expression matching filenames to be treated as (multipage) archives. If empty, \"" FIM_CNS_ARCHIVE_RE "\" will be used. Within each archive, only filenames matching the regular expression in the " FIM_VID_PUSHDIR_RE " variable will be considered for opening." ; +fim_var_help_db[FIM_VID_RANDOM]= "[out] a pseudorandom number" ; +fim_var_help_db[FIM_VID_BINARY_DISPLAY]= "[in,g:] will force loading of the specified files as pixelmaps (no image decoding will be performed); if 1, using one bit per pixel; if 24, using 24 bits per pixel; otherwise will load and decode the files as usual" ; +fim_var_help_db[FIM_VID_TEXT_DISPLAY]= "[in,g:] will force loading of the specified files as text files (no image decoding will be performed); if 1; otherwise will load and decode the files as usual" ; +fim_var_help_db[FIM_VID_CACHE_STATUS]= "[out,g:] string with current information on cache status" ; +fim_var_help_db[FIM_VID_DISPLAY_CONSOLE]= "[in,g:] if 1, will display the output console" ; +fim_var_help_db[FIM_VID_DEVICE_DRIVER]= "[out,g:] the current display device string" ; +fim_var_help_db[FIM_VID_DISPLAY_STATUS]= "[in,g:] if 1, will display the status bar" ; +fim_var_help_db[FIM_VID_DISPLAY_STATUS_FMT]= "[in,g:] custom info format string, displayed in the lower left corner of the status bar; if unset: full pathname; otherwise a custom format string specified just as _info_fmt_str." ; +fim_var_help_db[FIM_VID_PUSH_PUSHES_DIRS]= "[in,g:] if 1, the push command will also accept and push directories (using pushdir)" ; +fim_var_help_db[FIM_VID_SANITY_CHECK]= "[in,experimental,g:] if 1, will execute a sanity check on startup" ; +fim_var_help_db[FIM_VID_LAST_SYSTEM_OUTPUT]= "[out,experimental,g:] the standard output of the last call to the system command" ; +fim_var_help_db[FIM_VID_LOAD_DEFAULT_ETC_FIMRC]= "[in,g:] if 1 at startup, will load the system wide initialization file" ; +fim_var_help_db[FIM_VID_DEFAULT_ETC_FIMRC]= "[in,g:] string with the global configuration file name" ; +fim_var_help_db[FIM_VID_FILE_LOADER]= "[in,i:,g:] if not empty, this string will force a file loader (among the ones listed in the -V switch output); [out] i:" FIM_VID_FILE_LOADER " stores the loader of the current image" ; +fim_var_help_db[FIM_VID_RETRY_LOADER_PROBE]= "[in,g:] if 1 and user specified a file loader and this fails, will probe for a different loader" ; +fim_var_help_db[FIM_VID_NO_RC_FILE]= "[in,g:] if 1, the ~/.fimrc file will not be loaded at startup" ; +fim_var_help_db[FIM_VID_NO_EXTERNAL_LOADERS]= "[in,g:] if 1, no external loading programs will be tried for piping in an unsupported type image file" ; +fim_var_help_db[FIM_VID_SCRIPTOUT_FILE]= "[in,g:] the name of the file to write to when recording sessions" ; +fim_var_help_db[FIM_VID_PUSHDIR_RE]= "[in] regular expression to match against when pushing files from a directory or an archive. By default this is \"" FIM_CNS_PUSHDIR_RE "\"." ; +fim_var_help_db[FIM_VID_STATUS_LINE]= "[in,g:] if 1, will display the status bar" ; +fim_var_help_db[FIM_VID_WANT_PREFETCH]= "[in,g:] if 1, will prefetch further files just after display of the first file" ; +fim_var_help_db[FIM_VID_WANT_SLEEPS]= "[in,g:] number of seconds of sleep during slideshow mode" ; +fim_var_help_db[FIM_VID_WANT_EXIF_ORIENTATION]= "[in,g:] if 1, will reorient images using information from EXIF metadata (and stored in in " FIM_VID_EXIF_ORIENTATION ", " FIM_VID_EXIF_MIRRORED ", " FIM_VID_EXIF_FLIPPED" )." ; +fim_var_help_db[FIM_VID_EXIF_ORIENTATION]= "[out,i:] orientation information in the same format of " FIM_VID_ORIENTATION ", read from the orientation EXIF tags (i:EXIF_Orientation)." ; +fim_var_help_db[FIM_VID_EXIF_MIRRORED]= "[out,i:] mirroring information, read from the EXIF tags of a given image." ; +fim_var_help_db[FIM_VID_EXIF_FLIPPED]= "[out,i:] flipping information, read from the EXIF tags of a given image." ; +fim_var_help_db[FIM_VID_AUTOTOP]= "[in,g:] if 1, will align to the top freshly loaded images" ; +fim_var_help_db[FIM_VID_SCALE_STYLE]= "[in,g:] if non empty, this string will be fed to the scale command" ; +fim_var_help_db[FIM_VID_FILEINDEX]= "[out,g:] the current image numeric index" ; +fim_var_help_db[FIM_VID_LASTFILEINDEX]= "[out,g:] the last visited image numeric index. Useful for jumping back and forth easily between two images with 'goto _lastfileindex'." ; +fim_var_help_db[FIM_VID_FILELISTLEN]= "[out,g:] the length of the current image list" ; +fim_var_help_db[FIM_VID_INFO_FMT_STR]= "[in,g:] custom info format string, displayed in the lower right corner of the status bar; may contain ordinary text and special 'expando' sequences. These are: %p for current scale, in percentage; %w for width; %h for height; %i for image index in list; %k for the value of i:_comment (comment description) variable in square brackets; %l for image list length; %L for flip/mirror/orientation information; %P for page information; %F for file size; %M for screen image memory size; %m for memory used by mipmap; %C for memory used by cache; %T for total memory used (approximation); %R for total max memory used (as detected by getrusage()); %n for the current file path name; %N for the current file path name basename; ; %c for centering information; %v for the fim program/version identifier string; %% for an ordinary %. A sequence like %?VAR?EXP? expands to EXP if i:VAR is set; EXP will be copied verbatim except for contained sequences of the form %:VAR:, which will be expanded to the value of variable i:VAR; this is meant to be used like in e.g. '%?EXIF_DateTimeOriginal?[%:EXIF_DateTimeOriginal:]?', where the EXIF-set variable EXIF_DateTimeOriginal (make sure you have libexif for this) will be used only if present." ; +fim_var_help_db[FIM_VID_FILENAME]= "[out,i:] the current file name string" ; +fim_var_help_db[FIM_VID_FIM_DEFAULT_CONFIG_FILE_CONTENTS]= "[out,g:] the contents of the default (hardcoded) configuration file (executed after the minimal hardcoded config)" ; +fim_var_help_db[FIM_VID_FIM_DEFAULT_GRAMMAR_FILE_CONTENTS]= "[out,g:] the contents of the default (hardcoded) grammar file" ; +fim_var_help_db[FIM_VID_FRESH]= "[in,out,i:,experimental] 1 if the image was loaded, before all autocommands (autocmd) execution" ; +fim_var_help_db[FIM_VID_PAGE]= "[out,experimental,g:] the current page" ; +fim_var_help_db[FIM_VID_PAGES]= "[out,experimental,i:] the current number of pages of an image" ; +fim_var_help_db[FIM_VID_OVERRIDE_DISPLAY]= "[internal,g:] if 1, will inhibit display" ; +fim_var_help_db[FIM_VID_MAX_ITERATED_COMMANDS]= "[experimental,g:] the iteration limit for N in \"N[commandname]\" iterated command invocations" ; +fim_var_help_db[FIM_VID_WANT_CAPTION_STATUS]= "[in,g:] this works only if supported by the display device (currently only SDL). if set to a number that is not 0, will show the status (or command) line in the window manager caption; if set to a non-empty string, will interpret it just as a file info format string (see _info_fmt_str); if empty, will show the program version." ; +fim_var_help_db[FIM_VID_MAGNIFY_FACTOR]= "[in,g:] the image scale multiplier used when magnifying images size" ; +fim_var_help_db[FIM_VID_PWD]= "[out,g:] the current working directory; will be updated at startup and whenever the working directory changes" ; +fim_var_help_db[FIM_VID_REDUCE_FACTOR]= "[in,g:] the image scale multiplier used when reducing images size" ; +fim_var_help_db[FIM_VID_SCALE_FACTOR_MULTIPLIER]= "[in,g:] value used for scaling up/down the scaling factors" ; +fim_var_help_db[FIM_VID_SCALE_FACTOR_DELTA]= "[in,g:] value used for incrementing/decrementing the scaling factors" ; +fim_var_help_db[FIM_VID_COMMENT]= "[i:,out] the image comment, extracted from the image file (if any)" ; +fim_var_help_db[FIM_VID_COMMENT_OI]= "[experimental,in,g:] if _caption_over_image is set not to 0, will display the contents of i:_comment as a caption over the image; if larger than 1, with black background. " ; +fim_var_help_db[FIM_VID_EXIFTOOL_COMMENT]= "[out,g:] comment extracted via the exiftool interface; see _use_exiftool." ; +fim_var_help_db[FIM_VID_STEPS]= "[in,g:] the default steps, in pixels, when panning images" ; +fim_var_help_db[FIM_VID_VERSION]= "[out,g:] fim version number; may be used for keeping compatibility of fim scripts across evolving versions." ; +fim_var_help_db[FIM_VID_FBFONT]= "[out,g:] The current console font file string. If the internal hardcoded font has been used, then its value is \"" FIM_DEFAULT_HARDCODEDFONT_STRING "\"." ; +fim_var_help_db[FIM_VID_HSTEPS]= "[in,g:] the default steps, in pixels, when panning images horizontally (overrides steps)" ; +fim_var_help_db[FIM_VID_VSTEPS]= "[in,g:] the default steps, in pixels, when panning images vertically (overrides steps)" ; +fim_var_help_db[FIM_VID_CONSOLE_ROWS]= "[in,g:] if >0, will set the number of displayed text lines in the console" ; +fim_var_help_db[FIM_VID_CONSOLE_LINE_WIDTH]= "[in,g:] if>0, will force the output console text width" ; +fim_var_help_db[FIM_VID_CONSOLE_LINE_OFFSET]= "[in,out,g:] position of the text beginning in the output console, expressed in lines" ; +fim_var_help_db[FIM_VID_CONSOLE_BUFFER_LINES]= "[out,g:] the number of buffered output console text lines" ; +fim_var_help_db[FIM_VID_CONSOLE_BUFFER_TOTAL]= "[out,g:] amount of memory allocated for the output console buffer" ; +fim_var_help_db[FIM_VID_CONSOLE_BUFFER_FREE]= "[out,g:] amount of unused memory in the output console buffer" ; +fim_var_help_db[FIM_VID_CONSOLE_BUFFER_USED]= "[out,g:] amount of used memory in the output console buffer" ; +fim_var_help_db[FIM_VID_VERBOSE_KEYS]= "[in,g:] if 1, after each interactive mode key hit, the console will display the hit key raw keycode" ; +fim_var_help_db[FIM_VID_CMD_EXPANSION]= "[in,g:] if 1, will enable autocompletion (on execution) of alias and command strings" ; +fim_var_help_db[FIM_VID_VERBOSE_ERRORS]= "[in,g:] if 1, will display on stdout internal errors, while parsing commands" ; +fim_var_help_db[FIM_VID_VERBOSITY]= "[in,experimental,g:] program verbosity" ; +fim_var_help_db[FIM_VID_CONSOLE_KEY]= "[in,g:] the key binding (an integer variable) for spawning the command line; will have precedence over any other binding" ; +fim_var_help_db[FIM_VID_IGNORECASE]= "[in,g:] if 1, will allow for case insensitive regexp-based match in autocommands (autocmd); " ; +fim_var_help_db[FIM_VID_RE_SEARCH_OPTS]= "[in,g:] affects regexp-based searches; if an empty string, defaults will apply; if contains 'i' ('I'), case insensitive (sensitive) searches will occur; if contains 'b', will match on basename, if contains 'f' on full pathname. " ; +fim_var_help_db[FIM_VID_SAVE_FIM_HISTORY]= "[in,g:] if 1 on exit, will save the " FIM_CNS_HIST_COMPLETE_FILENAME " file on exit" ; +fim_var_help_db[FIM_VID_LOAD_FIM_HISTORY]= "[in,g:] if 1 on startup, will load the " FIM_CNS_HIST_COMPLETE_FILENAME " file on startup" ; +fim_var_help_db[FIM_VID_TERM]= "[out,g:] the environment TERM variable" ; +fim_var_help_db[FIM_VID_NO_DEFAULT_CONFIGURATION]= "[in,g:] if 0, a default, hardcoded configuration will be executed at startup, after the minimal hardcoded one. " ; +fim_var_help_db[FIM_VID_DISPLAY_STATUS_BAR]= "[in,g:] if 1, will display the status bar" ; +fim_var_help_db[FIM_VID_DISPLAY_BUSY]= "[in,g:] if 1, will display a message on the status bar when processing" ; +fim_var_help_db[FIM_VID_WANT_MIPMAPS]= "[in,g:] if >0, will use mipmaps to speed up downscaling of images (this has a memory overhead equivalent to one image copy); mipmaps will not be cached. " ; +fim_var_help_db[FIM_VID_EXIFTOOL]= "[in,g:] if >0 and supported, exiftool will be used to get additional information. if 1, this will be appened to _comment; if 2, will go to _exiftool_comment" ; +fim_var_help_db[FIM_VID_SCALE]= "[in,i:] the scale of the current image" ; +fim_var_help_db[FIM_VID_ASCALE]= "[in,out,i:] the asymmetric scaling of the current image" ; +fim_var_help_db[FIM_VID_ANGLE]= "[in,out,i:] a floating point number specifying the rotation angle, in degrees" ; +fim_var_help_db[FIM_VID_ORIENTATION]= "[internal,i:] Orthogonal clockwise rotation (orientation) is controlled by: 'i:_orientation', 'g:_orientation' and applied on a per-image basis. In particular, the values of the three variables are summed up and the sum is interpreted as the image orientation. If the sum is 0, no rotation will apply; if it is 1, a single ( 90') rotation will apply; if it is 2, a double (180') rotation will apply; if it is 3, a triple (270') rotation will apply. If the sum is not one of 0,1,2,3, the value of the sum modulo 4 is considered. Therefore, \":i:_orientation=1\" and \":i:_orientation=5\" are equivalent: they rotate the image one time by 90'." ; +fim_var_help_db[FIM_VID_WIDTH]= "[out,i:] the current image original width" ; +fim_var_help_db[FIM_VID_HEIGHT]= "[out,i:] the current image original height" ; +fim_var_help_db[FIM_VID_SWIDTH]= "[out,i:] the current image scaled width" ; +fim_var_help_db[FIM_VID_SHEIGHT]= "[out,i:] the current image scaled height" ; +fim_var_help_db[FIM_VID_AUTOFLIP]= "[in,g:] if 1, will flip images by default" ; +fim_var_help_db[FIM_VID_AUTONEGATE]= "[in,g:] if 1, will negate images by default" ; +fim_var_help_db[FIM_VID_AUTODESATURATE]= "[in,g:] if 1, will desaturate images by default" ; +fim_var_help_db[FIM_VID_LAST_FILE_LOADER]= "[out,g:] after each image load, " FIM_VID_LAST_FILE_LOADER " will be set to the last file loader used" ; +fim_var_help_db[FIM_VID_FLIPPED]= "[out,i:] 1, if the image is flipped" ; +fim_var_help_db[FIM_VID_NEGATED]= "[out,i:] 1, if the image is negated" ; +fim_var_help_db[FIM_VID_DESATURATED]= "[out,i:] 1, if the image is desaturated" ; +fim_var_help_db[FIM_VID_FIM_BPP]= "[out,g:] the bits per pixel count" ; +fim_var_help_db[FIM_VID_AUTOMIRROR]= "[in,g:] if 1, will mirror images by default" ; +fim_var_help_db[FIM_VID_MIRRORED]= "[out,i:] 1, if the image is mirrored " ; +fim_var_help_db[FIM_VID_WANT_AUTOCENTER]= "[in,g:] if 1, the image will be displayed centered " ; +fim_var_help_db[FIM_VID_MAX_CACHED_IMAGES]= "[in,experimental,g:] the maximum number of images after which evictions will be forced. Setting this to 0 (no limits) is ok provided _max_cached_memory is set meaningfully." ; +fim_var_help_db[FIM_VID_MAX_CACHED_MEMORY]= "[in,experimental,g:] the maximum amount of memory (in KiB) at which images will be continued being added to the cache. Setting this to 0 (no limit) will lead to a crash (there is no protection currently)." ; +fim_var_help_db[FIM_VID_CACHED_IMAGES]= "[out,g:] the number of images currently cached." ; +fim_var_help_db[FIM_VID_SCREEN_WIDTH]= "[out,g:] the screen width" ; +fim_var_help_db[FIM_VID_SCREEN_HEIGHT]= "[out] the screen height" ; +fim_var_help_db[FIM_VID_DBG_AUTOCMD_TRACE_STACK]= "[in,g:] dump to stdout autocommands (autocmd) stack trace during their execution (for debugging purposes)" ; +fim_var_help_db[FIM_VID_DBG_COMMANDS]= "[in,g:] print out each command before its execution (for debugging purposes)" ; +fim_var_help_db[FIM_VID_OPEN_OFFSET]= "[in,optional,g:,i:] offset (specified in bytes) used when opening a file; [out] i:" FIM_VID_OPEN_OFFSET " will be assigned to images opened at a nonzero offset " ; +fim_var_help_db[FIM_VID_OPEN_OFFSET_RETRY]= "[in,optional,g:] number of adjacent bytes to probe in opening the file " ; +fim_var_help_db[FIM_VID_SEEK_MAGIC]= "[optional,g:] will seek for a magic signature before opening a file (for now, use like this: fim -C '_seek_magic=MAGIC_STRING;push filename' ) " ; +fim_var_help_db[FIM_VID_PREFERRED_RENDERING_WIDTH]= "[in,optional,g:] if >0, bit based rendering will use this value for a default document width (instead of a default value) " ; +fim_var_help_db[FIM_VID_PREFERRED_RENDERING_DPI]= "[in,optional,g:] if >0, pdf, ps, djvu rendering will use this value for a default document dpi (instead of a default value) " ; +fim_var_help_db[FIM_VID_PRELOAD_CHECKS]= "[in,experimental,g:] if 1 (default), will check with stat() existence of input files before push'ing them (set this to 0 to speed up loading very long file lists; in these cases a trailing slash (/) will have to be used to tell fim a pathname is a directory). This only works after initialization (thus, after command line files have been push'ed); use --no-stat-push if you wish to set this to 0 at command line files specification " ; +#endif /* FIM_WANT_INLINE_HELP */ diff --git a/src/interpreter.cpp b/src/interpreter.cpp new file mode 100644 index 0000000..f13b8bc --- /dev/null +++ b/src/interpreter.cpp @@ -0,0 +1,484 @@ +/* $LastChangedDate: 2015-12-19 01:44:41 +0100 (Sat, 19 Dec 2015) $ */ +/* + interpreter.cpp : Fim language interpreter + + (c) 2007-2015 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include +#include +#include "lex.h" +#include "yacc.tab.hpp" +#include "fim.h" +#include "common.h" + +#if 0 +#define DBG(X) std::cout<type == typeOpr && p->opr.oper==FIM_SYM_STRING_CONCAT) + { + DBG(".:"<opr.nops;++i) + { + np=(p->opr.op[i]); + arg+=(string)(cvar(np).getString()); + } + return arg;//NEW 20080221 + } + else + if(p->type == typeOpr && p->opr.oper=='a' ) + { + DBG("a:"<opr.nops;++i) + { + //warning : only 1 should be allowed here.. + np=(p->opr.op[i]); + arg=cvar(np).getString(); + } + //return arg;//NEW 20080221 + } + else + if(p->type == stringCon ) + { + DBG("stringCon:"<scon.s); + return arg;//NEW 20080221 + } + else + if(p->type == vId ) + { + DBG("cvId:"<scon.s && 0==strcmp(p->scon.s,"random")) + { + arg=fim_rand();//FIXME + } + else +#endif + //arg=fim::cc.getStringVariable(p->scon.s); + return fim::cc.getVariable(p->scon.s); + } + else if(p->type == intCon ) + { + /* FIXME : int cast is due to some sick inner conversion */ + DBG("cvar:intCon:"<con.value<con.value)); + return Var((fim_int)(p->con.value)); + } + else if(p->type == floatCon) + { + DBG("cvar:floatCon:"<fid.f<fid.f)); + return p->fid.f; + } + else + { + DBG("nest:\n"); + return ex(p); + } + return arg; +} + +/* + * this function evaluates a whole chain of arg entries + */ +std::vector var(nodeType *p) +{ + nodeType *np=p; + std::vector args; + int i; + if(p->type == typeOpr && np->opr.oper=='a' ) + for(i=0;iopr.nops;++i) + { + DBG("'a'args:"<opr.nops<<":\n"); + np=(p->opr.op[i]); + if(np->type == stringCon ) + { + args.push_back(np->scon.s); + } + else + if(np->type == typeOpr && np->opr.oper=='a' ) + { + std::vector vargs=var(np); + for(size_t j=0;jtype == typeOpr && np->opr.oper==FIM_SYM_STRING_CONCAT) + for(i=0;iopr.nops;++i) + { + DBG("'i'args:"<opr.nops<<":\n"); + np=(p->opr.op[i]); + if(np->type == typeOpr && np->opr.oper==FIM_SYM_STRING_CONCAT) + { + std::vector vargs=var(np); + for(size_t j=0;j args; + int typeHint; + if (!p) + return (fim_int)0; + switch(p->type) + { + case intCon: + /* FIXME : are we sure this case executes ? */ + DBG("intCon:\n"); + //return Var((fim_int)p->con.value); + return (fim_int)p->con.value; + case floatCon: + DBG("ex:floatCon:"<fid.f<fid.f); + return p->fid.f; + case vId: + { + DBG("vId:\n"); + /* + * variable identifier encountered + * */ +#if 0 + if(0 && p->scon.s && 0==strcmp(p->scon.s,"random")) + return fim_rand();//FIXME + else +#endif + if(fim::cc.getVariableType(p->scon.s)==FIM_SYM_TYPE_INT) + { + DBG("vId:"<scon.s<<":"<<(int)fim::cc.getIntVariable(p->scon.s)<scon.s); + return fim::cc.getVariable(p->scon.s); + } + + if(fim::cc.getVariableType(p->scon.s)==FIM_SYM_TYPE_FLOAT) + { + DBG("'f':\n"); + //return (float)fim::cc.getFloatVariable(p->scon.s); + return fim::cc.getVariable(p->scon.s); + } + else + { + DBG("'s':\n"); + /* if(fim::cc.getVariableType(p->scon.s)=='s') */ + //return (fim::string)fim::cc.getStringVariable(p->scon.s); + return fim::cc.getVariable(p->scon.s); + } + } + case stringCon: + DBG("'stringCon':\n"); + // a single string token was encountered + return Var(p->scon.s); + case typeOpr: /* some operator */ + DBG("'typeOpr':\n"); + switch(p->opr.oper) + { + case FIM_SYM_STRING_CONCAT: + // we use the ',' operator + //return (ex(p->opr.op[0]) , ex(p->opr.op[1])); + //string collation (we assume these are strings !) + DBG(".:\n"); + return (ex(p->opr.op[0]) + ex(p->opr.op[1])); + case WHILE: + while(ex(p->opr.op[0]).getInt() && (fim::cc.catchLoopBreakingCommand(0)==0)) + { + ex(p->opr.op[1]); + } + return (fim_int)0; + case IF: + DBG("IF:"<<(ex(p->opr.op[0]).getInt())<opr.op[0]).getInt()) + ex(p->opr.op[1]); + else if (p->opr.nops > 2) + ex(p->opr.op[2]); + return (fim_int)0; + case FIM_SYM_SEMICOLON: + /* + * ; + * / \ + * cmd cmd + * */ + ex(p->opr.op[0]); + return ex(p->opr.op[1]); + case 'r': + DBG("r\n"); + //if( p->opr.nops ==2 && (p->opr.op[0])->type=='x') + if( p->opr.nops == 2 ) + { + int times=ex(p->opr.op[1]).getInt(); + if(times<0) + return (fim_int)-1; + for (int i=0;iopr.op[0]); + } + return (fim_int)0; + } + else + return (fim_int)-1; + case 'x': + DBG("X\n"); + /* + * when encountering an 'x' node, the first (left) subtree should + * contain the string with the identifier of the command to + * execute. + */ + { + if( p->opr.nops<1 ) + { + DBG("NO-OP\n"); + return (fim_int)-1; + } + if(p->opr.nops==2) //int yacc.ypp we specified only 2 ops per x node + { + nodeType *np=p; + //nodeType *dp; + np=(np->opr.op[1]); //the right subtree first node + while( np && np->opr.nops >=1 ) + if( np->opr.oper=='a' ) + { + std::vector na; + na=var(np); + for(fim_size_t i=0;iopr.nops<opr.op[0]; //we descend 1 step in the left subtree (under arg) + dp=dp->opr.op[0]; + if(np->opr.nops < 2) + { + np=FIM_NULL; + } + else + { + np=(np->opr.op[1]); + } + if( ((dp->opr.op[0])) && (dp->type)==stringCon)//|| (dp->type)==intCon) + { + //probably dead code + } + if( ((dp->opr.op[0])) && (dp->type)==typeOpr)//|| (dp->type)==intCon) + { + //probably dead code + } + else if( ((dp->opr.oper==FIM_SYM_STRING_CONCAT))) + { + //cout << "DEAD CODE\n"; + //probably dead code + } + else; + assert(dp); +#endif + } + else if( np->opr.oper==FIM_SYM_STRING_CONCAT ) + { + //cout << "DEAD CODE\n"; + //probably dead code + } + } + { + DBG("A.\n"); + /* + * single command execution + */ + fim::string result; + //std::cout <<"GULP:"<< p->opr.op[0]->scon.s<< args[0] <0) +// std::cout <<"GULP:"<< (int*)p->opr.op[0]->scon.s<<" "<opr.op[0]->scon.s<<" "<opr.op[0]) + if(p->opr.op[0]->scon.s) result = + fim::cc.execute(p->opr.op[0]->scon.s,args); + /* sometimes there are NULLs : BAD !! */ + return fim_atoi(result.c_str()); + } + } + case 'a': + // we shouldn't be here, because 'a' (argument) nodes are evaluated elsewhere + assert(0); + return (fim_int)-1; + case '=': + //assignment of a variable + s=p->opr.op[0]->scon.s; + DBG("SV:"<opr.op[0]->typeHint; + if(typeHint==FIM_SYM_TYPE_FLOAT) + { + DBG("SVf"<opr.op[1]->fid.f; + fim::cc.setVariable(s,fValue); + //return Var((fim_float_t)fValue); + return (fim_int)fValue; + }//FIM_SYM_TYPE_INT + else if(typeHint=='s') + { + DBG("SVs\n"); + if(p->opr.op[1]->type!=stringCon) + { + //this shouldn't happen + } + else + { + DBG("SVs:"<opr.op[0]->scon.s<opr.op[0]->scon.s); +#if 0 + if(0 && 0==strcmp(s,"random")) + return fim_rand();//FIXME + else +#endif + //return fim::cc.getIntVariable(s); + return fim::cc.getStringVariable(s); + } + return (fim_int)-1; + }//FIM_SYM_TYPE_INT + else if(typeHint==FIM_SYM_TYPE_INT) + { + iValue=ex(p->opr.op[1]).getInt(); + DBG("SVi:"<opr.op[1]); + Var v=cvar(p->opr.op[1]); + //iValue=r; + fim::cc.setVariable(s,v); + DBG("SET:"<opr.op[0]),v2=ex(p->opr.op[1]); if(v2.getInt())return v1%v2; else return v2;}; + case '/': {Var v1=ex(p->opr.op[0]),v2=ex(p->opr.op[1]); if(v2.getInt())return v1/v2; else return v2;}; +#else /* FIM_WANT_AVOID_FP_EXCEPTIONS */ + case '%': return ex(p->opr.op[0]) % ex(p->opr.op[1]); // FIXME: may generate an exception + case '/': return ex(p->opr.op[0]) / ex(p->opr.op[1]); // FIXME: may generate an exception +#endif /* FIM_WANT_AVOID_FP_EXCEPTIONS */ + case '+': return ex(p->opr.op[0]) + ex(p->opr.op[1]); + case '!': return (fim_int)(((ex(p->opr.op[0])).getInt())==0?1:0); + /* unary minus is still under definition */ + case UMINUS: + return Var((fim_int)0) - ex(p->opr.op[0]); + case '-': + DBG("SUB\n"); + if ( 2==p->opr.nops) {Var d= ex(p->opr.op[0]) - ex(p->opr.op[1]);return d;} + else return Var((fim_int)0) - ex(p->opr.op[0]); + case '*': return ex(p->opr.op[0]) * ex(p->opr.op[1]); + case '<': return ex(p->opr.op[0]) < ex(p->opr.op[1]); + case '>': return ex(p->opr.op[0]) > ex(p->opr.op[1]); + //comparison operators : evaluation to integer.. + case GE: return ex(p->opr.op[0]) >= ex(p->opr.op[1]); + case LE: return ex(p->opr.op[0]) <= ex(p->opr.op[1]); + case NE: return ex(p->opr.op[0]) != ex(p->opr.op[1]); + case EQ: {DBG("EQ\n");return ex(p->opr.op[0]) == ex(p->opr.op[1]);} + case REGEXP_MATCH: return ex(p->opr.op[0]).re_match(ex(p->opr.op[1])); + case AND:return ex(p->opr.op[0]) && ex(p->opr.op[1]); + case OR :return ex(p->opr.op[0]) || ex(p->opr.op[1]); + case BOR :return ex(p->opr.op[0]) | ex(p->opr.op[1]); + case BAND:return ex(p->opr.op[0]) & ex(p->opr.op[1]); + /* FIXME: NEED A DEFAULT CASE */ + } + case cmdId:/* FIXME : cmdId is dead */ + DBG("cmdId ?!\n"); + return Var((fim_int)0); + + } + return Var((fim_int)0); +} diff --git a/src/lex.h b/src/lex.h new file mode 100644 index 0000000..b6f1dda --- /dev/null +++ b/src/lex.h @@ -0,0 +1,63 @@ +/* $LastChangedDate: 2015-02-11 17:51:25 +0100 (Wed, 11 Feb 2015) $ */ +/* + lex.h : Lexer (lex) header file + + (c) 2007-2013 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +#ifndef FIM_LEX_H +#define FIM_LEX_H +#include "fim_types.h" + +typedef enum { intCon, floatCon, typeOpr, stringCon,cmdId/*cmdId is dead */,vId } nodeEnum; +/* constants */ +typedef struct { +fim_int value; /* value of constant */ +} conNodeType; +/* identifiers */ +typedef struct { +fim_char_t *s; /* subscript to sym array */ +} stringNodeType; +typedef struct { +float f; /* subscript to sym array */ +} fidNodeType; +/* operators */ +typedef struct { +int i; /* subscript to sym array */ +} idNodeType; +/* operators */ +typedef struct { +int oper; /* operator */ +int nops; /* number of operands */ +struct nodeTypeTag *op[1]; /* operands (expandable) */ +} oprNodeType; +typedef struct nodeTypeTag { +nodeEnum type; /* type of node */ +int typeHint; /* WARNING : THIS COULD BE HARMFUL, DUE TO C HACKS.. */ +/* union must be last entry in nodeType */ +/* because operNodeType may dynamically increase */ +union { +conNodeType con; /* constants */ +stringNodeType scon; /* string constant */ +fidNodeType fid; /* identifiers */ +idNodeType id; /* identifiers */ +oprNodeType opr; /* operators */ +}; +} nodeType; +extern int sym[26]; + +#endif /* FIM_LEX_H */ + diff --git a/src/lex.lex b/src/lex.lex new file mode 100644 index 0000000..e1761a9 --- /dev/null +++ b/src/lex.lex @@ -0,0 +1,241 @@ +/* $Id: lex.lex 1144 2017-03-10 20:51:43Z dezperado $ */ +/* + lex.lex : Lexer source file template + + (c) 2007-2017 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +%option noyywrap +%{ +#include +#include + +#include +#include /* 20110709 now calling flex --nounistd; this way we have to include it by ourselves; this is good because we overcome the C++ isatty redeclaration from within lex.yy.cc, which often does not match that of unistd.h regarding the thrown exceptions */ +#include "lex.h" +#include "yacc.tab.hpp" +#include "common.h" +#include "fim.h" /* fim_calloc, ... */ +void yyerror(const fim_char_t *); +#if 0 +/* we use %option noyywrap now ! */ +#ifdef YY_PROTO +//this branch is taken by flex 2.5.4 +//int yywrap YY_PROTO((void)){return 1;} +#else +//this branch is taken by flex 2.5.33 +int yywrap (){return 1;} +#endif +#endif + +int fim_pipedesc[2]; +/*#define YY_INPUT(buf,result,max_size) \ +{ \ + int r=read(fim_pipedesc[0],buf,1); \ + printf("letti in input : %d\n",r); \ + result = (buf[0]==EOF||r<1)?YY_NULL:1; \ + return; \ +}*/ + +#define YY_INPUT(buf,result,max_size) \ +{ \ + int r=read(fim_pipedesc[0],buf,1); \ + result = (buf[0]==EOF||r<1)?EOB_ACT_END_OF_FILE:EOB_ACT_CONTINUE_SCAN; \ + result = (buf[0]==EOF||r<1)?0:1; \ + if(result<=0) {close(fim_pipedesc[0]);close(fim_pipedesc[1]);} \ + if(r==0)number_to_move == YY_MORE_ADJ; \ +} + + +//allocate and strcpy +#define astrcpy(dst,src) \ +{ \ + if((src)==NULL)yyerror("null pointer given!\n"); \ + if(((dst)=(fim_char_t*)fim_calloc(1+strlen(src),1))==NULL) \ + yyerror("out of memory\n"); \ + strcpy((dst),(src)); \ +} + +//quoted allocate and strcpy +#define qastrcpy(dst,src) \ +{ \ + if((src)==NULL)yyerror("null pointer given!\n"); \ + (src+1)[strlen(src+1)-1]='\0'; \ + astrcpy(dst,src+1) \ +} + +//to lower +#define tl(src) \ +{ \ + if((src)==NULL)yyerror("null pointer given!\n"); \ + {fim_char_t*s=src;while(*s){*s=tolower(*s);++s;}} \ +} + + +%} + + +DIGIT [0-9] +NUMBER [0-9]+ +_ID [a-z][a-z0-9]* +UC [A-Z] +LC [a-z] +Q \' +DQ \" +C UC|LC +CD C|DIGIT +__ID [a-zA-Z]CD* +ID [a-z_A-Z][a-z_A-Z0-9]* +ARG [a-z_A-Z0-9]+ +HH [a-f]|[A-F]|[0-9] +__SYMBOL [%:;,.\-\\$|!/(){}_] +SYMBOL [-()<>=+*\/;{}.,`:$\\^%#] +EXCLMARK ! +STRINGC {SYMBOL}|{DIGIT}|{UC}|{LC}|[ _] +STRINGC_Q {STRINGC}|\" +STRINGC_DQ {STRINGC}|\' + + +%% +^"|" return SYSTEM; +"!" return NOT; +">=" return GE; +"<=" return LE; +"==" return EQ; +"=~" return REGEXP_MATCH; +"!=" return NE; +"&&" return AND; +"&" return BAND; +"||" return OR; +"|" return BOR; +"while" return WHILE; +"if" return IF; +"else" return ELSE; +"do" return DO; + +"i:*" { + astrcpy(yylval.sValue,yytext); + return IDENTIFIER; + } + +([gi]:)?{ID} { + /*was: ([gwibv]:)?{ID} */ + astrcpy(yylval.sValue,yytext); + //tl(yylval.sValue); + // tolower breaks aliases, but it would be useful on keywords, above.. + return IDENTIFIER; + } + +"0"[0-9]+ { + yylval.iValue = strtol(yytext,NULL,8); + return INTEGER; + } + +"0x"[0-9]+ { + yylval.iValue = strtol(yytext,NULL,16); + return INTEGER; + } + +[0-9]+ { + yylval.iValue = fim_atoi(yytext); + return INTEGER; + } + +"$" { + yylval.iValue = FIM_CNS_LAST; + return INTEGER; + } + +"^" { + yylval.iValue = FIM_CNS_FIRST; + return INTEGER; + } + +"'"{DIGIT}+"."{DIGIT}*"'" { + yylval.fValue = fim_atof(yytext+1); + return QUOTED_FLOAT; + } + +"\""{DIGIT}+"."{DIGIT}*"\"" { + yylval.fValue = fim_atof(yytext+1); + return QUOTED_FLOAT; + } + +\'((\\\')|[^\'])*\' { + //trec(yytext+1,"n\\\'","\n\\\'"); + /* single quoted strings are not escaped */ + qastrcpy(yylval.sValue,yytext);; + return STRING; + } + +\"((\\\")|[^\"])*\" { + /* double quoted strings unescaping */ + trec(yytext+1,"n\\\"","\n\\\""); + //trhex(yytext+1); // hex escaping already perfomed in trec. + qastrcpy(yylval.sValue,yytext);; + return STRING; + } + +"./"{STRINGC}* {/* FIXME : "/"{STRINGC} - like tokens clashed with lone / operator */ + /* FIM_SMART_COMPLETION patch */ + /* a path */ + astrcpy(yylval.sValue,yytext);; + return FILE_PATH; + } + +"../"{STRINGC}* { + /* FIM_SMART_COMPLETION patch */ + /* a path */ + astrcpy(yylval.sValue,yytext);; + return FILE_PATH; + } + +{ID}([.]{ID})+ { + /* FIM_SMART_COMPLETION patch */ + /* a path */ + astrcpy(yylval.sValue,yytext);; + return FILE_PATH; + } + + +{SYMBOL} { + return *yytext; + } + +^"/".+ { + astrcpy(yylval.sValue,yytext+1);; + return SLASH_AND_REGEXP; + } + +{DIGIT}+"."{DIGIT}* { + yylval.fValue = fim_atof(yytext+0); + return UNQUOTED_FLOAT; + } + +[ \t]+ { /* we ignore whitespace */ ; } + + +\n { /* return NEWLINE; */ /* this works ! in this case, it means that we ignore \n */ } + + +. printf("Unknown character :'%s'\n",yytext);yyerror("Unknown character"); + /*THERE SHOULD GO LEX ERRORS..*/ + +\#.*$ { /* ... a comment encountered... */ ; } + +%% + diff --git a/src/readline.cpp b/src/readline.cpp new file mode 100644 index 0000000..10c218b --- /dev/null +++ b/src/readline.cpp @@ -0,0 +1,477 @@ +/* $LastChangedDate: 2015-12-19 01:44:41 +0100 (Sat, 19 Dec 2015) $ */ +/* + readline.cpp : Code dealing with the GNU readline library. + + (c) 2008-2015 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "CommandConsole.h" +#include +#ifdef FIM_USE_READLINE +#include "readline.h" +#endif /* FIM_USE_READLINE */ +#ifdef FIM_USE_READLINE +#include "fim.h" + +#define min(x,y) ((x)<(y)?(x):(y)) +#define max(x,y) ((x)>(y)?(x):(y)) + +#define FIM_COMPLETE_ONLY_IF_QUOTED 1 +#define FIM_COMPLETE_INSERTING_DOUBLE_QUOTE 0 +#define FIM_WANT_RL_KEY_DUMPOUT 0 + +/* + * This file is severely messed up :). + * */ + +static int fim_rl_pc=FIM_SYM_CHAR_NUL; + +namespace fim +{ + extern CommandConsole cc; +fim_char_t * fim_readline(const fim_char_t *prompt) +{ + fim_char_t * rc=FIM_NULL; + fim_rl_pc=FIM_SYM_CHAR_NUL; + rc=readline(prompt); + fim_rl_pc=FIM_SYM_CHAR_NUL; + return rc; +} +} + +/* + * in fim.cpp + * */ +extern fim::string g_fim_output_device; + +/* Generator function for command completion. STATE lets us + * know whether to start from scratch; without any state + * (i.e. STATE == 0), then we start at the top of the list. */ +static fim_char_t * command_generator (const fim_char_t *text,int state) +{ +// static int list_index, len; +// fim_char_t *name; + /* If this is a new word to complete, initialize now. This + * includes saving the length of TEXT for efficiency, and + * initializing the index variable to 0. + */ + return cc.command_generator(text,state,0); + + +// if (!state) { list_index = 0; len = strlen (text); } + + /* Return the next name which partially matches from the + * command list. + */ + +// while (name = commands[list_index].name) +// { list_index++; if (strncmp (name, text, len) == 0) return (dupstr(name)); } + /* If no names matched, then return FIM_NULL. */ +// return ((fim_char_t *)FIM_NULL); +} + +static fim_char_t * varname_generator (const fim_char_t *text,int state) +{ + return cc.command_generator(text,state,4); +} + + +namespace rl +{ +#if FIM_WANT_READLINE_CLEAR_WITH_ESC + static int fim_want_rl_cl_with_esc; +#endif /* FIM_WANT_READLINE_CLEAR_WITH_ESC */ +/* + * Attempt to complete on the contents of TEXT. START and END + * bound the region of rl_line_buffer that contains the word to + * complete. TEXT is the word to complete. We can use the entire + * contents of rl_line_buffer in case we want to do some simple + * parsing. Return the array of matches, or FIM_NULL if there aren't any. + */ +static fim_char_t ** fim_completion (const fim_char_t *text, int start,int end) +{ + //FIX ME + fim_char_t **matches = (fim_char_t **)FIM_NULL; + + if(start==end && end<1) + { +#if 0 + fim_char_t **__s,*_s; + _s=dupstr(""); + if(! _s)return FIM_NULL; + __s=(fim_char_t**)fim_calloc(1,sizeof(fim_char_t*)); + if(!__s)return FIM_NULL;__s[0]=_s; + //we print all of the commands, with no completion, though. +#endif + cc.print_commands(); + rl_attempted_completion_over = 1; + /* this could be set only here :) */ + return FIM_NULL; + } + + /* If this word is at the start of the line, then it is a command + * to complete. Otherwise it is the name of a file in the current + * directory. + */ + if (start == 0) + { + //std::cout << "completion for word " << start << "\n"; + matches = rl_completion_matches (text, command_generator); + } + else + { + if(start>0 && !fim_isquote(rl_line_buffer[start-1]) ) + { +#if FIM_COMPLETE_INSERTING_DOUBLE_QUOTE + // FIXME: this is NEW + if(start==end && fim_isspace(rl_line_buffer[start-1])) + { + fim_char_t**sp=(fim_char_t**)malloc(2*sizeof(fim_char_t*)); + sp[0]=dupstr("\""); + sp[1]=FIM_NULL; + rl_completion_append_character = '\0'; + fim::cout << "you can type double quoted string (e.g.: \"" FIM_CNS_EXAMPLE_FILENAME "\"), or a variable name (e.g.:" FIM_VID_FILELISTLEN "). some variables need a prefix (one of " FIM_SYM_NAMESPACE_PREFIXES ")\n" ; + return sp; + } +#endif /* FIM_COMPLETE_INSERTING_DOUBLE_QUOTE */ + if(start1) + fim::cout << "possible completions for \""<0;++i) + { +#if FIM_SHOULD_SUGGEST_POSSIBLE_COMPLETIONS + fim::cout << matches[i] << "\n"; +#endif /* FIM_SHOULD_SUGGEST_POSSIBLE_COMPLETIONS */ + w=min(strlen(matches[i])+1,(size_t)f); + if(f>0){ + strncpy(buffer+l,matches[i],w); + w=strlen(buffer+l);l+=w;f-=w;} + if(f>0){strcpy(buffer+l," ");--f;++l;} + buffer[l]='\0'; +// strcpy(buffer+strlen(buffer),matches[i]); +// strcpy(buffer+strlen(buffer)," "); + } + +// std::cout << buffer << "\n" ; + // status((fim_byte_t*)"here shall be autocompletions", FIM_NULL); +} + +/* +static void redisplay_no_fb(void) +{ + printf("%s",rl_line_buffer); +} +*/ + +static void redisplay(void) +{ + cc.set_status_bar(( fim_char_t*)rl_line_buffer,FIM_NULL); +} + +/* + * ?! + * */ +/* +static int redisplay_hook_no_fb(void) +{ + redisplay_no_fb(); + return 0; +}*/ + +static int fim_post_rl_getc(int c) +{ +#if FIM_WANT_READLINE_CLEAR_WITH_ESC + if(c==FIM_SYM_ESC && fim_want_rl_cl_with_esc) + { + if(rl_line_buffer) + rl_point=0, + rl_line_buffer[0]=FIM_SYM_PROMPT_NUL; + + c=FIM_SYM_ENTER; +#if FIM_WANT_DOUBLE_ESC_TO_ENTER + if(fim_want_rl_cl_with_esc==-1) + fim_want_rl_cl_with_esc=0; +#endif /* FIM_WANT_DOUBLE_ESC_TO_ENTER */ + } +#endif /* FIM_WANT_READLINE_CLEAR_WITH_ESC */ + if(FIM_WANT_RL_KEY_DUMPOUT)cout << "got key: " << (int)(c) << " : " << (c==FIM_SYM_ESC)<<"\n"; + return c; +} + +#if defined(FIM_WITH_LIBSDL) || defined(FIM_WITH_AALIB) || defined(FIM_WITH_LIBIMLIB2) +static int fim_rl_sdl_aa_getc_hook(void) +{ + //unsigned int c; + fim_key_t c; + c=0; + + if(cc.get_displaydevice_input(&c,true)==1) + { + c=fim_post_rl_getc(c); + if(c&(1<<31)) + { + rl_set_keymap(rl_get_keymap_by_name("emacs-meta")); /* FIXME : this is a dirty trick : */ + //c&=!(1<<31); /* FIXME : a dirty trick */ + c&=0xFFFFFF^(1<<31); /* FIXME : a dirty trick */ + //std::cout << "alt! : "<< (fim_byte_t)c <<" !\n"; + //rl_stuff_char(c); /* warning : this may fail */ + rl_stuff_char(c); /* warning : this may fail */ + } + else + { + rl_set_keymap(rl_get_keymap_by_name("emacs")); /* FIXME : this is a dirty trick : */ + //std::cout << "char in : "<< (fim_byte_t)c <<" !\n"; + rl_stuff_char(c); /* warning : this may fail */ + } + return 1; + } + return 0; +} + +//void fim_rl_prep_dummy(int meta_flag){} +//void fim_rl_deprep_dummy(void){} + +int fim_rl_sdl_aa_getc(FILE * fd) +{ + return 0;/* yes, a dummy function instead of getc() */ +} +#endif /* defined(FIM_WITH_LIBSDL) || defined(FIM_WITH_AALIB) || defined(FIM_WITH_LIBIMLIB2) */ + +int fim_rl_getc(FILE * fd) +{ + int c=FIM_SYM_CHAR_NUL; +#if 1 + c=rl_getc(fd); +#if FIM_WANT_DOUBLE_ESC_TO_ENTER + if(c==FIM_SYM_ESC) + { + if(fim_rl_pc==c) + fim_want_rl_cl_with_esc=-1, + fim_rl_pc=c; + else + fim_rl_pc=c; + //c=FIM_SYM_CHAR_NUL; + } + else +#endif /* FIM_WANT_DOUBLE_ESC_TO_ENTER */ + fim_rl_pc=c; +#else + /* the following code is not complete yet. it needs interpretation of the input sequence */ + int cc=rl_getc(fd); + if(cc==FIM_SYM_ESC) + { + int tries=0; + fim_char_t cb[4]; + cb[0]=cb[1]=cb[2]=cb[3]=FIM_SYM_CHAR_NUL; + c|=cc; + cb[0]=cc; + if(FIM_WANT_RL_KEY_DUMPOUT)cout<<"adding: "<<((int)cc)<<"\n"; + for(tries=1;tries<3;++tries) + if((cc=rl_getc(fd))==FIM_SYM_ESC) + { + ungetc(cc,fd); + for(--tries;tries>1;--tries) ungetc(cb[tries],fd); + c=cb[0]; + goto read_ok; + } + else + { + if(cc==FIM_SYM_CHAR_NUL) + { + for(--tries;tries>1;--tries) ungetc(cb[tries],fd); + c=cb[0]; + goto read_ok; + } + if(FIM_WANT_RL_KEY_DUMPOUT)cout<<"adding: "<<((int)cc)<<"\n"; + c*=256; + c|=cc; + cb[tries]=cc; + c=*(int*)cb; + } + } + else + c=cc; +read_ok: +#endif + c=fim_post_rl_getc(c); + return c; +} + +int fim_search_rl_startup_hook(void) +{ + const fim_char_t * hs=cc.browser_.last_regexp_.c_str(); + if(hs) + { + rl_replace_line(hs,0); + rl_point=strlen(hs); + } + return 0; +} + +static int redisplay_hook(void) +{ + redisplay(); + return 0; +} + +/* + * ?! + * */ +/*static int fim_rl_end(int a,int b) +{ + rl_point=rl_end; + return 0; +}*/ + +/* + * ?! + * */ +/*static int fim_set_command_line_text(const fim_char_t*s) +{ + rl_replace_line(s,0); + return 0; +}*/ + + +/* + * initial setup to set the readline library working + */ +void initialize_readline (fim_bool_t with_no_display_device, fim_bool_t wcs) +{ + //FIX ME + /* Allow conditional parsing of the ~/.inputrc file. */ + rl_readline_name = "fim"; //?? + /* Tell the completer that we want a crack first. */ + rl_attempted_completion_function = fim_completion; + rl_completion_display_matches_hook=completion_display_matches_hook; + rl_erase_empty_line=1; // NEW: 20110630 in sdl mode with no echo disabling, prints newlines, if unset +#if FIM_WANT_READLINE_CLEAR_WITH_ESC + fim_want_rl_cl_with_esc=1; +#endif /* FIM_WANT_READLINE_CLEAR_WITH_ESC */ + +#define FIM_WANT_COOKIE_STREAM 1 /* FIXME: for now, this is just a dirty hack for the no-stdin case; in the future this shall be completed and replace the rl_stuff_char trick. */ +#if FIM_WANT_COOKIE_STREAM + if(wcs) + { + int isp[2]; + pipe(isp); + rl_instream = fdopen(isp[0],"r"); + rl_outstream = fopen("/dev/null","w"); /* FIXME: seems like rl_erase_empty_line is not always working :-( */ + } +#endif /* FIM_WANT_COOKIE_STREAM */ + if(with_no_display_device==0) + { + rl_catch_signals=0; + rl_catch_sigwinch=0; + rl_redisplay_function=redisplay; + rl_event_hook=redisplay_hook; + rl_pre_input_hook=redisplay_hook; + } +#if defined(FIM_WITH_LIBSDL) || defined(FIM_WITH_AALIB) || defined(FIM_WITH_LIBIMLIB2) + //if( g_fim_output_device==FIM_DDN_INN_SDL + if(g_fim_output_device.find(FIM_DDN_INN_SDL)==0 + /* uncommenting the following may give problems; but commenting it will break X11-backed aalib input .. */ + || g_fim_output_device==FIM_DDN_INN_AA + || g_fim_output_device==FIM_DDN_INN_IL2 + ) + { + rl_getc_function=fim_rl_sdl_aa_getc; + rl_event_hook =fim_rl_sdl_aa_getc_hook; +// rl_prep_term_function=fim_rl_prep_dummy; +// rl_deprep_term_function=fim_rl_deprep_dummy; + + /* + * FIXME : The following hack uses SDLK_UP, SDLK_DOWN, SDLK_LEFT, SDLK_RIGHT, all -0x100 .. + * (/usr/include/SDL/SDL_keysym.h) + * + * Regard this as a problem. + */ + rl_bind_keyseq("\x11", rl_get_previous_history); // up + rl_bind_keyseq("\x12", rl_get_next_history); // down + rl_bind_keyseq("\x13", rl_forward_char); // right + rl_bind_keyseq("\x14", rl_backward_char); // left + } + #endif + if( + g_fim_output_device.find(FIM_DDN_INN_FB)==0 || + g_fim_output_device.find(FIM_DDN_INN_AA)==0 || + 0 + ) +#if FIM_WANT_READLINE_CLEAR_WITH_ESC + if( + g_fim_output_device==FIM_DDN_INN_AA + || g_fim_output_device==FIM_DDN_INN_FB + ) + { + fim_want_rl_cl_with_esc=0; + rl_getc_function=fim_rl_getc; + } +#endif /* FIM_WANT_READLINE_CLEAR_WITH_ESC */ + //rl_completion_entry_function=FIM_NULL; + /* + * to do: + * see rl_filename_quoting_function .. + * */ + //rl_inhibit_completion=1; //if set, TABs are read as normal characters + rl_filename_quoting_desired=1; + rl_filename_quote_characters="\""; + //rl_reset_terminal("linux"); + //rl_reset_terminal("vt100"); + //rl_bind_key(0x09,fim_rl_end); + //rl_bind_key(0x7F,fim_rl_end); + //rl_bind_key(-1,fim_rl_end); + //rl_bind_key('~',fim_rl_end); // .. + //rl_bind_key('\t',rl_insert); + //rl_bind_keyseq("g",fim_rl_end); + //rl_set_prompt("$"); + +/* rl_voidfunc_t *rl_redisplay_function=redisplay; + rl_hook_func_t *rl_event_hook=redisplay_hook; + rl_hook_func_t *rl_pre_input_hook=redisplay_hook;*/ + //std::cout << "readline initialized\n"; +} + + +} + +#endif /* FIM_USE_READLINE */ diff --git a/src/readline.h b/src/readline.h new file mode 100644 index 0000000..6edc263 --- /dev/null +++ b/src/readline.h @@ -0,0 +1,41 @@ +/* $LastChangedDate: 2015-01-17 15:47:05 +0100 (Sat, 17 Jan 2015) $ */ +/* + readline.h : Code dealing with the GNU readline library. + + (c) 2008-2015 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +#ifndef FIM_READLINE_H +#define FIM_READLINE_H + +#include /* the GNU readline library */ +#include /* the GNU readline library */ +#include /* the GNU readline library */ +#include "fim_types.h" + +namespace fim +{ + fim_char_t* fim_readline(const fim_char_t *prompt); +} + +namespace rl +{ + void initialize_readline (fim_bool_t with_no_display_device, fim_bool_t wcs); + int fim_search_rl_startup_hook(void); +} + +#endif /* FIM_READLINE_H */ + diff --git a/src/regex.c b/src/regex.c new file mode 100644 index 0000000..ae20447 --- /dev/null +++ b/src/regex.c @@ -0,0 +1,5758 @@ +/* Extended regular expression matching and search library, + * version 0.12. + * (Implements POSIX draft P1003.2/D11.2, except for some of the + * internationalization features.) + * + * Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc. + * + * This file is part of the GNU C Library. Its master source is NOT part of + * the C library, however. The master source lives in /gd/gnu/lib. + * + * The GNU C Library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * The GNU C Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with the GNU C Library; see the file COPYING.LIB. If not, + * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +/* + * Modifications: + * + * Use _regex.h instead of regex.h. tlr, 1999-01-06 + * Make REGEX_MALLOC depend on HAVE_ALLOCA &c. + * tlr, 1999-02-14 + * Don't switch on regex debugging when debugging mutt. + * tlr, 1999-02-25 + */ + +/* The following doesn't mix too well with autoconfiguring + * the use of alloca. So let's disable it for AIX. + */ + +#if 0 + +/* AIX requires this to be the first thing in the file. */ +# if defined (_AIX) && !defined (REGEX_MALLOC) +# pragma alloca +# endif + +#endif + +#undef _GNU_SOURCE +#define _GNU_SOURCE + +#if HAVE_CONFIG_H +# include +#endif + +#undef DEBUG + +#if (defined(HAVE_ALLOCA_H) && !defined(_AIX)) +# include +#endif + +#if (!defined(HAVE_ALLOCA) || defined(_AIX)) +# define REGEX_MALLOC +#endif + +#if defined(STDC_HEADERS) && !defined(emacs) +#include +#else +/* We need this for `regex.h', and perhaps for the Emacs include files. */ +#include +#endif + +/* For platform which support the ISO C amendement 1 functionality we + support user defined character classes. */ +#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H) +# include +# include +#endif + +/* This is for other GNU distributions with internationalized messages. */ +#if HAVE_LIBINTL_H || defined (_LIBC) +# include +#else +# define gettext(msgid) (msgid) +#endif + +#ifndef gettext_noop +/* This define is so xgettext can find the internationalizable + strings. */ +#define gettext_noop(String) String +#endif + +/* The `emacs' switch turns on certain matching commands + that make sense only in Emacs. */ +#ifdef emacs + +#include "lisp.h" +#include "buffer.h" +#include "syntax.h" + +#else /* not emacs */ + +/* If we are not linking with Emacs proper, + we can't use the relocating allocator + even if config.h says that we can. */ +#undef REL_ALLOC + +#if defined (STDC_HEADERS) || defined (_LIBC) +#include +#else +char *malloc (); /* __MEM_CHECKED__ */ +char *realloc (); /* __MEM_CHECKED__ */ +#endif + +/* When used in Emacs's lib-src, we need to get bzero and bcopy somehow. + If nothing else has been done, use the method below. */ +#ifdef INHIBIT_STRING_HEADER +#if !(defined (HAVE_BZERO) && defined (HAVE_BCOPY)) +#if !defined (bzero) && !defined (bcopy) +#undef INHIBIT_STRING_HEADER +#endif +#endif +#endif + +/* This is the normal way of making sure we have a bcopy and a bzero. + This is used in most programs--a few other programs avoid this + by defining INHIBIT_STRING_HEADER. */ +#ifndef INHIBIT_STRING_HEADER +#if defined (HAVE_STRING_H) || defined (STDC_HEADERS) || defined (_LIBC) +#include +#ifndef bcmp +#define bcmp(s1, s2, n) memcmp ((s1), (s2), (n)) +#endif +#ifndef bcopy +#define bcopy(s, d, n) memcpy ((d), (s), (n)) +#endif +#ifndef bzero +#define bzero(s, n) memset ((s), 0, (n)) +#endif +#else +#include +#endif +#endif + +/* Define the syntax stuff for \<, \>, etc. */ + +/* This must be nonzero for the wordchar and notwordchar pattern + commands in re_match_2. */ +#ifndef Sword +#define Sword 1 +#endif + +#ifdef SWITCH_ENUM_BUG +#define SWITCH_ENUM_CAST(x) ((int)(x)) +#else +#define SWITCH_ENUM_CAST(x) (x) +#endif + +#ifdef SYNTAX_TABLE + +extern char *re_syntax_table; + +#else /* not SYNTAX_TABLE */ + +/* How many characters in the character set. */ +#define CHAR_SET_SIZE 256 + +static char re_syntax_table[CHAR_SET_SIZE]; + +static void +init_syntax_once () +{ + register int c; + static int done = 0; + + if (done) + return; + + bzero (re_syntax_table, sizeof re_syntax_table); + + for (c = 'a'; c <= 'z'; c++) + re_syntax_table[c] = Sword; + + for (c = 'A'; c <= 'Z'; c++) + re_syntax_table[c] = Sword; + + for (c = '0'; c <= '9'; c++) + re_syntax_table[c] = Sword; + + re_syntax_table['_'] = Sword; + + done = 1; +} + +#endif /* not SYNTAX_TABLE */ + +#define SYNTAX(c) re_syntax_table[c] + +#endif /* not emacs */ + +/* Get the interface, including the syntax bits. */ + +/* Changed to fit into mutt - tlr, 1999-01-06 */ + +#include "_regex.h" + +/* isalpha etc. are used for the character classes. */ +#include + +/* Jim Meyering writes: + + "... Some ctype macros are valid only for character codes that + isascii says are ASCII (SGI's IRIX-4.0.5 is one such system --when + using /bin/cc or gcc but without giving an ansi option). So, all + ctype uses should be through macros like ISPRINT... If + STDC_HEADERS is defined, then autoconf has verified that the ctype + macros don't need to be guarded with references to isascii. ... + Defining isascii to 1 should let any compiler worth its salt + eliminate the && through constant folding." */ + +#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII)) +#define ISASCII(c) 1 +#else +#define ISASCII(c) isascii(c) +#endif + +#ifdef isblank +#define ISBLANK(c) (ISASCII (c) && isblank (c)) +#else +#define ISBLANK(c) ((c) == ' ' || (c) == '\t') +#endif +#ifdef isgraph +#define ISGRAPH(c) (ISASCII (c) && isgraph (c)) +#else +#define ISGRAPH(c) (ISASCII (c) && isprint (c) && !isspace (c)) +#endif + +#define ISPRINT(c) (ISASCII (c) && isprint (c)) +#define ISDIGIT(c) (ISASCII (c) && isdigit (c)) +#define ISALNUM(c) (ISASCII (c) && isalnum (c)) +#define ISALPHA(c) (ISASCII (c) && isalpha (c)) +#define ISCNTRL(c) (ISASCII (c) && iscntrl (c)) +#define ISLOWER(c) (ISASCII (c) && islower (c)) +#define ISPUNCT(c) (ISASCII (c) && ispunct (c)) +#define ISSPACE(c) (ISASCII (c) && isspace (c)) +#define ISUPPER(c) (ISASCII (c) && isupper (c)) +#define ISXDIGIT(c) (ISASCII (c) && isxdigit (c)) + +#ifndef NULL +#define NULL (void *)0 +#endif + +/* We remove any previous definition of `SIGN_EXTEND_CHAR', + since ours (we hope) works properly with all combinations of + machines, compilers, `char' and `unsigned char' argument types. + (Per Bothner suggested the basic approach.) */ +#undef SIGN_EXTEND_CHAR +#if __STDC__ +#define SIGN_EXTEND_CHAR(c) ((signed char) (c)) +#else /* not __STDC__ */ +/* As in Harbison and Steele. */ +#define SIGN_EXTEND_CHAR(c) ((((unsigned char) (c)) ^ 128) - 128) +#endif + +/* Should we use malloc or alloca? If REGEX_MALLOC is not defined, we + use `alloca' instead of `malloc'. This is because using malloc in + re_search* or re_match* could cause memory leaks when C-g is used in + Emacs; also, malloc is slower and causes storage fragmentation. On + the other hand, malloc is more portable, and easier to debug. + + Because we sometimes use alloca, some routines have to be macros, + not functions -- `alloca'-allocated space disappears at the end of the + function it is called in. */ + +#ifdef REGEX_MALLOC + +#define REGEX_ALLOCATE malloc +#define REGEX_REALLOCATE(source, osize, nsize) realloc (source, nsize) +#define REGEX_FREE free + +#else /* not REGEX_MALLOC */ + +/* Emacs already defines alloca, sometimes. */ +#ifndef alloca + +/* Make alloca work the best possible way. */ +#ifdef __GNUC__ +#define alloca __builtin_alloca +#else /* not __GNUC__ */ +#if HAVE_ALLOCA_H +#include +#else /* not __GNUC__ or HAVE_ALLOCA_H */ +#if 0 /* It is a bad idea to declare alloca. We always cast the result. */ +#ifndef _AIX /* Already did AIX, up at the top. */ +char *alloca (); +#endif /* not _AIX */ +#endif +#endif /* not HAVE_ALLOCA_H */ +#endif /* not __GNUC__ */ + +#endif /* not alloca */ + +#define REGEX_ALLOCATE alloca + +/* Assumes a `char *destination' variable. */ +#define REGEX_REALLOCATE(source, osize, nsize) \ + (destination = (char *) alloca (nsize), \ + bcopy (source, destination, osize), \ + destination) + +/* No need to do anything to free, after alloca. */ +#define REGEX_FREE(arg) ((void)0) /* Do nothing! But inhibit gcc warning. */ + +#endif /* not REGEX_MALLOC */ + +/* Define how to allocate the failure stack. */ + +#if defined (REL_ALLOC) && defined (REGEX_MALLOC) + +#define REGEX_ALLOCATE_STACK(size) \ + r_alloc (&failure_stack_ptr, (size)) +#define REGEX_REALLOCATE_STACK(source, osize, nsize) \ + r_re_alloc (&failure_stack_ptr, (nsize)) +#define REGEX_FREE_STACK(ptr) \ + r_alloc_free (&failure_stack_ptr) + +#else /* not using relocating allocator */ + +#ifdef REGEX_MALLOC + +#define REGEX_ALLOCATE_STACK malloc +#define REGEX_REALLOCATE_STACK(source, osize, nsize) realloc (source, nsize) +#define REGEX_FREE_STACK free + +#else /* not REGEX_MALLOC */ + +#define REGEX_ALLOCATE_STACK alloca + +#define REGEX_REALLOCATE_STACK(source, osize, nsize) \ + REGEX_REALLOCATE (source, osize, nsize) +/* No need to explicitly free anything. */ +#define REGEX_FREE_STACK(arg) + +#endif /* not REGEX_MALLOC */ +#endif /* not using relocating allocator */ + + +/* True if `size1' is non-NULL and PTR is pointing anywhere inside + `string1' or just past its end. This works if PTR is NULL, which is + a good thing. */ +#define FIRST_STRING_P(ptr) \ + (size1 && string1 <= (ptr) && (ptr) <= string1 + size1) + +/* (Re)Allocate N items of type T using malloc, or fail. */ +#define TALLOC(n, t) ((t *) malloc ((n) * sizeof (t))) +#define RETALLOC(addr, n, t) ((addr) = (t *) realloc (addr, (n) * sizeof (t))) +#define RETALLOC_IF(addr, n, t) \ + if (addr) RETALLOC((addr), (n), t); else (addr) = TALLOC ((n), t) +#define REGEX_TALLOC(n, t) ((t *) REGEX_ALLOCATE ((n) * sizeof (t))) + +#define BYTEWIDTH 8 /* In bits. */ + +#define STREQ(s1, s2) ((strcmp (s1, s2) == 0)) + +#undef MAX +#undef MIN +#define MAX(a, b) ((a) > (b) ? (a) : (b)) +#define MIN(a, b) ((a) < (b) ? (a) : (b)) + +typedef char boolean; +#define false 0 +#define true 1 + +static int re_match_2_internal (); + +/* These are the command codes that appear in compiled regular + expressions. Some opcodes are followed by argument bytes. A + command code can specify any interpretation whatsoever for its + arguments. Zero bytes may appear in the compiled regular expression. */ + +typedef enum +{ + no_op = 0, + + /* Succeed right away--no more backtracking. */ + succeed, + + /* Followed by one byte giving n, then by n literal bytes. */ + exactn, + + /* Matches any (more or less) character. */ + anychar, + + /* Matches any one char belonging to specified set. First + following byte is number of bitmap bytes. Then come bytes + for a bitmap saying which chars are in. Bits in each byte + are ordered low-bit-first. A character is in the set if its + bit is 1. A character too large to have a bit in the map is + automatically not in the set. */ + charset, + + /* Same parameters as charset, but match any character that is + not one of those specified. */ + charset_not, + + /* Start remembering the text that is matched, for storing in a + register. Followed by one byte with the register number, in + the range 0 to one less than the pattern buffer's re_nsub + field. Then followed by one byte with the number of groups + inner to this one. (This last has to be part of the + start_memory only because we need it in the on_failure_jump + of re_match_2.) */ + start_memory, + + /* Stop remembering the text that is matched and store it in a + memory register. Followed by one byte with the register + number, in the range 0 to one less than `re_nsub' in the + pattern buffer, and one byte with the number of inner groups, + just like `start_memory'. (We need the number of inner + groups here because we don't have any easy way of finding the + corresponding start_memory when we're at a stop_memory.) */ + stop_memory, + + /* Match a duplicate of something remembered. Followed by one + byte containing the register number. */ + duplicate, + + /* Fail unless at beginning of line. */ + begline, + + /* Fail unless at end of line. */ + endline, + + /* Succeeds if at beginning of buffer (if emacs) or at beginning + of string to be matched (if not). */ + begbuf, + + /* Analogously, for end of buffer/string. */ + endbuf, + + /* Followed by two byte relative address to which to jump. */ + jump, + + /* Same as jump, but marks the end of an alternative. */ + jump_past_alt, + + /* Followed by two-byte relative address of place to resume at + in case of failure. */ + on_failure_jump, + + /* Like on_failure_jump, but pushes a placeholder instead of the + current string position when executed. */ + on_failure_keep_string_jump, + + /* Throw away latest failure point and then jump to following + two-byte relative address. */ + pop_failure_jump, + + /* Change to pop_failure_jump if know won't have to backtrack to + match; otherwise change to jump. This is used to jump + back to the beginning of a repeat. If what follows this jump + clearly won't match what the repeat does, such that we can be + sure that there is no use backtracking out of repetitions + already matched, then we change it to a pop_failure_jump. + Followed by two-byte address. */ + maybe_pop_jump, + + /* Jump to following two-byte address, and push a dummy failure + point. This failure point will be thrown away if an attempt + is made to use it for a failure. A `+' construct makes this + before the first repeat. Also used as an intermediary kind + of jump when compiling an alternative. */ + dummy_failure_jump, + + /* Push a dummy failure point and continue. Used at the end of + alternatives. */ + push_dummy_failure, + + /* Followed by two-byte relative address and two-byte number n. + After matching N times, jump to the address upon failure. */ + succeed_n, + + /* Followed by two-byte relative address, and two-byte number n. + Jump to the address N times, then fail. */ + jump_n, + + /* Set the following two-byte relative address to the + subsequent two-byte number. The address *includes* the two + bytes of number. */ + set_number_at, + + wordchar, /* Matches any word-constituent character. */ + notwordchar, /* Matches any char that is not a word-constituent. */ + + wordbeg, /* Succeeds if at word beginning. */ + wordend, /* Succeeds if at word end. */ + + wordbound, /* Succeeds if at a word boundary. */ + notwordbound /* Succeeds if not at a word boundary. */ + +#ifdef emacs + ,before_dot, /* Succeeds if before point. */ + at_dot, /* Succeeds if at point. */ + after_dot, /* Succeeds if after point. */ + + /* Matches any character whose syntax is specified. Followed by + a byte which contains a syntax code, e.g., Sword. */ + syntaxspec, + + /* Matches any character whose syntax is not that specified. */ + notsyntaxspec +#endif /* emacs */ +} re_opcode_t; + +/* Common operations on the compiled pattern. */ + +/* Store NUMBER in two contiguous bytes starting at DESTINATION. */ + +#define STORE_NUMBER(destination, number) \ + do { \ + (destination)[0] = (number) & 0377; \ + (destination)[1] = (number) >> 8; \ + } while (0) + +/* Same as STORE_NUMBER, except increment DESTINATION to + the byte after where the number is stored. Therefore, DESTINATION + must be an lvalue. */ + +#define STORE_NUMBER_AND_INCR(destination, number) \ + do { \ + STORE_NUMBER (destination, number); \ + (destination) += 2; \ + } while (0) + +/* Put into DESTINATION a number stored in two contiguous bytes starting + at SOURCE. */ + +#define EXTRACT_NUMBER(destination, source) \ + do { \ + (destination) = *(source) & 0377; \ + (destination) += SIGN_EXTEND_CHAR (*((source) + 1)) << 8; \ + } while (0) + +#ifdef DEBUG +static void extract_number _RE_ARGS ((int *dest, unsigned char *source)); +static void +extract_number (dest, source) + int *dest; + unsigned char *source; +{ + int temp = SIGN_EXTEND_CHAR (*(source + 1)); + *dest = *source & 0377; + *dest += temp << 8; +} + +#ifndef EXTRACT_MACROS /* To debug the macros. */ +#undef EXTRACT_NUMBER +#define EXTRACT_NUMBER(dest, src) extract_number (&dest, src) +#endif /* not EXTRACT_MACROS */ + +#endif /* DEBUG */ + +/* Same as EXTRACT_NUMBER, except increment SOURCE to after the number. + SOURCE must be an lvalue. */ + +#define EXTRACT_NUMBER_AND_INCR(destination, source) \ + do { \ + EXTRACT_NUMBER (destination, source); \ + (source) += 2; \ + } while (0) + +#ifdef DEBUG +static void extract_number_and_incr _RE_ARGS ((int *destination, + unsigned char **source)); +static void +extract_number_and_incr (destination, source) + int *destination; + unsigned char **source; +{ + extract_number (destination, *source); + *source += 2; +} + +#ifndef EXTRACT_MACROS +#undef EXTRACT_NUMBER_AND_INCR +#define EXTRACT_NUMBER_AND_INCR(dest, src) \ + extract_number_and_incr (&dest, &src) +#endif /* not EXTRACT_MACROS */ + +#endif /* DEBUG */ + +/* If DEBUG is defined, Regex prints many voluminous messages about what + it is doing (if the variable `debug' is nonzero). If linked with the + main program in `iregex.c', you can enter patterns and strings + interactively. And if linked with the main program in `main.c' and + the other test files, you can run the already-written tests. */ + +#ifdef DEBUG + +/* We use standard I/O for debugging. */ +#include + +/* It is useful to test things that ``must'' be true when debugging. */ +#include + +static int debug = 0; + +#define DEBUG_STATEMENT(e) e +#define DEBUG_PRINT1(x) if (debug) printf (x) +#define DEBUG_PRINT2(x1, x2) if (debug) printf (x1, x2) +#define DEBUG_PRINT3(x1, x2, x3) if (debug) printf (x1, x2, x3) +#define DEBUG_PRINT4(x1, x2, x3, x4) if (debug) printf (x1, x2, x3, x4) +#define DEBUG_PRINT_COMPILED_PATTERN(p, s, e) \ + if (debug) print_partial_compiled_pattern (s, e) +#define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2) \ + if (debug) print_double_string (w, s1, sz1, s2, sz2) + + +/* Print the fastmap in human-readable form. */ + +void +print_fastmap (fastmap) + char *fastmap; +{ + unsigned was_a_range = 0; + unsigned i = 0; + + while (i < (1 << BYTEWIDTH)) + { + if (fastmap[i++]) + { + was_a_range = 0; + putchar (i - 1); + while (i < (1 << BYTEWIDTH) && fastmap[i]) + { + was_a_range = 1; + i++; + } + if (was_a_range) + { + printf ("-"); + putchar (i - 1); + } + } + } + putchar ('\n'); +} + + +/* Print a compiled pattern string in human-readable form, starting at + the START pointer into it and ending just before the pointer END. */ + +void +print_partial_compiled_pattern (start, end) + unsigned char *start; + unsigned char *end; +{ + int mcnt, mcnt2; + unsigned char *p1; + unsigned char *p = start; + unsigned char *pend = end; + + if (start == NULL) + { + printf ("(null)\n"); + return; + } + + /* Loop over pattern commands. */ + while (p < pend) + { + printf ("%d:\t", p - start); + + switch ((re_opcode_t) *p++) + { + case no_op: + printf ("/no_op"); + break; + + case exactn: + mcnt = *p++; + printf ("/exactn/%d", mcnt); + do + { + putchar ('/'); + putchar (*p++); + } + while (--mcnt); + break; + + case start_memory: + mcnt = *p++; + printf ("/start_memory/%d/%d", mcnt, *p++); + break; + + case stop_memory: + mcnt = *p++; + printf ("/stop_memory/%d/%d", mcnt, *p++); + break; + + case duplicate: + printf ("/duplicate/%d", *p++); + break; + + case anychar: + printf ("/anychar"); + break; + + case charset: + case charset_not: + { + register int c, last = -100; + register int in_range = 0; + + printf ("/charset [%s", + (re_opcode_t) *(p - 1) == charset_not ? "^" : ""); + + assert (p + *p < pend); + + for (c = 0; c < 256; c++) + if (c / 8 < *p + && (p[1 + (c/8)] & (1 << (c % 8)))) + { + /* Are we starting a range? */ + if (last + 1 == c && ! in_range) + { + putchar ('-'); + in_range = 1; + } + /* Have we broken a range? */ + else if (last + 1 != c && in_range) + { + putchar (last); + in_range = 0; + } + + if (! in_range) + putchar (c); + + last = c; + } + + if (in_range) + putchar (last); + + putchar (']'); + + p += 1 + *p; + } + break; + + case begline: + printf ("/begline"); + break; + + case endline: + printf ("/endline"); + break; + + case on_failure_jump: + extract_number_and_incr (&mcnt, &p); + printf ("/on_failure_jump to %d", p + mcnt - start); + break; + + case on_failure_keep_string_jump: + extract_number_and_incr (&mcnt, &p); + printf ("/on_failure_keep_string_jump to %d", p + mcnt - start); + break; + + case dummy_failure_jump: + extract_number_and_incr (&mcnt, &p); + printf ("/dummy_failure_jump to %d", p + mcnt - start); + break; + + case push_dummy_failure: + printf ("/push_dummy_failure"); + break; + + case maybe_pop_jump: + extract_number_and_incr (&mcnt, &p); + printf ("/maybe_pop_jump to %d", p + mcnt - start); + break; + + case pop_failure_jump: + extract_number_and_incr (&mcnt, &p); + printf ("/pop_failure_jump to %d", p + mcnt - start); + break; + + case jump_past_alt: + extract_number_and_incr (&mcnt, &p); + printf ("/jump_past_alt to %d", p + mcnt - start); + break; + + case jump: + extract_number_and_incr (&mcnt, &p); + printf ("/jump to %d", p + mcnt - start); + break; + + case succeed_n: + extract_number_and_incr (&mcnt, &p); + p1 = p + mcnt; + extract_number_and_incr (&mcnt2, &p); + printf ("/succeed_n to %d, %d times", p1 - start, mcnt2); + break; + + case jump_n: + extract_number_and_incr (&mcnt, &p); + p1 = p + mcnt; + extract_number_and_incr (&mcnt2, &p); + printf ("/jump_n to %d, %d times", p1 - start, mcnt2); + break; + + case set_number_at: + extract_number_and_incr (&mcnt, &p); + p1 = p + mcnt; + extract_number_and_incr (&mcnt2, &p); + printf ("/set_number_at location %d to %d", p1 - start, mcnt2); + break; + + case wordbound: + printf ("/wordbound"); + break; + + case notwordbound: + printf ("/notwordbound"); + break; + + case wordbeg: + printf ("/wordbeg"); + break; + + case wordend: + printf ("/wordend"); + +#ifdef emacs + case before_dot: + printf ("/before_dot"); + break; + + case at_dot: + printf ("/at_dot"); + break; + + case after_dot: + printf ("/after_dot"); + break; + + case syntaxspec: + printf ("/syntaxspec"); + mcnt = *p++; + printf ("/%d", mcnt); + break; + + case notsyntaxspec: + printf ("/notsyntaxspec"); + mcnt = *p++; + printf ("/%d", mcnt); + break; +#endif /* emacs */ + + case wordchar: + printf ("/wordchar"); + break; + + case notwordchar: + printf ("/notwordchar"); + break; + + case begbuf: + printf ("/begbuf"); + break; + + case endbuf: + printf ("/endbuf"); + break; + + default: + printf ("?%d", *(p-1)); + } + + putchar ('\n'); + } + + printf ("%d:\tend of pattern.\n", p - start); +} + + +void +print_compiled_pattern (bufp) + struct re_pattern_buffer *bufp; +{ + unsigned char *buffer = bufp->buffer; + + print_partial_compiled_pattern (buffer, buffer + bufp->used); + printf ("%ld bytes used/%ld bytes allocated.\n", + bufp->used, bufp->allocated); + + if (bufp->fastmap_accurate && bufp->fastmap) + { + printf ("fastmap: "); + print_fastmap (bufp->fastmap); + } + + printf ("re_nsub: %d\t", bufp->re_nsub); + printf ("regs_alloc: %d\t", bufp->regs_allocated); + printf ("can_be_null: %d\t", bufp->can_be_null); + printf ("newline_anchor: %d\n", bufp->newline_anchor); + printf ("no_sub: %d\t", bufp->no_sub); + printf ("not_bol: %d\t", bufp->not_bol); + printf ("not_eol: %d\t", bufp->not_eol); + printf ("syntax: %lx\n", bufp->syntax); + /* Perhaps we should print the translate table? */ +} + + +void +print_double_string (where, string1, size1, string2, size2) + const char *where; + const char *string1; + const char *string2; + int size1; + int size2; +{ + int this_char; + + if (where == NULL) + printf ("(null)"); + else + { + if (FIRST_STRING_P (where)) + { + for (this_char = where - string1; this_char < size1; this_char++) + putchar (string1[this_char]); + + where = string2; + } + + for (this_char = where - string2; this_char < size2; this_char++) + putchar (string2[this_char]); + } +} + +void +printchar (c) + int c; +{ + putc (c, stderr); +} + +#else /* not DEBUG */ + +#undef assert +#define assert(e) + +#define DEBUG_STATEMENT(e) +#define DEBUG_PRINT1(x) +#define DEBUG_PRINT2(x1, x2) +#define DEBUG_PRINT3(x1, x2, x3) +#define DEBUG_PRINT4(x1, x2, x3, x4) +#define DEBUG_PRINT_COMPILED_PATTERN(p, s, e) +#define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2) + +#endif /* not DEBUG */ + +/* Set by `re_set_syntax' to the current regexp syntax to recognize. Can + also be assigned to arbitrarily: each pattern buffer stores its own + syntax, so it can be changed between regex compilations. */ +/* This has no initializer because initialized variables in Emacs + become read-only after dumping. */ +reg_syntax_t re_syntax_options; + + +/* Specify the precise syntax of regexps for compilation. This provides + for compatibility for various utilities which historically have + different, incompatible syntaxes. + + The argument SYNTAX is a bit mask comprised of the various bits + defined in regex.h. We return the old syntax. */ + +reg_syntax_t +re_set_syntax (syntax) + reg_syntax_t syntax; +{ + reg_syntax_t ret = re_syntax_options; + + re_syntax_options = syntax; +#ifdef DEBUG + if (syntax & RE_DEBUG) + debug = 1; + else if (debug) /* was on but now is not */ + debug = 0; +#endif /* DEBUG */ + return ret; +} + +/* This table gives an error message for each of the error codes listed + in regex.h. Obviously the order here has to be same as there. + POSIX doesn't require that we do anything for REG_NOERROR, + but why not be nice? */ + +static const char *re_error_msgid[] = + { + gettext_noop ("Success"), /* REG_NOERROR */ + gettext_noop ("No match"), /* REG_NOMATCH */ + gettext_noop ("Invalid regular expression"), /* REG_BADPAT */ + gettext_noop ("Invalid collation character"), /* REG_ECOLLATE */ + gettext_noop ("Invalid character class name"), /* REG_ECTYPE */ + gettext_noop ("Trailing backslash"), /* REG_EESCAPE */ + gettext_noop ("Invalid back reference"), /* REG_ESUBREG */ + gettext_noop ("Unmatched [ or [^"), /* REG_EBRACK */ + gettext_noop ("Unmatched ( or \\("), /* REG_EPAREN */ + gettext_noop ("Unmatched \\{"), /* REG_EBRACE */ + gettext_noop ("Invalid content of \\{\\}"), /* REG_BADBR */ + gettext_noop ("Invalid range end"), /* REG_ERANGE */ + gettext_noop ("Memory exhausted"), /* REG_ESPACE */ + gettext_noop ("Invalid preceding regular expression"), /* REG_BADRPT */ + gettext_noop ("Premature end of regular expression"), /* REG_EEND */ + gettext_noop ("Regular expression too big"), /* REG_ESIZE */ + gettext_noop ("Unmatched ) or \\)"), /* REG_ERPAREN */ + }; + +/* Avoiding alloca during matching, to placate r_alloc. */ + +/* Define MATCH_MAY_ALLOCATE unless we need to make sure that the + searching and matching functions should not call alloca. On some + systems, alloca is implemented in terms of malloc, and if we're + using the relocating allocator routines, then malloc could cause a + relocation, which might (if the strings being searched are in the + ralloc heap) shift the data out from underneath the regexp + routines. + + Here's another reason to avoid allocation: Emacs + processes input from X in a signal handler; processing X input may + call malloc; if input arrives while a matching routine is calling + malloc, then we're scrod. But Emacs can't just block input while + calling matching routines; then we don't notice interrupts when + they come in. So, Emacs blocks input around all regexp calls + except the matching calls, which it leaves unprotected, in the + faith that they will not malloc. */ + +/* Normally, this is fine. */ +#define MATCH_MAY_ALLOCATE + +/* When using GNU C, we are not REALLY using the C alloca, no matter + what config.h may say. So don't take precautions for it. */ +#ifdef __GNUC__ +#undef C_ALLOCA +#endif + +/* The match routines may not allocate if (1) they would do it with malloc + and (2) it's not safe for them to use malloc. + Note that if REL_ALLOC is defined, matching would not use malloc for the + failure stack, but we would still use it for the register vectors; + so REL_ALLOC should not affect this. */ +#if (defined (C_ALLOCA) || defined (REGEX_MALLOC)) && defined (emacs) +#undef MATCH_MAY_ALLOCATE +#endif + + +/* Failure stack declarations and macros; both re_compile_fastmap and + re_match_2 use a failure stack. These have to be macros because of + REGEX_ALLOCATE_STACK. */ + + +/* Number of failure points for which to initially allocate space + when matching. If this number is exceeded, we allocate more + space, so it is not a hard limit. */ +#ifndef INIT_FAILURE_ALLOC +#define INIT_FAILURE_ALLOC 5 +#endif + +/* Roughly the maximum number of failure points on the stack. Would be + exactly that if always used MAX_FAILURE_ITEMS items each time we failed. + This is a variable only so users of regex can assign to it; we never + change it ourselves. */ + +#ifdef INT_IS_16BIT + +#if defined (MATCH_MAY_ALLOCATE) +/* 4400 was enough to cause a crash on Alpha OSF/1, + whose default stack limit is 2mb. */ +long int re_max_failures = 4000; +#else +long int re_max_failures = 2000; +#endif + +union fail_stack_elt +{ + unsigned char *pointer; + long int integer; +}; + +typedef union fail_stack_elt fail_stack_elt_t; + +typedef struct +{ + fail_stack_elt_t *stack; + unsigned long int size; + unsigned long int avail; /* Offset of next open position. */ +} fail_stack_type; + +#else /* not INT_IS_16BIT */ + +#if defined (MATCH_MAY_ALLOCATE) +/* 4400 was enough to cause a crash on Alpha OSF/1, + whose default stack limit is 2mb. */ +int re_max_failures = 20000; +#else +int re_max_failures = 2000; +#endif + +union fail_stack_elt +{ + unsigned char *pointer; + int integer; +}; + +typedef union fail_stack_elt fail_stack_elt_t; + +typedef struct +{ + fail_stack_elt_t *stack; + unsigned size; + unsigned avail; /* Offset of next open position. */ +} fail_stack_type; + +#endif /* INT_IS_16BIT */ + +#define FAIL_STACK_EMPTY() (fail_stack.avail == 0) +#define FAIL_STACK_PTR_EMPTY() (fail_stack_ptr->avail == 0) +#define FAIL_STACK_FULL() (fail_stack.avail == fail_stack.size) + + +/* Define macros to initialize and free the failure stack. + Do `return -2' if the alloc fails. */ + +#ifdef MATCH_MAY_ALLOCATE +#define INIT_FAIL_STACK() \ + do { \ + fail_stack.stack = (fail_stack_elt_t *) \ + REGEX_ALLOCATE_STACK (INIT_FAILURE_ALLOC * sizeof (fail_stack_elt_t)); \ + \ + if (fail_stack.stack == NULL) \ + return -2; \ + \ + fail_stack.size = INIT_FAILURE_ALLOC; \ + fail_stack.avail = 0; \ + } while (0) + +#define RESET_FAIL_STACK() REGEX_FREE_STACK (fail_stack.stack) +#else +#define INIT_FAIL_STACK() \ + do { \ + fail_stack.avail = 0; \ + } while (0) + +#define RESET_FAIL_STACK() +#endif + + +/* Double the size of FAIL_STACK, up to approximately `re_max_failures' items. + + Return 1 if succeeds, and 0 if either ran out of memory + allocating space for it or it was already too large. + + REGEX_REALLOCATE_STACK requires `destination' be declared. */ + +#define DOUBLE_FAIL_STACK(fail_stack) \ + ((fail_stack).size > (unsigned) (re_max_failures * MAX_FAILURE_ITEMS) \ + ? 0 \ + : ((fail_stack).stack = (fail_stack_elt_t *) \ + REGEX_REALLOCATE_STACK ((fail_stack).stack, \ + (fail_stack).size * sizeof (fail_stack_elt_t), \ + ((fail_stack).size << 1) * sizeof (fail_stack_elt_t)), \ + \ + (fail_stack).stack == NULL \ + ? 0 \ + : ((fail_stack).size <<= 1, \ + 1))) + + +/* Push pointer POINTER on FAIL_STACK. + Return 1 if was able to do so and 0 if ran out of memory allocating + space to do so. */ +#define PUSH_PATTERN_OP(POINTER, FAIL_STACK) \ + ((FAIL_STACK_FULL () \ + && !DOUBLE_FAIL_STACK (FAIL_STACK)) \ + ? 0 \ + : ((FAIL_STACK).stack[(FAIL_STACK).avail++].pointer = POINTER, \ + 1)) + +/* Push a pointer value onto the failure stack. + Assumes the variable `fail_stack'. Probably should only + be called from within `PUSH_FAILURE_POINT'. */ +#define PUSH_FAILURE_POINTER(item) \ + fail_stack.stack[fail_stack.avail++].pointer = (unsigned char *) (item) + +/* This pushes an integer-valued item onto the failure stack. + Assumes the variable `fail_stack'. Probably should only + be called from within `PUSH_FAILURE_POINT'. */ +#define PUSH_FAILURE_INT(item) \ + fail_stack.stack[fail_stack.avail++].integer = (item) + +/* Push a fail_stack_elt_t value onto the failure stack. + Assumes the variable `fail_stack'. Probably should only + be called from within `PUSH_FAILURE_POINT'. */ +#define PUSH_FAILURE_ELT(item) \ + fail_stack.stack[fail_stack.avail++] = (item) + +/* These three POP... operations complement the three PUSH... operations. + All assume that `fail_stack' is nonempty. */ +#define POP_FAILURE_POINTER() fail_stack.stack[--fail_stack.avail].pointer +#define POP_FAILURE_INT() fail_stack.stack[--fail_stack.avail].integer +#define POP_FAILURE_ELT() fail_stack.stack[--fail_stack.avail] + +/* Used to omit pushing failure point id's when we're not debugging. */ +#ifdef DEBUG +#define DEBUG_PUSH PUSH_FAILURE_INT +#define DEBUG_POP(item_addr) (item_addr)->integer = POP_FAILURE_INT () +#else +#define DEBUG_PUSH(item) +#define DEBUG_POP(item_addr) +#endif + + +/* Push the information about the state we will need + if we ever fail back to it. + + Requires variables fail_stack, regstart, regend, reg_info, and + num_regs be declared. DOUBLE_FAIL_STACK requires `destination' be + declared. + + Does `return FAILURE_CODE' if runs out of memory. */ + +#define PUSH_FAILURE_POINT(pattern_place, string_place, failure_code) \ + do { \ + char *destination; \ + /* Must be int, so when we don't save any registers, the arithmetic \ + of 0 + -1 isn't done as unsigned. */ \ + /* Can't be int, since there is not a shred of a guarantee that int \ + is wide enough to hold a value of something to which pointer can \ + be assigned */ \ + s_reg_t this_reg; \ + \ + DEBUG_STATEMENT (failure_id++); \ + DEBUG_STATEMENT (nfailure_points_pushed++); \ + DEBUG_PRINT2 ("\nPUSH_FAILURE_POINT #%u:\n", failure_id); \ + DEBUG_PRINT2 (" Before push, next avail: %d\n", (fail_stack).avail);\ + DEBUG_PRINT2 (" size: %d\n", (fail_stack).size);\ + \ + DEBUG_PRINT2 (" slots needed: %d\n", NUM_FAILURE_ITEMS); \ + DEBUG_PRINT2 (" available: %d\n", REMAINING_AVAIL_SLOTS); \ + \ + /* Ensure we have enough space allocated for what we will push. */ \ + while (REMAINING_AVAIL_SLOTS < NUM_FAILURE_ITEMS) \ + { \ + if (!DOUBLE_FAIL_STACK (fail_stack)) \ + return failure_code; \ + \ + DEBUG_PRINT2 ("\n Doubled stack; size now: %d\n", \ + (fail_stack).size); \ + DEBUG_PRINT2 (" slots available: %d\n", REMAINING_AVAIL_SLOTS);\ + } \ + \ + /* Push the info, starting with the registers. */ \ + DEBUG_PRINT1 ("\n"); \ + \ + if (1) \ + for (this_reg = lowest_active_reg; this_reg <= highest_active_reg; \ + this_reg++) \ + { \ + DEBUG_PRINT2 (" Pushing reg: %d\n", this_reg); \ + DEBUG_STATEMENT (num_regs_pushed++); \ + \ + DEBUG_PRINT2 (" start: 0x%x\n", regstart[this_reg]); \ + PUSH_FAILURE_POINTER (regstart[this_reg]); \ + \ + DEBUG_PRINT2 (" end: 0x%x\n", regend[this_reg]); \ + PUSH_FAILURE_POINTER (regend[this_reg]); \ + \ + DEBUG_PRINT2 (" info: 0x%x\n ", reg_info[this_reg]); \ + DEBUG_PRINT2 (" match_null=%d", \ + REG_MATCH_NULL_STRING_P (reg_info[this_reg])); \ + DEBUG_PRINT2 (" active=%d", IS_ACTIVE (reg_info[this_reg])); \ + DEBUG_PRINT2 (" matched_something=%d", \ + MATCHED_SOMETHING (reg_info[this_reg])); \ + DEBUG_PRINT2 (" ever_matched=%d", \ + EVER_MATCHED_SOMETHING (reg_info[this_reg])); \ + DEBUG_PRINT1 ("\n"); \ + PUSH_FAILURE_ELT (reg_info[this_reg].word); \ + } \ + \ + DEBUG_PRINT2 (" Pushing low active reg: %d\n", lowest_active_reg);\ + PUSH_FAILURE_INT (lowest_active_reg); \ + \ + DEBUG_PRINT2 (" Pushing high active reg: %d\n", highest_active_reg);\ + PUSH_FAILURE_INT (highest_active_reg); \ + \ + DEBUG_PRINT2 (" Pushing pattern 0x%x:\n", pattern_place); \ + DEBUG_PRINT_COMPILED_PATTERN (bufp, pattern_place, pend); \ + PUSH_FAILURE_POINTER (pattern_place); \ + \ + DEBUG_PRINT2 (" Pushing string 0x%x: `", string_place); \ + DEBUG_PRINT_DOUBLE_STRING (string_place, string1, size1, string2, \ + size2); \ + DEBUG_PRINT1 ("'\n"); \ + PUSH_FAILURE_POINTER (string_place); \ + \ + DEBUG_PRINT2 (" Pushing failure id: %u\n", failure_id); \ + DEBUG_PUSH (failure_id); \ + } while (0) + +/* This is the number of items that are pushed and popped on the stack + for each register. */ +#define NUM_REG_ITEMS 3 + +/* Individual items aside from the registers. */ +#ifdef DEBUG +#define NUM_NONREG_ITEMS 5 /* Includes failure point id. */ +#else +#define NUM_NONREG_ITEMS 4 +#endif + +/* We push at most this many items on the stack. */ +/* We used to use (num_regs - 1), which is the number of registers + this regexp will save; but that was changed to 5 + to avoid stack overflow for a regexp with lots of parens. */ +#define MAX_FAILURE_ITEMS (5 * NUM_REG_ITEMS + NUM_NONREG_ITEMS) + +/* We actually push this many items. */ +#define NUM_FAILURE_ITEMS \ + (((0 \ + ? 0 : highest_active_reg - lowest_active_reg + 1) \ + * NUM_REG_ITEMS) \ + + NUM_NONREG_ITEMS) + +/* How many items can still be added to the stack without overflowing it. */ +#define REMAINING_AVAIL_SLOTS ((fail_stack).size - (fail_stack).avail) + + +/* Pops what PUSH_FAIL_STACK pushes. + + We restore into the parameters, all of which should be lvalues: + STR -- the saved data position. + PAT -- the saved pattern position. + LOW_REG, HIGH_REG -- the highest and lowest active registers. + REGSTART, REGEND -- arrays of string positions. + REG_INFO -- array of information about each subexpression. + + Also assumes the variables `fail_stack' and (if debugging), `bufp', + `pend', `string1', `size1', `string2', and `size2'. */ + +#define POP_FAILURE_POINT(str, pat, low_reg, high_reg, regstart, regend, reg_info)\ +{ \ + DEBUG_STATEMENT (fail_stack_elt_t failure_id;) \ + s_reg_t this_reg; \ + const unsigned char *string_temp; \ + \ + assert (!FAIL_STACK_EMPTY ()); \ + \ + /* Remove failure points and point to how many regs pushed. */ \ + DEBUG_PRINT1 ("POP_FAILURE_POINT:\n"); \ + DEBUG_PRINT2 (" Before pop, next avail: %d\n", fail_stack.avail); \ + DEBUG_PRINT2 (" size: %d\n", fail_stack.size); \ + \ + assert (fail_stack.avail >= NUM_NONREG_ITEMS); \ + \ + DEBUG_POP (&failure_id); \ + DEBUG_PRINT2 (" Popping failure id: %u\n", failure_id); \ + \ + /* If the saved string location is NULL, it came from an \ + on_failure_keep_string_jump opcode, and we want to throw away the \ + saved NULL, thus retaining our current position in the string. */ \ + string_temp = POP_FAILURE_POINTER (); \ + if (string_temp != NULL) \ + str = (const char *) string_temp; \ + \ + DEBUG_PRINT2 (" Popping string 0x%x: `", str); \ + DEBUG_PRINT_DOUBLE_STRING (str, string1, size1, string2, size2); \ + DEBUG_PRINT1 ("'\n"); \ + \ + pat = (unsigned char *) POP_FAILURE_POINTER (); \ + DEBUG_PRINT2 (" Popping pattern 0x%x:\n", pat); \ + DEBUG_PRINT_COMPILED_PATTERN (bufp, pat, pend); \ + \ + /* Restore register info. */ \ + high_reg = (active_reg_t) POP_FAILURE_INT (); \ + DEBUG_PRINT2 (" Popping high active reg: %d\n", high_reg); \ + \ + low_reg = (active_reg_t) POP_FAILURE_INT (); \ + DEBUG_PRINT2 (" Popping low active reg: %d\n", low_reg); \ + \ + if (1) \ + for (this_reg = high_reg; this_reg >= low_reg; this_reg--) \ + { \ + DEBUG_PRINT2 (" Popping reg: %d\n", this_reg); \ + \ + reg_info[this_reg].word = POP_FAILURE_ELT (); \ + DEBUG_PRINT2 (" info: 0x%x\n", reg_info[this_reg]); \ + \ + regend[this_reg] = (const char *) POP_FAILURE_POINTER (); \ + DEBUG_PRINT2 (" end: 0x%x\n", regend[this_reg]); \ + \ + regstart[this_reg] = (const char *) POP_FAILURE_POINTER (); \ + DEBUG_PRINT2 (" start: 0x%x\n", regstart[this_reg]); \ + } \ + else \ + { \ + for (this_reg = highest_active_reg; this_reg > high_reg; this_reg--) \ + { \ + reg_info[this_reg].word.integer = 0; \ + regend[this_reg] = 0; \ + regstart[this_reg] = 0; \ + } \ + highest_active_reg = high_reg; \ + } \ + \ + set_regs_matched_done = 0; \ + DEBUG_STATEMENT (nfailure_points_popped++); \ +} /* POP_FAILURE_POINT */ + + + +/* Structure for per-register (a.k.a. per-group) information. + Other register information, such as the + starting and ending positions (which are addresses), and the list of + inner groups (which is a bits list) are maintained in separate + variables. + + We are making a (strictly speaking) nonportable assumption here: that + the compiler will pack our bit fields into something that fits into + the type of `word', i.e., is something that fits into one item on the + failure stack. */ + + +/* Declarations and macros for re_match_2. */ + +typedef union +{ + fail_stack_elt_t word; + struct + { + /* This field is one if this group can match the empty string, + zero if not. If not yet determined, `MATCH_NULL_UNSET_VALUE'. */ +#define MATCH_NULL_UNSET_VALUE 3 + unsigned match_null_string_p : 2; + unsigned is_active : 1; + unsigned matched_something : 1; + unsigned ever_matched_something : 1; + } bits; +} register_info_type; + +#define REG_MATCH_NULL_STRING_P(R) ((R).bits.match_null_string_p) +#define IS_ACTIVE(R) ((R).bits.is_active) +#define MATCHED_SOMETHING(R) ((R).bits.matched_something) +#define EVER_MATCHED_SOMETHING(R) ((R).bits.ever_matched_something) + + +/* Call this when have matched a real character; it sets `matched' flags + for the subexpressions which we are currently inside. Also records + that those subexprs have matched. */ +#define SET_REGS_MATCHED() \ + do \ + { \ + if (!set_regs_matched_done) \ + { \ + active_reg_t r; \ + set_regs_matched_done = 1; \ + for (r = lowest_active_reg; r <= highest_active_reg; r++) \ + { \ + MATCHED_SOMETHING (reg_info[r]) \ + = EVER_MATCHED_SOMETHING (reg_info[r]) \ + = 1; \ + } \ + } \ + } \ + while (0) + +/* Registers are set to a sentinel when they haven't yet matched. */ +static char reg_unset_dummy; +#define REG_UNSET_VALUE (®_unset_dummy) +#define REG_UNSET(e) ((e) == REG_UNSET_VALUE) + +/* Subroutine declarations and macros for regex_compile. */ + +static reg_errcode_t regex_compile _RE_ARGS ((const char *pattern, size_t size, + reg_syntax_t syntax, + struct re_pattern_buffer *bufp)); +static void store_op1 _RE_ARGS ((re_opcode_t op, unsigned char *loc, int arg)); +static void store_op2 _RE_ARGS ((re_opcode_t op, unsigned char *loc, + int arg1, int arg2)); +static void insert_op1 _RE_ARGS ((re_opcode_t op, unsigned char *loc, + int arg, unsigned char *end)); +static void insert_op2 _RE_ARGS ((re_opcode_t op, unsigned char *loc, + int arg1, int arg2, unsigned char *end)); +static boolean at_begline_loc_p _RE_ARGS ((const char *pattern, const char *p, + reg_syntax_t syntax)); +static boolean at_endline_loc_p _RE_ARGS ((const char *p, const char *pend, + reg_syntax_t syntax)); +static reg_errcode_t compile_range _RE_ARGS ((const char **p_ptr, + const char *pend, + char *translate, + reg_syntax_t syntax, + unsigned char *b)); + +/* Fetch the next character in the uncompiled pattern---translating it + if necessary. Also cast from a signed character in the constant + string passed to us by the user to an unsigned char that we can use + as an array index (in, e.g., `translate'). */ +#ifndef PATFETCH +#define PATFETCH(c) \ + do {if (p == pend) return REG_EEND; \ + c = (unsigned char) *p++; \ + if (translate) c = (unsigned char) translate[c]; \ + } while (0) +#endif + +/* Fetch the next character in the uncompiled pattern, with no + translation. */ +#define PATFETCH_RAW(c) \ + do {if (p == pend) return REG_EEND; \ + c = (unsigned char) *p++; \ + } while (0) + +/* Go backwards one character in the pattern. */ +#define PATUNFETCH p-- + + +/* If `translate' is non-null, return translate[D], else just D. We + cast the subscript to translate because some data is declared as + `char *', to avoid warnings when a string constant is passed. But + when we use a character as a subscript we must make it unsigned. */ +#ifndef TRANSLATE +#define TRANSLATE(d) \ + (translate ? (char) translate[(unsigned char) (d)] : (d)) +#endif + + +/* Macros for outputting the compiled pattern into `buffer'. */ + +/* If the buffer isn't allocated when it comes in, use this. */ +#define INIT_BUF_SIZE 32 + +/* Make sure we have at least N more bytes of space in buffer. */ +#define GET_BUFFER_SPACE(n) \ + while ((unsigned long) (b - bufp->buffer + (n)) > bufp->allocated) \ + EXTEND_BUFFER () + +/* Make sure we have one more byte of buffer space and then add C to it. */ +#define BUF_PUSH(c) \ + do { \ + GET_BUFFER_SPACE (1); \ + *b++ = (unsigned char) (c); \ + } while (0) + + +/* Ensure we have two more bytes of buffer space and then append C1 and C2. */ +#define BUF_PUSH_2(c1, c2) \ + do { \ + GET_BUFFER_SPACE (2); \ + *b++ = (unsigned char) (c1); \ + *b++ = (unsigned char) (c2); \ + } while (0) + + +/* As with BUF_PUSH_2, except for three bytes. */ +#define BUF_PUSH_3(c1, c2, c3) \ + do { \ + GET_BUFFER_SPACE (3); \ + *b++ = (unsigned char) (c1); \ + *b++ = (unsigned char) (c2); \ + *b++ = (unsigned char) (c3); \ + } while (0) + + +/* Store a jump with opcode OP at LOC to location TO. We store a + relative address offset by the three bytes the jump itself occupies. */ +#define STORE_JUMP(op, loc, to) \ + store_op1 (op, loc, (int) ((to) - (loc) - 3)) + +/* Likewise, for a two-argument jump. */ +#define STORE_JUMP2(op, loc, to, arg) \ + store_op2 (op, loc, (int) ((to) - (loc) - 3), arg) + +/* Like `STORE_JUMP', but for inserting. Assume `b' is the buffer end. */ +#define INSERT_JUMP(op, loc, to) \ + insert_op1 (op, loc, (int) ((to) - (loc) - 3), b) + +/* Like `STORE_JUMP2', but for inserting. Assume `b' is the buffer end. */ +#define INSERT_JUMP2(op, loc, to, arg) \ + insert_op2 (op, loc, (int) ((to) - (loc) - 3), arg, b) + + +/* This is not an arbitrary limit: the arguments which represent offsets + into the pattern are two bytes long. So if 2^16 bytes turns out to + be too small, many things would have to change. */ +/* Any other compiler which, like MSC, has allocation limit below 2^16 + bytes will have to use approach similar to what was done below for + MSC and drop MAX_BUF_SIZE a bit. Otherwise you may end up + reallocating to 0 bytes. Such thing is not going to work too well. + You have been warned!! */ +#if defined(_MSC_VER) && !defined(WIN32) +/* Microsoft C 16-bit versions limit malloc to approx 65512 bytes. + The REALLOC define eliminates a flurry of conversion warnings, + but is not required. */ +#define MAX_BUF_SIZE 65500L +#define REALLOC(p,s) realloc ((p), (size_t) (s)) +#else +#define MAX_BUF_SIZE (1L << 16) +#define REALLOC(p,s) realloc ((p), (s)) +#endif + +/* Extend the buffer by twice its current size via realloc and + reset the pointers that pointed into the old block to point to the + correct places in the new one. If extending the buffer results in it + being larger than MAX_BUF_SIZE, then flag memory exhausted. */ +#define EXTEND_BUFFER() \ + do { \ + unsigned char *old_buffer = bufp->buffer; \ + if (bufp->allocated == MAX_BUF_SIZE) \ + return REG_ESIZE; \ + bufp->allocated <<= 1; \ + if (bufp->allocated > MAX_BUF_SIZE) \ + bufp->allocated = MAX_BUF_SIZE; \ + bufp->buffer = (unsigned char *) REALLOC (bufp->buffer, bufp->allocated);\ + if (bufp->buffer == NULL) \ + return REG_ESPACE; \ + /* If the buffer moved, move all the pointers into it. */ \ + if (old_buffer != bufp->buffer) \ + { \ + b = (b - old_buffer) + bufp->buffer; \ + begalt = (begalt - old_buffer) + bufp->buffer; \ + if (fixup_alt_jump) \ + fixup_alt_jump = (fixup_alt_jump - old_buffer) + bufp->buffer;\ + if (laststart) \ + laststart = (laststart - old_buffer) + bufp->buffer; \ + if (pending_exact) \ + pending_exact = (pending_exact - old_buffer) + bufp->buffer; \ + } \ + } while (0) + + +/* Since we have one byte reserved for the register number argument to + {start,stop}_memory, the maximum number of groups we can report + things about is what fits in that byte. */ +#define MAX_REGNUM 255 + +/* But patterns can have more than `MAX_REGNUM' registers. We just + ignore the excess. */ +typedef unsigned regnum_t; + + +/* Macros for the compile stack. */ + +/* Since offsets can go either forwards or backwards, this type needs to + be able to hold values from -(MAX_BUF_SIZE - 1) to MAX_BUF_SIZE - 1. */ +/* int may be not enough when sizeof(int) == 2. */ +typedef long pattern_offset_t; + +typedef struct +{ + pattern_offset_t begalt_offset; + pattern_offset_t fixup_alt_jump; + pattern_offset_t inner_group_offset; + pattern_offset_t laststart_offset; + regnum_t regnum; +} compile_stack_elt_t; + + +typedef struct +{ + compile_stack_elt_t *stack; + unsigned size; + unsigned avail; /* Offset of next open position. */ +} compile_stack_type; + + +#define INIT_COMPILE_STACK_SIZE 32 + +#define COMPILE_STACK_EMPTY (compile_stack.avail == 0) +#define COMPILE_STACK_FULL (compile_stack.avail == compile_stack.size) + +/* The next available element. */ +#define COMPILE_STACK_TOP (compile_stack.stack[compile_stack.avail]) + + +/* Set the bit for character C in a list. */ +#define SET_LIST_BIT(c) \ + (b[((unsigned char) (c)) / BYTEWIDTH] \ + |= 1 << (((unsigned char) c) % BYTEWIDTH)) + + +/* Get the next unsigned number in the uncompiled pattern. */ +#define GET_UNSIGNED_NUMBER(num) \ + { if (p != pend) \ + { \ + PATFETCH (c); \ + while (ISDIGIT (c)) \ + { \ + if (num < 0) \ + num = 0; \ + num = num * 10 + c - '0'; \ + if (p == pend) \ + break; \ + PATFETCH (c); \ + } \ + } \ + } + +#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H) +/* The GNU C library provides support for user-defined character classes + and the functions from ISO C amendement 1. */ +# ifdef CHARCLASS_NAME_MAX +# define CHAR_CLASS_MAX_LENGTH CHARCLASS_NAME_MAX +# else +/* This shouldn't happen but some implementation might still have this + problem. Use a reasonable default value. */ +# define CHAR_CLASS_MAX_LENGTH 256 +# endif + +# define IS_CHAR_CLASS(string) wctype (string) +#else +# define CHAR_CLASS_MAX_LENGTH 6 /* Namely, `xdigit'. */ + +# define IS_CHAR_CLASS(string) \ + (STREQ (string, "alpha") || STREQ (string, "upper") \ + || STREQ (string, "lower") || STREQ (string, "digit") \ + || STREQ (string, "alnum") || STREQ (string, "xdigit") \ + || STREQ (string, "space") || STREQ (string, "print") \ + || STREQ (string, "punct") || STREQ (string, "graph") \ + || STREQ (string, "cntrl") || STREQ (string, "blank")) +#endif + +#ifndef MATCH_MAY_ALLOCATE + +/* If we cannot allocate large objects within re_match_2_internal, + we make the fail stack and register vectors global. + The fail stack, we grow to the maximum size when a regexp + is compiled. + The register vectors, we adjust in size each time we + compile a regexp, according to the number of registers it needs. */ + +static fail_stack_type fail_stack; + +/* Size with which the following vectors are currently allocated. + That is so we can make them bigger as needed, + but never make them smaller. */ +static int regs_allocated_size; + +static const char ** regstart, ** regend; +static const char ** old_regstart, ** old_regend; +static const char **best_regstart, **best_regend; +static register_info_type *reg_info; +static const char **reg_dummy; +static register_info_type *reg_info_dummy; + +/* Make the register vectors big enough for NUM_REGS registers, + but don't make them smaller. */ + +static +regex_grow_registers (num_regs) + int num_regs; +{ + if (num_regs > regs_allocated_size) + { + RETALLOC_IF (regstart, num_regs, const char *); + RETALLOC_IF (regend, num_regs, const char *); + RETALLOC_IF (old_regstart, num_regs, const char *); + RETALLOC_IF (old_regend, num_regs, const char *); + RETALLOC_IF (best_regstart, num_regs, const char *); + RETALLOC_IF (best_regend, num_regs, const char *); + RETALLOC_IF (reg_info, num_regs, register_info_type); + RETALLOC_IF (reg_dummy, num_regs, const char *); + RETALLOC_IF (reg_info_dummy, num_regs, register_info_type); + + regs_allocated_size = num_regs; + } +} + +#endif /* not MATCH_MAY_ALLOCATE */ + +static boolean group_in_compile_stack _RE_ARGS ((compile_stack_type + compile_stack, + regnum_t regnum)); + +/* `regex_compile' compiles PATTERN (of length SIZE) according to SYNTAX. + Returns one of error codes defined in `regex.h', or zero for success. + + Assumes the `allocated' (and perhaps `buffer') and `translate' + fields are set in BUFP on entry. + + If it succeeds, results are put in BUFP (if it returns an error, the + contents of BUFP are undefined): + `buffer' is the compiled pattern; + `syntax' is set to SYNTAX; + `used' is set to the length of the compiled pattern; + `fastmap_accurate' is zero; + `re_nsub' is the number of subexpressions in PATTERN; + `not_bol' and `not_eol' are zero; + + The `fastmap' and `newline_anchor' fields are neither + examined nor set. */ + +/* Return, freeing storage we allocated. */ +#define FREE_STACK_RETURN(value) \ + return (free (compile_stack.stack), value) /* __MEM_CHECKED__ */ + +static reg_errcode_t +regex_compile (pattern, size, syntax, bufp) + const char *pattern; + size_t size; + reg_syntax_t syntax; + struct re_pattern_buffer *bufp; +{ + /* We fetch characters from PATTERN here. Even though PATTERN is + `char *' (i.e., signed), we declare these variables as unsigned, so + they can be reliably used as array indices. */ + register unsigned char c, c1; + + /* A random temporary spot in PATTERN. */ + const char *p1; + + /* Points to the end of the buffer, where we should append. */ + register unsigned char *b; + + /* Keeps track of unclosed groups. */ + compile_stack_type compile_stack; + + /* Points to the current (ending) position in the pattern. */ + const char *p = pattern; + const char *pend = pattern + size; + + /* How to translate the characters in the pattern. */ + RE_TRANSLATE_TYPE translate = bufp->translate; + + /* Address of the count-byte of the most recently inserted `exactn' + command. This makes it possible to tell if a new exact-match + character can be added to that command or if the character requires + a new `exactn' command. */ + unsigned char *pending_exact = 0; + + /* Address of start of the most recently finished expression. + This tells, e.g., postfix * where to find the start of its + operand. Reset at the beginning of groups and alternatives. */ + unsigned char *laststart = 0; + + /* Address of beginning of regexp, or inside of last group. */ + unsigned char *begalt; + + /* Place in the uncompiled pattern (i.e., the {) to + which to go back if the interval is invalid. */ + const char *beg_interval; + + /* Address of the place where a forward jump should go to the end of + the containing expression. Each alternative of an `or' -- except the + last -- ends with a forward jump of this sort. */ + unsigned char *fixup_alt_jump = 0; + + /* Counts open-groups as they are encountered. Remembered for the + matching close-group on the compile stack, so the same register + number is put in the stop_memory as the start_memory. */ + regnum_t regnum = 0; + +#ifdef DEBUG + DEBUG_PRINT1 ("\nCompiling pattern: "); + if (debug) + { + unsigned debug_count; + + for (debug_count = 0; debug_count < size; debug_count++) + putchar (pattern[debug_count]); + putchar ('\n'); + } +#endif /* DEBUG */ + + /* Initialize the compile stack. */ + compile_stack.stack = TALLOC (INIT_COMPILE_STACK_SIZE, compile_stack_elt_t); + if (compile_stack.stack == NULL) + return REG_ESPACE; + + compile_stack.size = INIT_COMPILE_STACK_SIZE; + compile_stack.avail = 0; + + /* Initialize the pattern buffer. */ + bufp->syntax = syntax; + bufp->fastmap_accurate = 0; + bufp->not_bol = bufp->not_eol = 0; + + /* Set `used' to zero, so that if we return an error, the pattern + printer (for debugging) will think there's no pattern. We reset it + at the end. */ + bufp->used = 0; + + /* Always count groups, whether or not bufp->no_sub is set. */ + bufp->re_nsub = 0; + +#if !defined (emacs) && !defined (SYNTAX_TABLE) + /* Initialize the syntax table. */ + init_syntax_once (); +#endif + + if (bufp->allocated == 0) + { + if (bufp->buffer) + { /* If zero allocated, but buffer is non-null, try to realloc + enough space. This loses if buffer's address is bogus, but + that is the user's responsibility. */ + RETALLOC (bufp->buffer, INIT_BUF_SIZE, unsigned char); + } + else + { /* Caller did not allocate a buffer. Do it for them. */ + bufp->buffer = TALLOC (INIT_BUF_SIZE, unsigned char); + } + if (!bufp->buffer) FREE_STACK_RETURN (REG_ESPACE); + + bufp->allocated = INIT_BUF_SIZE; + } + + begalt = b = bufp->buffer; + + /* Loop through the uncompiled pattern until we're at the end. */ + while (p != pend) + { + PATFETCH (c); + + switch (c) + { + case '^': + { + if ( /* If at start of pattern, it's an operator. */ + p == pattern + 1 + /* If context independent, it's an operator. */ + || syntax & RE_CONTEXT_INDEP_ANCHORS + /* Otherwise, depends on what's come before. */ + || at_begline_loc_p (pattern, p, syntax)) + BUF_PUSH (begline); + else + goto normal_char; + } + break; + + + case '$': + { + if ( /* If at end of pattern, it's an operator. */ + p == pend + /* If context independent, it's an operator. */ + || syntax & RE_CONTEXT_INDEP_ANCHORS + /* Otherwise, depends on what's next. */ + || at_endline_loc_p (p, pend, syntax)) + BUF_PUSH (endline); + else + goto normal_char; + } + break; + + + case '+': + case '?': + if ((syntax & RE_BK_PLUS_QM) + || (syntax & RE_LIMITED_OPS)) + goto normal_char; + handle_plus: + case '*': + /* If there is no previous pattern... */ + if (!laststart) + { + if (syntax & RE_CONTEXT_INVALID_OPS) + FREE_STACK_RETURN (REG_BADRPT); + else if (!(syntax & RE_CONTEXT_INDEP_OPS)) + goto normal_char; + } + + { + /* Are we optimizing this jump? */ + boolean keep_string_p = false; + + /* 1 means zero (many) matches is allowed. */ + char zero_times_ok = 0, many_times_ok = 0; + + /* If there is a sequence of repetition chars, collapse it + down to just one (the right one). We can't combine + interval operators with these because of, e.g., `a{2}*', + which should only match an even number of `a's. */ + + for (;;) + { + zero_times_ok |= c != '+'; + many_times_ok |= c != '?'; + + if (p == pend) + break; + + PATFETCH (c); + + if (c == '*' + || (!(syntax & RE_BK_PLUS_QM) && (c == '+' || c == '?'))) + ; + + else if (syntax & RE_BK_PLUS_QM && c == '\\') + { + if (p == pend) FREE_STACK_RETURN (REG_EESCAPE); + + PATFETCH (c1); + if (!(c1 == '+' || c1 == '?')) + { + PATUNFETCH; + PATUNFETCH; + break; + } + + c = c1; + } + else + { + PATUNFETCH; + break; + } + + /* If we get here, we found another repeat character. */ + } + + /* Star, etc. applied to an empty pattern is equivalent + to an empty pattern. */ + if (!laststart) + break; + + /* Now we know whether or not zero matches is allowed + and also whether or not two or more matches is allowed. */ + if (many_times_ok) + { /* More than one repetition is allowed, so put in at the + end a backward relative jump from `b' to before the next + jump we're going to put in below (which jumps from + laststart to after this jump). + + But if we are at the `*' in the exact sequence `.*\n', + insert an unconditional jump backwards to the ., + instead of the beginning of the loop. This way we only + push a failure point once, instead of every time + through the loop. */ + assert (p - 1 > pattern); + + /* Allocate the space for the jump. */ + GET_BUFFER_SPACE (3); + + /* We know we are not at the first character of the pattern, + because laststart was nonzero. And we've already + incremented `p', by the way, to be the character after + the `*'. Do we have to do something analogous here + for null bytes, because of RE_DOT_NOT_NULL? */ + if (TRANSLATE (*(p - 2)) == TRANSLATE ('.') + && zero_times_ok + && p < pend && TRANSLATE (*p) == TRANSLATE ('\n') + && !(syntax & RE_DOT_NEWLINE)) + { /* We have .*\n. */ + STORE_JUMP (jump, b, laststart); + keep_string_p = true; + } + else + /* Anything else. */ + STORE_JUMP (maybe_pop_jump, b, laststart - 3); + + /* We've added more stuff to the buffer. */ + b += 3; + } + + /* On failure, jump from laststart to b + 3, which will be the + end of the buffer after this jump is inserted. */ + GET_BUFFER_SPACE (3); + INSERT_JUMP (keep_string_p ? on_failure_keep_string_jump + : on_failure_jump, + laststart, b + 3); + pending_exact = 0; + b += 3; + + if (!zero_times_ok) + { + /* At least one repetition is required, so insert a + `dummy_failure_jump' before the initial + `on_failure_jump' instruction of the loop. This + effects a skip over that instruction the first time + we hit that loop. */ + GET_BUFFER_SPACE (3); + INSERT_JUMP (dummy_failure_jump, laststart, laststart + 6); + b += 3; + } + } + break; + + + case '.': + laststart = b; + BUF_PUSH (anychar); + break; + + + case '[': + { + boolean had_char_class = false; + + if (p == pend) FREE_STACK_RETURN (REG_EBRACK); + + /* Ensure that we have enough space to push a charset: the + opcode, the length count, and the bitset; 34 bytes in all. */ + GET_BUFFER_SPACE (34); + + laststart = b; + + /* We test `*p == '^' twice, instead of using an if + statement, so we only need one BUF_PUSH. */ + BUF_PUSH (*p == '^' ? charset_not : charset); + if (*p == '^') + p++; + + /* Remember the first position in the bracket expression. */ + p1 = p; + + /* Push the number of bytes in the bitmap. */ + BUF_PUSH ((1 << BYTEWIDTH) / BYTEWIDTH); + + /* Clear the whole map. */ + bzero (b, (1 << BYTEWIDTH) / BYTEWIDTH); + + /* charset_not matches newline according to a syntax bit. */ + if ((re_opcode_t) b[-2] == charset_not + && (syntax & RE_HAT_LISTS_NOT_NEWLINE)) + SET_LIST_BIT ('\n'); + + /* Read in characters and ranges, setting map bits. */ + for (;;) + { + if (p == pend) FREE_STACK_RETURN (REG_EBRACK); + + PATFETCH (c); + + /* \ might escape characters inside [...] and [^...]. */ + if ((syntax & RE_BACKSLASH_ESCAPE_IN_LISTS) && c == '\\') + { + if (p == pend) FREE_STACK_RETURN (REG_EESCAPE); + + PATFETCH (c1); + SET_LIST_BIT (c1); + continue; + } + + /* Could be the end of the bracket expression. If it's + not (i.e., when the bracket expression is `[]' so + far), the ']' character bit gets set way below. */ + if (c == ']' && p != p1 + 1) + break; + + /* Look ahead to see if it's a range when the last thing + was a character class. */ + if (had_char_class && c == '-' && *p != ']') + FREE_STACK_RETURN (REG_ERANGE); + + /* Look ahead to see if it's a range when the last thing + was a character: if this is a hyphen not at the + beginning or the end of a list, then it's the range + operator. */ + if (c == '-' + && !(p - 2 >= pattern && p[-2] == '[') + && !(p - 3 >= pattern && p[-3] == '[' && p[-2] == '^') + && *p != ']') + { + reg_errcode_t ret + = compile_range (&p, pend, translate, syntax, b); + if (ret != REG_NOERROR) FREE_STACK_RETURN (ret); + } + + else if (p[0] == '-' && p[1] != ']') + { /* This handles ranges made up of characters only. */ + reg_errcode_t ret; + + /* Move past the `-'. */ + PATFETCH (c1); + + ret = compile_range (&p, pend, translate, syntax, b); + if (ret != REG_NOERROR) FREE_STACK_RETURN (ret); + } + + /* See if we're at the beginning of a possible character + class. */ + + else if (syntax & RE_CHAR_CLASSES && c == '[' && *p == ':') + { /* Leave room for the null. */ + char str[CHAR_CLASS_MAX_LENGTH + 1]; + + PATFETCH (c); + c1 = 0; + + /* If pattern is `[[:'. */ + if (p == pend) FREE_STACK_RETURN (REG_EBRACK); + + for (;;) + { + PATFETCH (c); + if (c == ':' || c == ']' || p == pend + || c1 == CHAR_CLASS_MAX_LENGTH) + break; + str[c1++] = c; + } + str[c1] = '\0'; + + /* If isn't a word bracketed by `[:' and:`]': + undo the ending character, the letters, and leave + the leading `:' and `[' (but set bits for them). */ + if (c == ':' && *p == ']') + { +#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H) + boolean is_lower = STREQ (str, "lower"); + boolean is_upper = STREQ (str, "upper"); + wctype_t wt; + int ch; + + wt = wctype (str); + if (wt == 0) + FREE_STACK_RETURN (REG_ECTYPE); + + /* Throw away the ] at the end of the character + class. */ + PATFETCH (c); + + if (p == pend) FREE_STACK_RETURN (REG_EBRACK); + + for (ch = 0; ch < 1 << BYTEWIDTH; ++ch) + { + if (iswctype (btowc (ch), wt)) + SET_LIST_BIT (ch); + + if (translate && (is_upper || is_lower) + && (ISUPPER (ch) || ISLOWER (ch))) + SET_LIST_BIT (ch); + } + + had_char_class = true; +#else + int ch; + boolean is_alnum = STREQ (str, "alnum"); + boolean is_alpha = STREQ (str, "alpha"); + boolean is_blank = STREQ (str, "blank"); + boolean is_cntrl = STREQ (str, "cntrl"); + boolean is_digit = STREQ (str, "digit"); + boolean is_graph = STREQ (str, "graph"); + boolean is_lower = STREQ (str, "lower"); + boolean is_print = STREQ (str, "print"); + boolean is_punct = STREQ (str, "punct"); + boolean is_space = STREQ (str, "space"); + boolean is_upper = STREQ (str, "upper"); + boolean is_xdigit = STREQ (str, "xdigit"); + + if (!IS_CHAR_CLASS (str)) + FREE_STACK_RETURN (REG_ECTYPE); + + /* Throw away the ] at the end of the character + class. */ + PATFETCH (c); + + if (p == pend) FREE_STACK_RETURN (REG_EBRACK); + + for (ch = 0; ch < 1 << BYTEWIDTH; ch++) + { + /* This was split into 3 if's to + avoid an arbitrary limit in some compiler. */ + if ( (is_alnum && ISALNUM (ch)) + || (is_alpha && ISALPHA (ch)) + || (is_blank && ISBLANK (ch)) + || (is_cntrl && ISCNTRL (ch))) + SET_LIST_BIT (ch); + if ( (is_digit && ISDIGIT (ch)) + || (is_graph && ISGRAPH (ch)) + || (is_lower && ISLOWER (ch)) + || (is_print && ISPRINT (ch))) + SET_LIST_BIT (ch); + if ( (is_punct && ISPUNCT (ch)) + || (is_space && ISSPACE (ch)) + || (is_upper && ISUPPER (ch)) + || (is_xdigit && ISXDIGIT (ch))) + SET_LIST_BIT (ch); + if ( translate && (is_upper || is_lower) + && (ISUPPER (ch) || ISLOWER (ch))) + SET_LIST_BIT (ch); + } + had_char_class = true; +#endif /* libc || wctype.h */ + } + else + { + c1++; + while (c1--) + PATUNFETCH; + SET_LIST_BIT ('['); + SET_LIST_BIT (':'); + had_char_class = false; + } + } + else + { + had_char_class = false; + SET_LIST_BIT (c); + } + } + + /* Discard any (non)matching list bytes that are all 0 at the + end of the map. Decrease the map-length byte too. */ + while ((int) b[-1] > 0 && b[b[-1] - 1] == 0) + b[-1]--; + b += b[-1]; + } + break; + + + case '(': + if (syntax & RE_NO_BK_PARENS) + goto handle_open; + else + goto normal_char; + + + case ')': + if (syntax & RE_NO_BK_PARENS) + goto handle_close; + else + goto normal_char; + + + case '\n': + if (syntax & RE_NEWLINE_ALT) + goto handle_alt; + else + goto normal_char; + + + case '|': + if (syntax & RE_NO_BK_VBAR) + goto handle_alt; + else + goto normal_char; + + + case '{': + if (syntax & RE_INTERVALS && syntax & RE_NO_BK_BRACES) + goto handle_interval; + else + goto normal_char; + + + case '\\': + if (p == pend) FREE_STACK_RETURN (REG_EESCAPE); + + /* Do not translate the character after the \, so that we can + distinguish, e.g., \B from \b, even if we normally would + translate, e.g., B to b. */ + PATFETCH_RAW (c); + + switch (c) + { + case '(': + if (syntax & RE_NO_BK_PARENS) + goto normal_backslash; + + handle_open: + bufp->re_nsub++; + regnum++; + + if (COMPILE_STACK_FULL) + { + RETALLOC (compile_stack.stack, compile_stack.size << 1, + compile_stack_elt_t); + if (compile_stack.stack == NULL) return REG_ESPACE; + + compile_stack.size <<= 1; + } + + /* These are the values to restore when we hit end of this + group. They are all relative offsets, so that if the + whole pattern moves because of realloc, they will still + be valid. */ + COMPILE_STACK_TOP.begalt_offset = begalt - bufp->buffer; + COMPILE_STACK_TOP.fixup_alt_jump + = fixup_alt_jump ? fixup_alt_jump - bufp->buffer + 1 : 0; + COMPILE_STACK_TOP.laststart_offset = b - bufp->buffer; + COMPILE_STACK_TOP.regnum = regnum; + + /* We will eventually replace the 0 with the number of + groups inner to this one. But do not push a + start_memory for groups beyond the last one we can + represent in the compiled pattern. */ + if (regnum <= MAX_REGNUM) + { + COMPILE_STACK_TOP.inner_group_offset = b - bufp->buffer + 2; + BUF_PUSH_3 (start_memory, regnum, 0); + } + + compile_stack.avail++; + + fixup_alt_jump = 0; + laststart = 0; + begalt = b; + /* If we've reached MAX_REGNUM groups, then this open + won't actually generate any code, so we'll have to + clear pending_exact explicitly. */ + pending_exact = 0; + break; + + + case ')': + if (syntax & RE_NO_BK_PARENS) goto normal_backslash; + + if (COMPILE_STACK_EMPTY) + { + if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD) + goto normal_backslash; + else + FREE_STACK_RETURN (REG_ERPAREN); + } + + handle_close: + if (fixup_alt_jump) + { /* Push a dummy failure point at the end of the + alternative for a possible future + `pop_failure_jump' to pop. See comments at + `push_dummy_failure' in `re_match_2'. */ + BUF_PUSH (push_dummy_failure); + + /* We allocated space for this jump when we assigned + to `fixup_alt_jump', in the `handle_alt' case below. */ + STORE_JUMP (jump_past_alt, fixup_alt_jump, b - 1); + } + + /* See similar code for backslashed left paren above. */ + if (COMPILE_STACK_EMPTY) + { + if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD) + goto normal_char; + else + FREE_STACK_RETURN (REG_ERPAREN); + } + + /* Since we just checked for an empty stack above, this + ``can't happen''. */ + assert (compile_stack.avail != 0); + { + /* We don't just want to restore into `regnum', because + later groups should continue to be numbered higher, + as in `(ab)c(de)' -- the second group is #2. */ + regnum_t this_group_regnum; + + compile_stack.avail--; + begalt = bufp->buffer + COMPILE_STACK_TOP.begalt_offset; + fixup_alt_jump + = COMPILE_STACK_TOP.fixup_alt_jump + ? bufp->buffer + COMPILE_STACK_TOP.fixup_alt_jump - 1 + : 0; + laststart = bufp->buffer + COMPILE_STACK_TOP.laststart_offset; + this_group_regnum = COMPILE_STACK_TOP.regnum; + /* If we've reached MAX_REGNUM groups, then this open + won't actually generate any code, so we'll have to + clear pending_exact explicitly. */ + pending_exact = 0; + + /* We're at the end of the group, so now we know how many + groups were inside this one. */ + if (this_group_regnum <= MAX_REGNUM) + { + unsigned char *inner_group_loc + = bufp->buffer + COMPILE_STACK_TOP.inner_group_offset; + + *inner_group_loc = regnum - this_group_regnum; + BUF_PUSH_3 (stop_memory, this_group_regnum, + regnum - this_group_regnum); + } + } + break; + + + case '|': /* `\|'. */ + if (syntax & RE_LIMITED_OPS || syntax & RE_NO_BK_VBAR) + goto normal_backslash; + handle_alt: + if (syntax & RE_LIMITED_OPS) + goto normal_char; + + /* Insert before the previous alternative a jump which + jumps to this alternative if the former fails. */ + GET_BUFFER_SPACE (3); + INSERT_JUMP (on_failure_jump, begalt, b + 6); + pending_exact = 0; + b += 3; + + /* The alternative before this one has a jump after it + which gets executed if it gets matched. Adjust that + jump so it will jump to this alternative's analogous + jump (put in below, which in turn will jump to the next + (if any) alternative's such jump, etc.). The last such + jump jumps to the correct final destination. A picture: + _____ _____ + | | | | + | v | v + a | b | c + + If we are at `b', then fixup_alt_jump right now points to a + three-byte space after `a'. We'll put in the jump, set + fixup_alt_jump to right after `b', and leave behind three + bytes which we'll fill in when we get to after `c'. */ + + if (fixup_alt_jump) + STORE_JUMP (jump_past_alt, fixup_alt_jump, b); + + /* Mark and leave space for a jump after this alternative, + to be filled in later either by next alternative or + when know we're at the end of a series of alternatives. */ + fixup_alt_jump = b; + GET_BUFFER_SPACE (3); + b += 3; + + laststart = 0; + begalt = b; + break; + + + case '{': + /* If \{ is a literal. */ + if (!(syntax & RE_INTERVALS) + /* If we're at `\{' and it's not the open-interval + operator. */ + || ((syntax & RE_INTERVALS) && (syntax & RE_NO_BK_BRACES)) + || (p - 2 == pattern && p == pend)) + goto normal_backslash; + + handle_interval: + { + /* If got here, then the syntax allows intervals. */ + + /* At least (most) this many matches must be made. */ + int lower_bound = -1, upper_bound = -1; + + beg_interval = p - 1; + + if (p == pend) + { + if (syntax & RE_NO_BK_BRACES) + goto unfetch_interval; + else + FREE_STACK_RETURN (REG_EBRACE); + } + + GET_UNSIGNED_NUMBER (lower_bound); + + if (c == ',') + { + GET_UNSIGNED_NUMBER (upper_bound); + if (upper_bound < 0) upper_bound = RE_DUP_MAX; + } + else + /* Interval such as `{1}' => match exactly once. */ + upper_bound = lower_bound; + + if (lower_bound < 0 || upper_bound > RE_DUP_MAX + || lower_bound > upper_bound) + { + if (syntax & RE_NO_BK_BRACES) + goto unfetch_interval; + else + FREE_STACK_RETURN (REG_BADBR); + } + + if (!(syntax & RE_NO_BK_BRACES)) + { + if (c != '\\') FREE_STACK_RETURN (REG_EBRACE); + + PATFETCH (c); + } + + if (c != '}') + { + if (syntax & RE_NO_BK_BRACES) + goto unfetch_interval; + else + FREE_STACK_RETURN (REG_BADBR); + } + + /* We just parsed a valid interval. */ + + /* If it's invalid to have no preceding re. */ + if (!laststart) + { + if (syntax & RE_CONTEXT_INVALID_OPS) + FREE_STACK_RETURN (REG_BADRPT); + else if (syntax & RE_CONTEXT_INDEP_OPS) + laststart = b; + else + goto unfetch_interval; + } + + /* If the upper bound is zero, don't want to succeed at + all; jump from `laststart' to `b + 3', which will be + the end of the buffer after we insert the jump. */ + if (upper_bound == 0) + { + GET_BUFFER_SPACE (3); + INSERT_JUMP (jump, laststart, b + 3); + b += 3; + } + + /* Otherwise, we have a nontrivial interval. When + we're all done, the pattern will look like: + set_number_at + set_number_at + succeed_n + + jump_n + (The upper bound and `jump_n' are omitted if + `upper_bound' is 1, though.) */ + else + { /* If the upper bound is > 1, we need to insert + more at the end of the loop. */ + unsigned nbytes = 10 + (upper_bound > 1) * 10; + + GET_BUFFER_SPACE (nbytes); + + /* Initialize lower bound of the `succeed_n', even + though it will be set during matching by its + attendant `set_number_at' (inserted next), + because `re_compile_fastmap' needs to know. + Jump to the `jump_n' we might insert below. */ + INSERT_JUMP2 (succeed_n, laststart, + b + 5 + (upper_bound > 1) * 5, + lower_bound); + b += 5; + + /* Code to initialize the lower bound. Insert + before the `succeed_n'. The `5' is the last two + bytes of this `set_number_at', plus 3 bytes of + the following `succeed_n'. */ + insert_op2 (set_number_at, laststart, 5, lower_bound, b); + b += 5; + + if (upper_bound > 1) + { /* More than one repetition is allowed, so + append a backward jump to the `succeed_n' + that starts this interval. + + When we've reached this during matching, + we'll have matched the interval once, so + jump back only `upper_bound - 1' times. */ + STORE_JUMP2 (jump_n, b, laststart + 5, + upper_bound - 1); + b += 5; + + /* The location we want to set is the second + parameter of the `jump_n'; that is `b-2' as + an absolute address. `laststart' will be + the `set_number_at' we're about to insert; + `laststart+3' the number to set, the source + for the relative address. But we are + inserting into the middle of the pattern -- + so everything is getting moved up by 5. + Conclusion: (b - 2) - (laststart + 3) + 5, + i.e., b - laststart. + + We insert this at the beginning of the loop + so that if we fail during matching, we'll + reinitialize the bounds. */ + insert_op2 (set_number_at, laststart, b - laststart, + upper_bound - 1, b); + b += 5; + } + } + pending_exact = 0; + beg_interval = NULL; + } + break; + + unfetch_interval: + /* If an invalid interval, match the characters as literals. */ + assert (beg_interval); + p = beg_interval; + beg_interval = NULL; + + /* normal_char and normal_backslash need `c'. */ + PATFETCH (c); + + if (!(syntax & RE_NO_BK_BRACES)) + { + if (p > pattern && p[-1] == '\\') + goto normal_backslash; + } + goto normal_char; + +#ifdef emacs + /* There is no way to specify the before_dot and after_dot + operators. rms says this is ok. --karl */ + case '=': + BUF_PUSH (at_dot); + break; + + case 's': + laststart = b; + PATFETCH (c); + BUF_PUSH_2 (syntaxspec, syntax_spec_code[c]); + break; + + case 'S': + laststart = b; + PATFETCH (c); + BUF_PUSH_2 (notsyntaxspec, syntax_spec_code[c]); + break; +#endif /* emacs */ + + + case 'w': + if (re_syntax_options & RE_NO_GNU_OPS) + goto normal_char; + laststart = b; + BUF_PUSH (wordchar); + break; + + + case 'W': + if (re_syntax_options & RE_NO_GNU_OPS) + goto normal_char; + laststart = b; + BUF_PUSH (notwordchar); + break; + + + case '<': + if (re_syntax_options & RE_NO_GNU_OPS) + goto normal_char; + BUF_PUSH (wordbeg); + break; + + case '>': + if (re_syntax_options & RE_NO_GNU_OPS) + goto normal_char; + BUF_PUSH (wordend); + break; + + case 'b': + if (re_syntax_options & RE_NO_GNU_OPS) + goto normal_char; + BUF_PUSH (wordbound); + break; + + case 'B': + if (re_syntax_options & RE_NO_GNU_OPS) + goto normal_char; + BUF_PUSH (notwordbound); + break; + + case '`': + if (re_syntax_options & RE_NO_GNU_OPS) + goto normal_char; + BUF_PUSH (begbuf); + break; + + case '\'': + if (re_syntax_options & RE_NO_GNU_OPS) + goto normal_char; + BUF_PUSH (endbuf); + break; + + case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': + if (syntax & RE_NO_BK_REFS) + goto normal_char; + + c1 = c - '0'; + + if (c1 > regnum) + FREE_STACK_RETURN (REG_ESUBREG); + + /* Can't back reference to a subexpression if inside of it. */ + if (group_in_compile_stack (compile_stack, (regnum_t) c1)) + goto normal_char; + + laststart = b; + BUF_PUSH_2 (duplicate, c1); + break; + + + case '+': + case '?': + if (syntax & RE_BK_PLUS_QM) + goto handle_plus; + else + goto normal_backslash; + + default: + normal_backslash: + /* You might think it would be useful for \ to mean + not to translate; but if we don't translate it + it will never match anything. */ + c = TRANSLATE (c); + goto normal_char; + } + break; + + + default: + /* Expects the character in `c'. */ + normal_char: + /* If no exactn currently being built. */ + if (!pending_exact + + /* If last exactn not at current position. */ + || pending_exact + *pending_exact + 1 != b + + /* We have only one byte following the exactn for the count. */ + || *pending_exact == (1 << BYTEWIDTH) - 1 + + /* If followed by a repetition operator. */ + || *p == '*' || *p == '^' + || ((syntax & RE_BK_PLUS_QM) + ? *p == '\\' && (p[1] == '+' || p[1] == '?') + : (*p == '+' || *p == '?')) + || ((syntax & RE_INTERVALS) + && ((syntax & RE_NO_BK_BRACES) + ? *p == '{' + : (p[0] == '\\' && p[1] == '{')))) + { + /* Start building a new exactn. */ + + laststart = b; + + BUF_PUSH_2 (exactn, 0); + pending_exact = b - 1; + } + + BUF_PUSH (c); + (*pending_exact)++; + break; + } /* switch (c) */ + } /* while p != pend */ + + + /* Through the pattern now. */ + + if (fixup_alt_jump) + STORE_JUMP (jump_past_alt, fixup_alt_jump, b); + + if (!COMPILE_STACK_EMPTY) + FREE_STACK_RETURN (REG_EPAREN); + + /* If we don't want backtracking, force success + the first time we reach the end of the compiled pattern. */ + if (syntax & RE_NO_POSIX_BACKTRACKING) + BUF_PUSH (succeed); + + free (compile_stack.stack); /* __MEM_CHECKED__ */ + + /* We have succeeded; set the length of the buffer. */ + bufp->used = b - bufp->buffer; + +#ifdef DEBUG + if (debug) + { + DEBUG_PRINT1 ("\nCompiled pattern: \n"); + print_compiled_pattern (bufp); + } +#endif /* DEBUG */ + +#ifndef MATCH_MAY_ALLOCATE + /* Initialize the failure stack to the largest possible stack. This + isn't necessary unless we're trying to avoid calling alloca in + the search and match routines. */ + { + int num_regs = bufp->re_nsub + 1; + + /* Since DOUBLE_FAIL_STACK refuses to double only if the current size + is strictly greater than re_max_failures, the largest possible stack + is 2 * re_max_failures failure points. */ + if (fail_stack.size < (2 * re_max_failures * MAX_FAILURE_ITEMS)) + { + fail_stack.size = (2 * re_max_failures * MAX_FAILURE_ITEMS); + +#ifdef emacs + if (! fail_stack.stack) + fail_stack.stack + = (fail_stack_elt_t *) xmalloc (fail_stack.size + * sizeof (fail_stack_elt_t)); + else + fail_stack.stack + = (fail_stack_elt_t *) xrealloc (fail_stack.stack, + (fail_stack.size + * sizeof (fail_stack_elt_t))); +#else /* not emacs */ + if (! fail_stack.stack) + fail_stack.stack + = (fail_stack_elt_t *) malloc (fail_stack.size /* __MEM_CHECKED__ */ + * sizeof (fail_stack_elt_t)); + else + fail_stack.stack + = (fail_stack_elt_t *) realloc (fail_stack.stack, /* __MEM_CHECKED__ */ + (fail_stack.size + * sizeof (fail_stack_elt_t))); +#endif /* not emacs */ + } + + regex_grow_registers (num_regs); + } +#endif /* not MATCH_MAY_ALLOCATE */ + + return REG_NOERROR; +} /* regex_compile */ + +/* Subroutines for `regex_compile'. */ + +/* Store OP at LOC followed by two-byte integer parameter ARG. */ + +static void +store_op1 (op, loc, arg) + re_opcode_t op; + unsigned char *loc; + int arg; +{ + *loc = (unsigned char) op; + STORE_NUMBER (loc + 1, arg); +} + + +/* Like `store_op1', but for two two-byte parameters ARG1 and ARG2. */ + +static void +store_op2 (op, loc, arg1, arg2) + re_opcode_t op; + unsigned char *loc; + int arg1, arg2; +{ + *loc = (unsigned char) op; + STORE_NUMBER (loc + 1, arg1); + STORE_NUMBER (loc + 3, arg2); +} + + +/* Copy the bytes from LOC to END to open up three bytes of space at LOC + for OP followed by two-byte integer parameter ARG. */ + +static void +insert_op1 (op, loc, arg, end) + re_opcode_t op; + unsigned char *loc; + int arg; + unsigned char *end; +{ + register unsigned char *pfrom = end; + register unsigned char *pto = end + 3; + + while (pfrom != loc) + *--pto = *--pfrom; + + store_op1 (op, loc, arg); +} + + +/* Like `insert_op1', but for two two-byte parameters ARG1 and ARG2. */ + +static void +insert_op2 (op, loc, arg1, arg2, end) + re_opcode_t op; + unsigned char *loc; + int arg1, arg2; + unsigned char *end; +{ + register unsigned char *pfrom = end; + register unsigned char *pto = end + 5; + + while (pfrom != loc) + *--pto = *--pfrom; + + store_op2 (op, loc, arg1, arg2); +} + + +/* P points to just after a ^ in PATTERN. Return true if that ^ comes + after an alternative or a begin-subexpression. We assume there is at + least one character before the ^. */ + +static boolean +at_begline_loc_p (pattern, p, syntax) + const char *pattern, *p; + reg_syntax_t syntax; +{ + const char *prev = p - 2; + boolean prev_prev_backslash = prev > pattern && prev[-1] == '\\'; + + return + /* After a subexpression? */ + (*prev == '(' && (syntax & RE_NO_BK_PARENS || prev_prev_backslash)) + /* After an alternative? */ + || (*prev == '|' && (syntax & RE_NO_BK_VBAR || prev_prev_backslash)); +} + + +/* The dual of at_begline_loc_p. This one is for $. We assume there is + at least one character after the $, i.e., `P < PEND'. */ + +static boolean +at_endline_loc_p (p, pend, syntax) + const char *p, *pend; + reg_syntax_t syntax; +{ + const char *next = p; + boolean next_backslash = *next == '\\'; + const char *next_next = p + 1 < pend ? p + 1 : 0; + + return + /* Before a subexpression? */ + (syntax & RE_NO_BK_PARENS ? *next == ')' + : next_backslash && next_next && *next_next == ')') + /* Before an alternative? */ + || (syntax & RE_NO_BK_VBAR ? *next == '|' + : next_backslash && next_next && *next_next == '|'); +} + + +/* Returns true if REGNUM is in one of COMPILE_STACK's elements and + false if it's not. */ + +static boolean +group_in_compile_stack (compile_stack, regnum) + compile_stack_type compile_stack; + regnum_t regnum; +{ + int this_element; + + for (this_element = compile_stack.avail - 1; + this_element >= 0; + this_element--) + if (compile_stack.stack[this_element].regnum == regnum) + return true; + + return false; +} + + +/* Read the ending character of a range (in a bracket expression) from the + uncompiled pattern *P_PTR (which ends at PEND). We assume the + starting character is in `P[-2]'. (`P[-1]' is the character `-'.) + Then we set the translation of all bits between the starting and + ending characters (inclusive) in the compiled pattern B. + + Return an error code. + + We use these short variable names so we can use the same macros as + `regex_compile' itself. */ + +static reg_errcode_t +compile_range (p_ptr, pend, translate, syntax, b) + const char **p_ptr, *pend; + RE_TRANSLATE_TYPE translate; + reg_syntax_t syntax; + unsigned char *b; +{ + unsigned this_char; + + const char *p = *p_ptr; + unsigned int range_start, range_end; + + if (p == pend) + return REG_ERANGE; + + /* Even though the pattern is a signed `char *', we need to fetch + with unsigned char *'s; if the high bit of the pattern character + is set, the range endpoints will be negative if we fetch using a + signed char *. + + We also want to fetch the endpoints without translating them; the + appropriate translation is done in the bit-setting loop below. */ + /* The SVR4 compiler on the 3B2 had trouble with unsigned const char *. */ + range_start = ((const unsigned char *) p)[-2]; + range_end = ((const unsigned char *) p)[0]; + + /* Have to increment the pointer into the pattern string, so the + caller isn't still at the ending character. */ + (*p_ptr)++; + + /* If the start is after the end, the range is empty. */ + if (range_start > range_end) + return syntax & RE_NO_EMPTY_RANGES ? REG_ERANGE : REG_NOERROR; + + /* Here we see why `this_char' has to be larger than an `unsigned + char' -- the range is inclusive, so if `range_end' == 0xff + (assuming 8-bit characters), we would otherwise go into an infinite + loop, since all characters <= 0xff. */ + for (this_char = range_start; this_char <= range_end; this_char++) + { + SET_LIST_BIT (TRANSLATE (this_char)); + } + + return REG_NOERROR; +} + +/* re_compile_fastmap computes a ``fastmap'' for the compiled pattern in + BUFP. A fastmap records which of the (1 << BYTEWIDTH) possible + characters can start a string that matches the pattern. This fastmap + is used by re_search to skip quickly over impossible starting points. + + The caller must supply the address of a (1 << BYTEWIDTH)-byte data + area as BUFP->fastmap. + + We set the `fastmap', `fastmap_accurate', and `can_be_null' fields in + the pattern buffer. + + Returns 0 if we succeed, -2 if an internal error. */ + +int +re_compile_fastmap (bufp) + struct re_pattern_buffer *bufp; +{ + int j, k; +#ifdef MATCH_MAY_ALLOCATE + fail_stack_type fail_stack; +#endif +#ifndef REGEX_MALLOC + char *destination; +#endif + /* We don't push any register information onto the failure stack. */ + unsigned num_regs = 0; + + register char *fastmap = bufp->fastmap; + unsigned char *pattern = bufp->buffer; + unsigned char *p = pattern; + register unsigned char *pend = pattern + bufp->used; + +#ifdef REL_ALLOC + /* This holds the pointer to the failure stack, when + it is allocated relocatably. */ + fail_stack_elt_t *failure_stack_ptr; +#endif + + /* Assume that each path through the pattern can be null until + proven otherwise. We set this false at the bottom of switch + statement, to which we get only if a particular path doesn't + match the empty string. */ + boolean path_can_be_null = true; + + /* We aren't doing a `succeed_n' to begin with. */ + boolean succeed_n_p = false; + + assert (fastmap != NULL && p != NULL); + + INIT_FAIL_STACK (); + bzero (fastmap, 1 << BYTEWIDTH); /* Assume nothing's valid. */ + bufp->fastmap_accurate = 1; /* It will be when we're done. */ + bufp->can_be_null = 0; + + while (1) + { + if (p == pend || *p == succeed) + { + /* We have reached the (effective) end of pattern. */ + if (!FAIL_STACK_EMPTY ()) + { + bufp->can_be_null |= path_can_be_null; + + /* Reset for next path. */ + path_can_be_null = true; + + p = fail_stack.stack[--fail_stack.avail].pointer; + + continue; + } + else + break; + } + + /* We should never be about to go beyond the end of the pattern. */ + assert (p < pend); + + switch (SWITCH_ENUM_CAST ((re_opcode_t) *p++)) + { + + /* I guess the idea here is to simply not bother with a fastmap + if a backreference is used, since it's too hard to figure out + the fastmap for the corresponding group. Setting + `can_be_null' stops `re_search_2' from using the fastmap, so + that is all we do. */ + case duplicate: + bufp->can_be_null = 1; + goto done; + + + /* Following are the cases which match a character. These end + with `break'. */ + + case exactn: + fastmap[p[1]] = 1; + break; + + + case charset: + for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--) + if (p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH))) + fastmap[j] = 1; + break; + + + case charset_not: + /* Chars beyond end of map must be allowed. */ + for (j = *p * BYTEWIDTH; j < (1 << BYTEWIDTH); j++) + fastmap[j] = 1; + + for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--) + if (!(p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH)))) + fastmap[j] = 1; + break; + + + case wordchar: + for (j = 0; j < (1 << BYTEWIDTH); j++) + if (SYNTAX (j) == Sword) + fastmap[j] = 1; + break; + + + case notwordchar: + for (j = 0; j < (1 << BYTEWIDTH); j++) + if (SYNTAX (j) != Sword) + fastmap[j] = 1; + break; + + + case anychar: + { + int fastmap_newline = fastmap['\n']; + + /* `.' matches anything ... */ + for (j = 0; j < (1 << BYTEWIDTH); j++) + fastmap[j] = 1; + + /* ... except perhaps newline. */ + if (!(bufp->syntax & RE_DOT_NEWLINE)) + fastmap['\n'] = fastmap_newline; + + /* Return if we have already set `can_be_null'; if we have, + then the fastmap is irrelevant. Something's wrong here. */ + else if (bufp->can_be_null) + goto done; + + /* Otherwise, have to check alternative paths. */ + break; + } + +#ifdef emacs + case syntaxspec: + k = *p++; + for (j = 0; j < (1 << BYTEWIDTH); j++) + if (SYNTAX (j) == (enum syntaxcode) k) + fastmap[j] = 1; + break; + + + case notsyntaxspec: + k = *p++; + for (j = 0; j < (1 << BYTEWIDTH); j++) + if (SYNTAX (j) != (enum syntaxcode) k) + fastmap[j] = 1; + break; + + + /* All cases after this match the empty string. These end with + `continue'. */ + + + case before_dot: + case at_dot: + case after_dot: + continue; +#endif /* emacs */ + + + case no_op: + case begline: + case endline: + case begbuf: + case endbuf: + case wordbound: + case notwordbound: + case wordbeg: + case wordend: + case push_dummy_failure: + continue; + + + case jump_n: + case pop_failure_jump: + case maybe_pop_jump: + case jump: + case jump_past_alt: + case dummy_failure_jump: + EXTRACT_NUMBER_AND_INCR (j, p); + p += j; + if (j > 0) + continue; + + /* Jump backward implies we just went through the body of a + loop and matched nothing. Opcode jumped to should be + `on_failure_jump' or `succeed_n'. Just treat it like an + ordinary jump. For a * loop, it has pushed its failure + point already; if so, discard that as redundant. */ + if ((re_opcode_t) *p != on_failure_jump + && (re_opcode_t) *p != succeed_n) + continue; + + p++; + EXTRACT_NUMBER_AND_INCR (j, p); + p += j; + + /* If what's on the stack is where we are now, pop it. */ + if (!FAIL_STACK_EMPTY () + && fail_stack.stack[fail_stack.avail - 1].pointer == p) + fail_stack.avail--; + + continue; + + + case on_failure_jump: + case on_failure_keep_string_jump: + handle_on_failure_jump: + EXTRACT_NUMBER_AND_INCR (j, p); + + /* For some patterns, e.g., `(a?)?', `p+j' here points to the + end of the pattern. We don't want to push such a point, + since when we restore it above, entering the switch will + increment `p' past the end of the pattern. We don't need + to push such a point since we obviously won't find any more + fastmap entries beyond `pend'. Such a pattern can match + the null string, though. */ + if (p + j < pend) + { + if (!PUSH_PATTERN_OP (p + j, fail_stack)) + { + RESET_FAIL_STACK (); + return -2; + } + } + else + bufp->can_be_null = 1; + + if (succeed_n_p) + { + EXTRACT_NUMBER_AND_INCR (k, p); /* Skip the n. */ + succeed_n_p = false; + } + + continue; + + + case succeed_n: + /* Get to the number of times to succeed. */ + p += 2; + + /* Increment p past the n for when k != 0. */ + EXTRACT_NUMBER_AND_INCR (k, p); + if (k == 0) + { + p -= 4; + succeed_n_p = true; /* Spaghetti code alert. */ + goto handle_on_failure_jump; + } + continue; + + + case set_number_at: + p += 4; + continue; + + + case start_memory: + case stop_memory: + p += 2; + continue; + + + default: + abort (); /* We have listed all the cases. */ + } /* switch *p++ */ + + /* Getting here means we have found the possible starting + characters for one path of the pattern -- and that the empty + string does not match. We need not follow this path further. + Instead, look at the next alternative (remembered on the + stack), or quit if no more. The test at the top of the loop + does these things. */ + path_can_be_null = false; + p = pend; + } /* while p */ + + /* Set `can_be_null' for the last path (also the first path, if the + pattern is empty). */ + bufp->can_be_null |= path_can_be_null; + + done: + RESET_FAIL_STACK (); + return 0; +} /* re_compile_fastmap */ + +/* Set REGS to hold NUM_REGS registers, storing them in STARTS and + ENDS. Subsequent matches using PATTERN_BUFFER and REGS will use + this memory for recording register information. STARTS and ENDS + must be allocated using the malloc library routine, and must each + be at least NUM_REGS * sizeof (regoff_t) bytes long. + + If NUM_REGS == 0, then subsequent matches should allocate their own + register data. + + Unless this function is called, the first search or match using + PATTERN_BUFFER will allocate its own register data, without + freeing the old data. */ + +void +re_set_registers (bufp, regs, num_regs, starts, ends) + struct re_pattern_buffer *bufp; + struct re_registers *regs; + unsigned num_regs; + regoff_t *starts, *ends; +{ + if (num_regs) + { + bufp->regs_allocated = REGS_REALLOCATE; + regs->num_regs = num_regs; + regs->start = starts; + regs->end = ends; + } + else + { + bufp->regs_allocated = REGS_UNALLOCATED; + regs->num_regs = 0; + regs->start = regs->end = (regoff_t *) 0; + } +} + +/* Searching routines. */ + +/* Like re_search_2, below, but only one string is specified, and + doesn't let you say where to stop matching. */ + +int +re_search (bufp, string, size, startpos, range, regs) + struct re_pattern_buffer *bufp; + const char *string; + int size, startpos, range; + struct re_registers *regs; +{ + return re_search_2 (bufp, NULL, 0, string, size, startpos, range, + regs, size); +} + + +/* Using the compiled pattern in BUFP->buffer, first tries to match the + virtual concatenation of STRING1 and STRING2, starting first at index + STARTPOS, then at STARTPOS + 1, and so on. + + STRING1 and STRING2 have length SIZE1 and SIZE2, respectively. + + RANGE is how far to scan while trying to match. RANGE = 0 means try + only at STARTPOS; in general, the last start tried is STARTPOS + + RANGE. + + In REGS, return the indices of the virtual concatenation of STRING1 + and STRING2 that matched the entire BUFP->buffer and its contained + subexpressions. + + Do not consider matching one past the index STOP in the virtual + concatenation of STRING1 and STRING2. + + We return either the position in the strings at which the match was + found, -1 if no match, or -2 if error (such as failure + stack overflow). */ + +int +re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop) + struct re_pattern_buffer *bufp; + const char *string1, *string2; + int size1, size2; + int startpos; + int range; + struct re_registers *regs; + int stop; +{ + int val; + register char *fastmap = bufp->fastmap; + register RE_TRANSLATE_TYPE translate = bufp->translate; + int total_size = size1 + size2; + int endpos = startpos + range; + + /* Check for out-of-range STARTPOS. */ + if (startpos < 0 || startpos > total_size) + return -1; + + /* Fix up RANGE if it might eventually take us outside + the virtual concatenation of STRING1 and STRING2. + Make sure we won't move STARTPOS below 0 or above TOTAL_SIZE. */ + if (endpos < 0) + range = 0 - startpos; + else if (endpos > total_size) + range = total_size - startpos; + + /* If the search isn't to be a backwards one, don't waste time in a + search for a pattern that must be anchored. */ + if (bufp->used > 0 && (re_opcode_t) bufp->buffer[0] == begbuf && range > 0) + { + if (startpos > 0) + return -1; + else + range = 1; + } + +#ifdef emacs + /* In a forward search for something that starts with \=. + don't keep searching past point. */ + if (bufp->used > 0 && (re_opcode_t) bufp->buffer[0] == at_dot && range > 0) + { + range = PT - startpos; + if (range <= 0) + return -1; + } +#endif /* emacs */ + + /* Update the fastmap now if not correct already. */ + if (fastmap && !bufp->fastmap_accurate) + if (re_compile_fastmap (bufp) == -2) + return -2; + + /* Loop through the string, looking for a place to start matching. */ + for (;;) + { + /* If a fastmap is supplied, skip quickly over characters that + cannot be the start of a match. If the pattern can match the + null string, however, we don't need to skip characters; we want + the first null string. */ + if (fastmap && startpos < total_size && !bufp->can_be_null) + { + if (range > 0) /* Searching forwards. */ + { + register const char *d; + register int lim = 0; + int irange = range; + + if (startpos < size1 && startpos + range >= size1) + lim = range - (size1 - startpos); + + d = (startpos >= size1 ? string2 - size1 : string1) + startpos; + + /* Written out as an if-else to avoid testing `translate' + inside the loop. */ + if (translate) + while (range > lim + && !fastmap[(unsigned char) + translate[(unsigned char) *d++]]) + range--; + else + while (range > lim && !fastmap[(unsigned char) *d++]) + range--; + + startpos += irange - range; + } + else /* Searching backwards. */ + { + register char c = (size1 == 0 || startpos >= size1 + ? string2[startpos - size1] + : string1[startpos]); + + if (!fastmap[(unsigned char) TRANSLATE (c)]) + goto advance; + } + } + + /* If can't match the null string, and that's all we have left, fail. */ + if (range >= 0 && startpos == total_size && fastmap + && !bufp->can_be_null) + return -1; + + val = re_match_2_internal (bufp, string1, size1, string2, size2, + startpos, regs, stop); +#ifndef REGEX_MALLOC +#ifdef C_ALLOCA + alloca (0); +#endif +#endif + + if (val >= 0) + return startpos; + + if (val == -2) + return -2; + + advance: + if (!range) + break; + else if (range > 0) + { + range--; + startpos++; + } + else + { + range++; + startpos--; + } + } + return -1; +} /* re_search_2 */ + +/* This converts PTR, a pointer into one of the search strings `string1' + and `string2' into an offset from the beginning of that string. */ +#define POINTER_TO_OFFSET(ptr) \ + (FIRST_STRING_P (ptr) \ + ? ((regoff_t) ((ptr) - string1)) \ + : ((regoff_t) ((ptr) - string2 + size1))) + +/* Macros for dealing with the split strings in re_match_2. */ + +#define MATCHING_IN_FIRST_STRING (dend == end_match_1) + +/* Call before fetching a character with *d. This switches over to + string2 if necessary. */ +#define PREFETCH() \ + while (d == dend) \ + { \ + /* End of string2 => fail. */ \ + if (dend == end_match_2) \ + goto fail; \ + /* End of string1 => advance to string2. */ \ + d = string2; \ + dend = end_match_2; \ + } + + +/* Test if at very beginning or at very end of the virtual concatenation + of `string1' and `string2'. If only one string, it's `string2'. */ +#define AT_STRINGS_BEG(d) ((d) == (size1 ? string1 : string2) || !size2) +#define AT_STRINGS_END(d) ((d) == end2) + + +/* Test if D points to a character which is word-constituent. We have + two special cases to check for: if past the end of string1, look at + the first character in string2; and if before the beginning of + string2, look at the last character in string1. */ +#define WORDCHAR_P(d) \ + (SYNTAX ((d) == end1 ? *string2 \ + : (d) == string2 - 1 ? *(end1 - 1) : *(d)) \ + == Sword) + +/* Disabled due to a compiler bug -- see comment at case wordbound */ +#if 0 +/* Test if the character before D and the one at D differ with respect + to being word-constituent. */ +#define AT_WORD_BOUNDARY(d) \ + (AT_STRINGS_BEG (d) || AT_STRINGS_END (d) \ + || WORDCHAR_P (d - 1) != WORDCHAR_P (d)) +#endif + +/* Free everything we malloc. */ +#ifdef MATCH_MAY_ALLOCATE +#define FREE_VAR(var) if (var) REGEX_FREE (var); var = NULL +#define FREE_VARIABLES() \ + do { \ + REGEX_FREE_STACK (fail_stack.stack); \ + FREE_VAR (regstart); \ + FREE_VAR (regend); \ + FREE_VAR (old_regstart); \ + FREE_VAR (old_regend); \ + FREE_VAR (best_regstart); \ + FREE_VAR (best_regend); \ + FREE_VAR (reg_info); \ + FREE_VAR (reg_dummy); \ + FREE_VAR (reg_info_dummy); \ + } while (0) +#else +#define FREE_VARIABLES() ((void)0) /* Do nothing! But inhibit gcc warning. */ +#endif /* not MATCH_MAY_ALLOCATE */ + +/* These values must meet several constraints. They must not be valid + register values; since we have a limit of 255 registers (because + we use only one byte in the pattern for the register number), we can + use numbers larger than 255. They must differ by 1, because of + NUM_FAILURE_ITEMS above. And the value for the lowest register must + be larger than the value for the highest register, so we do not try + to actually save any registers when none are active. */ +#define NO_HIGHEST_ACTIVE_REG (1 << BYTEWIDTH) +#define NO_LOWEST_ACTIVE_REG (NO_HIGHEST_ACTIVE_REG + 1) + +/* Matching routines. */ + +#ifndef emacs /* Emacs never uses this. */ +/* re_match is like re_match_2 except it takes only a single string. */ + +int +re_match (bufp, string, size, pos, regs) + struct re_pattern_buffer *bufp; + const char *string; + int size, pos; + struct re_registers *regs; +{ + int result = re_match_2_internal (bufp, NULL, 0, string, size, + pos, regs, size); +#ifndef REGEX_MALLOC +#ifdef C_ALLOCA + alloca (0); +#endif +#endif + return result; +} +#endif /* not emacs */ + +static boolean group_match_null_string_p _RE_ARGS ((unsigned char **p, + unsigned char *end, + register_info_type *reg_info)); +static boolean alt_match_null_string_p _RE_ARGS ((unsigned char *p, + unsigned char *end, + register_info_type *reg_info)); +static boolean common_op_match_null_string_p _RE_ARGS ((unsigned char **p, + unsigned char *end, + register_info_type *reg_info)); +static int bcmp_translate _RE_ARGS ((const char *s1, const char *s2, + int len, char *translate)); + +/* re_match_2 matches the compiled pattern in BUFP against the + the (virtual) concatenation of STRING1 and STRING2 (of length SIZE1 + and SIZE2, respectively). We start matching at POS, and stop + matching at STOP. + + If REGS is non-null and the `no_sub' field of BUFP is nonzero, we + store offsets for the substring each group matched in REGS. See the + documentation for exactly how many groups we fill. + + We return -1 if no match, -2 if an internal error (such as the + failure stack overflowing). Otherwise, we return the length of the + matched substring. */ + +int +re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) + struct re_pattern_buffer *bufp; + const char *string1, *string2; + int size1, size2; + int pos; + struct re_registers *regs; + int stop; +{ + int result = re_match_2_internal (bufp, string1, size1, string2, size2, + pos, regs, stop); +#ifndef REGEX_MALLOC +#ifdef C_ALLOCA + alloca (0); +#endif +#endif + return result; +} + +/* This is a separate function so that we can force an alloca cleanup + afterwards. */ +static int +re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) + struct re_pattern_buffer *bufp; + const char *string1, *string2; + int size1, size2; + int pos; + struct re_registers *regs; + int stop; +{ + /* General temporaries. */ + int mcnt; + unsigned char *p1; + + /* Just past the end of the corresponding string. */ + const char *end1, *end2; + + /* Pointers into string1 and string2, just past the last characters in + each to consider matching. */ + const char *end_match_1, *end_match_2; + + /* Where we are in the data, and the end of the current string. */ + const char *d, *dend; + + /* Where we are in the pattern, and the end of the pattern. */ + unsigned char *p = bufp->buffer; + register unsigned char *pend = p + bufp->used; + + /* Mark the opcode just after a start_memory, so we can test for an + empty subpattern when we get to the stop_memory. */ + unsigned char *just_past_start_mem = 0; + + /* We use this to map every character in the string. */ + RE_TRANSLATE_TYPE translate = bufp->translate; + + /* Failure point stack. Each place that can handle a failure further + down the line pushes a failure point on this stack. It consists of + restart, regend, and reg_info for all registers corresponding to + the subexpressions we're currently inside, plus the number of such + registers, and, finally, two char *'s. The first char * is where + to resume scanning the pattern; the second one is where to resume + scanning the strings. If the latter is zero, the failure point is + a ``dummy''; if a failure happens and the failure point is a dummy, + it gets discarded and the next next one is tried. */ +#ifdef MATCH_MAY_ALLOCATE /* otherwise, this is global. */ + fail_stack_type fail_stack; +#endif +#ifdef DEBUG + static unsigned failure_id = 0; + unsigned nfailure_points_pushed = 0, nfailure_points_popped = 0; +#endif + +#ifdef REL_ALLOC + /* This holds the pointer to the failure stack, when + it is allocated relocatably. */ + fail_stack_elt_t *failure_stack_ptr; +#endif + + /* We fill all the registers internally, independent of what we + return, for use in backreferences. The number here includes + an element for register zero. */ + size_t num_regs = bufp->re_nsub + 1; + + /* The currently active registers. */ + active_reg_t lowest_active_reg = NO_LOWEST_ACTIVE_REG; + active_reg_t highest_active_reg = NO_HIGHEST_ACTIVE_REG; + + /* Information on the contents of registers. These are pointers into + the input strings; they record just what was matched (on this + attempt) by a subexpression part of the pattern, that is, the + regnum-th regstart pointer points to where in the pattern we began + matching and the regnum-th regend points to right after where we + stopped matching the regnum-th subexpression. (The zeroth register + keeps track of what the whole pattern matches.) */ +#ifdef MATCH_MAY_ALLOCATE /* otherwise, these are global. */ + const char **regstart, **regend; +#endif + + /* If a group that's operated upon by a repetition operator fails to + match anything, then the register for its start will need to be + restored because it will have been set to wherever in the string we + are when we last see its open-group operator. Similarly for a + register's end. */ +#ifdef MATCH_MAY_ALLOCATE /* otherwise, these are global. */ + const char **old_regstart, **old_regend; +#endif + + /* The is_active field of reg_info helps us keep track of which (possibly + nested) subexpressions we are currently in. The matched_something + field of reg_info[reg_num] helps us tell whether or not we have + matched any of the pattern so far this time through the reg_num-th + subexpression. These two fields get reset each time through any + loop their register is in. */ +#ifdef MATCH_MAY_ALLOCATE /* otherwise, this is global. */ + register_info_type *reg_info; +#endif + + /* The following record the register info as found in the above + variables when we find a match better than any we've seen before. + This happens as we backtrack through the failure points, which in + turn happens only if we have not yet matched the entire string. */ + unsigned best_regs_set = false; +#ifdef MATCH_MAY_ALLOCATE /* otherwise, these are global. */ + const char **best_regstart, **best_regend; +#endif + + /* Logically, this is `best_regend[0]'. But we don't want to have to + allocate space for that if we're not allocating space for anything + else (see below). Also, we never need info about register 0 for + any of the other register vectors, and it seems rather a kludge to + treat `best_regend' differently than the rest. So we keep track of + the end of the best match so far in a separate variable. We + initialize this to NULL so that when we backtrack the first time + and need to test it, it's not garbage. */ + const char *match_end = NULL; + + /* This helps SET_REGS_MATCHED avoid doing redundant work. */ + int set_regs_matched_done = 0; + + /* Used when we pop values we don't care about. */ +#ifdef MATCH_MAY_ALLOCATE /* otherwise, these are global. */ + const char **reg_dummy; + register_info_type *reg_info_dummy; +#endif + +#ifdef DEBUG + /* Counts the total number of registers pushed. */ + unsigned num_regs_pushed = 0; +#endif + + DEBUG_PRINT1 ("\n\nEntering re_match_2.\n"); + + INIT_FAIL_STACK (); + +#ifdef MATCH_MAY_ALLOCATE + /* Do not bother to initialize all the register variables if there are + no groups in the pattern, as it takes a fair amount of time. If + there are groups, we include space for register 0 (the whole + pattern), even though we never use it, since it simplifies the + array indexing. We should fix this. */ + if (bufp->re_nsub) + { + regstart = REGEX_TALLOC (num_regs, const char *); + regend = REGEX_TALLOC (num_regs, const char *); + old_regstart = REGEX_TALLOC (num_regs, const char *); + old_regend = REGEX_TALLOC (num_regs, const char *); + best_regstart = REGEX_TALLOC (num_regs, const char *); + best_regend = REGEX_TALLOC (num_regs, const char *); + reg_info = REGEX_TALLOC (num_regs, register_info_type); + reg_dummy = REGEX_TALLOC (num_regs, const char *); + reg_info_dummy = REGEX_TALLOC (num_regs, register_info_type); + + if (!(regstart && regend && old_regstart && old_regend && reg_info + && best_regstart && best_regend && reg_dummy && reg_info_dummy)) + { + FREE_VARIABLES (); + return -2; + } + } + else + { + /* We must initialize all our variables to NULL, so that + `FREE_VARIABLES' doesn't try to free them. */ + regstart = regend = old_regstart = old_regend = best_regstart + = best_regend = reg_dummy = NULL; + reg_info = reg_info_dummy = (register_info_type *) NULL; + } +#endif /* MATCH_MAY_ALLOCATE */ + + /* The starting position is bogus. */ + if (pos < 0 || pos > size1 + size2) + { + FREE_VARIABLES (); + return -1; + } + + /* Initialize subexpression text positions to -1 to mark ones that no + start_memory/stop_memory has been seen for. Also initialize the + register information struct. */ + for (mcnt = 1; (unsigned) mcnt < num_regs; mcnt++) + { + regstart[mcnt] = regend[mcnt] + = old_regstart[mcnt] = old_regend[mcnt] = REG_UNSET_VALUE; + + REG_MATCH_NULL_STRING_P (reg_info[mcnt]) = MATCH_NULL_UNSET_VALUE; + IS_ACTIVE (reg_info[mcnt]) = 0; + MATCHED_SOMETHING (reg_info[mcnt]) = 0; + EVER_MATCHED_SOMETHING (reg_info[mcnt]) = 0; + } + + /* We move `string1' into `string2' if the latter's empty -- but not if + `string1' is null. */ + if (size2 == 0 && string1 != NULL) + { + string2 = string1; + size2 = size1; + string1 = 0; + size1 = 0; + } + end1 = string1 + size1; + end2 = string2 + size2; + + /* Compute where to stop matching, within the two strings. */ + if (stop <= size1) + { + end_match_1 = string1 + stop; + end_match_2 = string2; + } + else + { + end_match_1 = end1; + end_match_2 = string2 + stop - size1; + } + + /* `p' scans through the pattern as `d' scans through the data. + `dend' is the end of the input string that `d' points within. `d' + is advanced into the following input string whenever necessary, but + this happens before fetching; therefore, at the beginning of the + loop, `d' can be pointing at the end of a string, but it cannot + equal `string2'. */ + if (size1 > 0 && pos <= size1) + { + d = string1 + pos; + dend = end_match_1; + } + else + { + d = string2 + pos - size1; + dend = end_match_2; + } + + DEBUG_PRINT1 ("The compiled pattern is:\n"); + DEBUG_PRINT_COMPILED_PATTERN (bufp, p, pend); + DEBUG_PRINT1 ("The string to match is: `"); + DEBUG_PRINT_DOUBLE_STRING (d, string1, size1, string2, size2); + DEBUG_PRINT1 ("'\n"); + + /* This loops over pattern commands. It exits by returning from the + function if the match is complete, or it drops through if the match + fails at this starting point in the input data. */ + for (;;) + { +#ifdef _LIBC + DEBUG_PRINT2 ("\n%p: ", p); +#else + DEBUG_PRINT2 ("\n0x%x: ", p); +#endif + + if (p == pend) + { /* End of pattern means we might have succeeded. */ + DEBUG_PRINT1 ("end of pattern ... "); + + /* If we haven't matched the entire string, and we want the + longest match, try backtracking. */ + if (d != end_match_2) + { + /* 1 if this match ends in the same string (string1 or string2) + as the best previous match. */ + boolean same_str_p = (FIRST_STRING_P (match_end) + == MATCHING_IN_FIRST_STRING); + /* 1 if this match is the best seen so far. */ + boolean best_match_p; + + /* AIX compiler got confused when this was combined + with the previous declaration. */ + if (same_str_p) + best_match_p = d > match_end; + else + best_match_p = !MATCHING_IN_FIRST_STRING; + + DEBUG_PRINT1 ("backtracking.\n"); + + if (!FAIL_STACK_EMPTY ()) + { /* More failure points to try. */ + + /* If exceeds best match so far, save it. */ + if (!best_regs_set || best_match_p) + { + best_regs_set = true; + match_end = d; + + DEBUG_PRINT1 ("\nSAVING match as best so far.\n"); + + for (mcnt = 1; (unsigned) mcnt < num_regs; mcnt++) + { + best_regstart[mcnt] = regstart[mcnt]; + best_regend[mcnt] = regend[mcnt]; + } + } + goto fail; + } + + /* If no failure points, don't restore garbage. And if + last match is real best match, don't restore second + best one. */ + else if (best_regs_set && !best_match_p) + { + restore_best_regs: + /* Restore best match. It may happen that `dend == + end_match_1' while the restored d is in string2. + For example, the pattern `x.*y.*z' against the + strings `x-' and `y-z-', if the two strings are + not consecutive in memory. */ + DEBUG_PRINT1 ("Restoring best registers.\n"); + + d = match_end; + dend = ((d >= string1 && d <= end1) + ? end_match_1 : end_match_2); + + for (mcnt = 1; (unsigned) mcnt < num_regs; mcnt++) + { + regstart[mcnt] = best_regstart[mcnt]; + regend[mcnt] = best_regend[mcnt]; + } + } + } /* d != end_match_2 */ + + succeed_label: + DEBUG_PRINT1 ("Accepting match.\n"); + + /* If caller wants register contents data back, do it. */ + if (regs && !bufp->no_sub) + { + /* Have the register data arrays been allocated? */ + if (bufp->regs_allocated == REGS_UNALLOCATED) + { /* No. So allocate them with malloc. We need one + extra element beyond `num_regs' for the `-1' marker + GNU code uses. */ + regs->num_regs = MAX (RE_NREGS, num_regs + 1); + regs->start = TALLOC (regs->num_regs, regoff_t); + regs->end = TALLOC (regs->num_regs, regoff_t); + if (regs->start == NULL || regs->end == NULL) + { + FREE_VARIABLES (); + return -2; + } + bufp->regs_allocated = REGS_REALLOCATE; + } + else if (bufp->regs_allocated == REGS_REALLOCATE) + { /* Yes. If we need more elements than were already + allocated, reallocate them. If we need fewer, just + leave it alone. */ + if (regs->num_regs < num_regs + 1) + { + regs->num_regs = num_regs + 1; + RETALLOC (regs->start, regs->num_regs, regoff_t); + RETALLOC (regs->end, regs->num_regs, regoff_t); + if (regs->start == NULL || regs->end == NULL) + { + FREE_VARIABLES (); + return -2; + } + } + } + else + { + /* These braces fend off a "empty body in an else-statement" + warning under GCC when assert expands to nothing. */ + assert (bufp->regs_allocated == REGS_FIXED); + } + + /* Convert the pointer data in `regstart' and `regend' to + indices. Register zero has to be set differently, + since we haven't kept track of any info for it. */ + if (regs->num_regs > 0) + { + regs->start[0] = pos; + regs->end[0] = (MATCHING_IN_FIRST_STRING + ? ((regoff_t) (d - string1)) + : ((regoff_t) (d - string2 + size1))); + } + + /* Go through the first `min (num_regs, regs->num_regs)' + registers, since that is all we initialized. */ + for (mcnt = 1; (unsigned) mcnt < MIN (num_regs, regs->num_regs); + mcnt++) + { + if (REG_UNSET (regstart[mcnt]) || REG_UNSET (regend[mcnt])) + regs->start[mcnt] = regs->end[mcnt] = -1; + else + { + regs->start[mcnt] + = (regoff_t) POINTER_TO_OFFSET (regstart[mcnt]); + regs->end[mcnt] + = (regoff_t) POINTER_TO_OFFSET (regend[mcnt]); + } + } + + /* If the regs structure we return has more elements than + were in the pattern, set the extra elements to -1. If + we (re)allocated the registers, this is the case, + because we always allocate enough to have at least one + -1 at the end. */ + for (mcnt = num_regs; (unsigned) mcnt < regs->num_regs; mcnt++) + regs->start[mcnt] = regs->end[mcnt] = -1; + } /* regs && !bufp->no_sub */ + + DEBUG_PRINT4 ("%u failure points pushed, %u popped (%u remain).\n", + nfailure_points_pushed, nfailure_points_popped, + nfailure_points_pushed - nfailure_points_popped); + DEBUG_PRINT2 ("%u registers pushed.\n", num_regs_pushed); + + mcnt = d - pos - (MATCHING_IN_FIRST_STRING + ? string1 + : string2 - size1); + + DEBUG_PRINT2 ("Returning %d from re_match_2.\n", mcnt); + + FREE_VARIABLES (); + return mcnt; + } + + /* Otherwise match next pattern command. */ + switch (SWITCH_ENUM_CAST ((re_opcode_t) *p++)) + { + /* Ignore these. Used to ignore the n of succeed_n's which + currently have n == 0. */ + case no_op: + DEBUG_PRINT1 ("EXECUTING no_op.\n"); + break; + + case succeed: + DEBUG_PRINT1 ("EXECUTING succeed.\n"); + goto succeed_label; + + /* Match the next n pattern characters exactly. The following + byte in the pattern defines n, and the n bytes after that + are the characters to match. */ + case exactn: + mcnt = *p++; + DEBUG_PRINT2 ("EXECUTING exactn %d.\n", mcnt); + + /* This is written out as an if-else so we don't waste time + testing `translate' inside the loop. */ + if (translate) + { + do + { + PREFETCH (); + if ((unsigned char) translate[(unsigned char) *d++] + != (unsigned char) *p++) + goto fail; + } + while (--mcnt); + } + else + { + do + { + PREFETCH (); + if (*d++ != (char) *p++) goto fail; + } + while (--mcnt); + } + SET_REGS_MATCHED (); + break; + + + /* Match any character except possibly a newline or a null. */ + case anychar: + DEBUG_PRINT1 ("EXECUTING anychar.\n"); + + PREFETCH (); + + if ((!(bufp->syntax & RE_DOT_NEWLINE) && TRANSLATE (*d) == '\n') + || (bufp->syntax & RE_DOT_NOT_NULL && TRANSLATE (*d) == '\000')) + goto fail; + + SET_REGS_MATCHED (); + DEBUG_PRINT2 (" Matched `%d'.\n", *d); + d++; + break; + + + case charset: + case charset_not: + { + register unsigned char c; + boolean not = (re_opcode_t) *(p - 1) == charset_not; + + DEBUG_PRINT2 ("EXECUTING charset%s.\n", not ? "_not" : ""); + + PREFETCH (); + c = TRANSLATE (*d); /* The character to match. */ + + /* Cast to `unsigned' instead of `unsigned char' in case the + bit list is a full 32 bytes long. */ + if (c < (unsigned) (*p * BYTEWIDTH) + && p[1 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH))) + not = !not; + + p += 1 + *p; + + if (!not) goto fail; + + SET_REGS_MATCHED (); + d++; + break; + } + + + /* The beginning of a group is represented by start_memory. + The arguments are the register number in the next byte, and the + number of groups inner to this one in the next. The text + matched within the group is recorded (in the internal + registers data structure) under the register number. */ + case start_memory: + DEBUG_PRINT3 ("EXECUTING start_memory %d (%d):\n", *p, p[1]); + + /* Find out if this group can match the empty string. */ + p1 = p; /* To send to group_match_null_string_p. */ + + if (REG_MATCH_NULL_STRING_P (reg_info[*p]) == MATCH_NULL_UNSET_VALUE) + REG_MATCH_NULL_STRING_P (reg_info[*p]) + = group_match_null_string_p (&p1, pend, reg_info); + + /* Save the position in the string where we were the last time + we were at this open-group operator in case the group is + operated upon by a repetition operator, e.g., with `(a*)*b' + against `ab'; then we want to ignore where we are now in + the string in case this attempt to match fails. */ + old_regstart[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p]) + ? REG_UNSET (regstart[*p]) ? d : regstart[*p] + : regstart[*p]; + DEBUG_PRINT2 (" old_regstart: %d\n", + POINTER_TO_OFFSET (old_regstart[*p])); + + regstart[*p] = d; + DEBUG_PRINT2 (" regstart: %d\n", POINTER_TO_OFFSET (regstart[*p])); + + IS_ACTIVE (reg_info[*p]) = 1; + MATCHED_SOMETHING (reg_info[*p]) = 0; + + /* Clear this whenever we change the register activity status. */ + set_regs_matched_done = 0; + + /* This is the new highest active register. */ + highest_active_reg = *p; + + /* If nothing was active before, this is the new lowest active + register. */ + if (lowest_active_reg == NO_LOWEST_ACTIVE_REG) + lowest_active_reg = *p; + + /* Move past the register number and inner group count. */ + p += 2; + just_past_start_mem = p; + + break; + + + /* The stop_memory opcode represents the end of a group. Its + arguments are the same as start_memory's: the register + number, and the number of inner groups. */ + case stop_memory: + DEBUG_PRINT3 ("EXECUTING stop_memory %d (%d):\n", *p, p[1]); + + /* We need to save the string position the last time we were at + this close-group operator in case the group is operated + upon by a repetition operator, e.g., with `((a*)*(b*)*)*' + against `aba'; then we want to ignore where we are now in + the string in case this attempt to match fails. */ + old_regend[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p]) + ? REG_UNSET (regend[*p]) ? d : regend[*p] + : regend[*p]; + DEBUG_PRINT2 (" old_regend: %d\n", + POINTER_TO_OFFSET (old_regend[*p])); + + regend[*p] = d; + DEBUG_PRINT2 (" regend: %d\n", POINTER_TO_OFFSET (regend[*p])); + + /* This register isn't active anymore. */ + IS_ACTIVE (reg_info[*p]) = 0; + + /* Clear this whenever we change the register activity status. */ + set_regs_matched_done = 0; + + /* If this was the only register active, nothing is active + anymore. */ + if (lowest_active_reg == highest_active_reg) + { + lowest_active_reg = NO_LOWEST_ACTIVE_REG; + highest_active_reg = NO_HIGHEST_ACTIVE_REG; + } + else + { /* We must scan for the new highest active register, since + it isn't necessarily one less than now: consider + (a(b)c(d(e)f)g). When group 3 ends, after the f), the + new highest active register is 1. */ + unsigned char r = *p - 1; + while (r > 0 && !IS_ACTIVE (reg_info[r])) + r--; + + /* If we end up at register zero, that means that we saved + the registers as the result of an `on_failure_jump', not + a `start_memory', and we jumped to past the innermost + `stop_memory'. For example, in ((.)*) we save + registers 1 and 2 as a result of the *, but when we pop + back to the second ), we are at the stop_memory 1. + Thus, nothing is active. */ + if (r == 0) + { + lowest_active_reg = NO_LOWEST_ACTIVE_REG; + highest_active_reg = NO_HIGHEST_ACTIVE_REG; + } + else + highest_active_reg = r; + } + + /* If just failed to match something this time around with a + group that's operated on by a repetition operator, try to + force exit from the ``loop'', and restore the register + information for this group that we had before trying this + last match. */ + if ((!MATCHED_SOMETHING (reg_info[*p]) + || just_past_start_mem == p - 1) + && (p + 2) < pend) + { + boolean is_a_jump_n = false; + + p1 = p + 2; + mcnt = 0; + switch ((re_opcode_t) *p1++) + { + case jump_n: + is_a_jump_n = true; + case pop_failure_jump: + case maybe_pop_jump: + case jump: + case dummy_failure_jump: + EXTRACT_NUMBER_AND_INCR (mcnt, p1); + if (is_a_jump_n) + p1 += 2; + break; + + default: + /* do nothing */ ; + } + p1 += mcnt; + + /* If the next operation is a jump backwards in the pattern + to an on_failure_jump right before the start_memory + corresponding to this stop_memory, exit from the loop + by forcing a failure after pushing on the stack the + on_failure_jump's jump in the pattern, and d. */ + if (mcnt < 0 && (re_opcode_t) *p1 == on_failure_jump + && (re_opcode_t) p1[3] == start_memory && p1[4] == *p) + { + /* If this group ever matched anything, then restore + what its registers were before trying this last + failed match, e.g., with `(a*)*b' against `ab' for + regstart[1], and, e.g., with `((a*)*(b*)*)*' + against `aba' for regend[3]. + + Also restore the registers for inner groups for, + e.g., `((a*)(b*))*' against `aba' (register 3 would + otherwise get trashed). */ + + if (EVER_MATCHED_SOMETHING (reg_info[*p])) + { + unsigned r; + + EVER_MATCHED_SOMETHING (reg_info[*p]) = 0; + + /* Restore this and inner groups' (if any) registers. */ + for (r = *p; r < (unsigned) *p + (unsigned) *(p + 1); + r++) + { + regstart[r] = old_regstart[r]; + + /* xx why this test? */ + if (old_regend[r] >= regstart[r]) + regend[r] = old_regend[r]; + } + } + p1++; + EXTRACT_NUMBER_AND_INCR (mcnt, p1); + PUSH_FAILURE_POINT (p1 + mcnt, d, -2); + + goto fail; + } + } + + /* Move past the register number and the inner group count. */ + p += 2; + break; + + + /* \ has been turned into a `duplicate' command which is + followed by the numeric value of as the register number. */ + case duplicate: + { + register const char *d2, *dend2; + int regno = *p++; /* Get which register to match against. */ + DEBUG_PRINT2 ("EXECUTING duplicate %d.\n", regno); + + /* Can't back reference a group which we've never matched. */ + if (REG_UNSET (regstart[regno]) || REG_UNSET (regend[regno])) + goto fail; + + /* Where in input to try to start matching. */ + d2 = regstart[regno]; + + /* Where to stop matching; if both the place to start and + the place to stop matching are in the same string, then + set to the place to stop, otherwise, for now have to use + the end of the first string. */ + + dend2 = ((FIRST_STRING_P (regstart[regno]) + == FIRST_STRING_P (regend[regno])) + ? regend[regno] : end_match_1); + for (;;) + { + /* If necessary, advance to next segment in register + contents. */ + while (d2 == dend2) + { + if (dend2 == end_match_2) break; + if (dend2 == regend[regno]) break; + + /* End of string1 => advance to string2. */ + d2 = string2; + dend2 = regend[regno]; + } + /* At end of register contents => success */ + if (d2 == dend2) break; + + /* If necessary, advance to next segment in data. */ + PREFETCH (); + + /* How many characters left in this segment to match. */ + mcnt = dend - d; + + /* Want how many consecutive characters we can match in + one shot, so, if necessary, adjust the count. */ + if (mcnt > dend2 - d2) + mcnt = dend2 - d2; + + /* Compare that many; failure if mismatch, else move + past them. */ + if (translate + ? bcmp_translate (d, d2, mcnt, translate) + : bcmp (d, d2, mcnt)) + goto fail; + d += mcnt, d2 += mcnt; + + /* Do this because we've match some characters. */ + SET_REGS_MATCHED (); + } + } + break; + + + /* begline matches the empty string at the beginning of the string + (unless `not_bol' is set in `bufp'), and, if + `newline_anchor' is set, after newlines. */ + case begline: + DEBUG_PRINT1 ("EXECUTING begline.\n"); + + if (AT_STRINGS_BEG (d)) + { + if (!bufp->not_bol) break; + } + else if (d[-1] == '\n' && bufp->newline_anchor) + { + break; + } + /* In all other cases, we fail. */ + goto fail; + + + /* endline is the dual of begline. */ + case endline: + DEBUG_PRINT1 ("EXECUTING endline.\n"); + + if (AT_STRINGS_END (d)) + { + if (!bufp->not_eol) break; + } + + /* We have to ``prefetch'' the next character. */ + else if ((d == end1 ? *string2 : *d) == '\n' + && bufp->newline_anchor) + { + break; + } + goto fail; + + + /* Match at the very beginning of the data. */ + case begbuf: + DEBUG_PRINT1 ("EXECUTING begbuf.\n"); + if (AT_STRINGS_BEG (d)) + break; + goto fail; + + + /* Match at the very end of the data. */ + case endbuf: + DEBUG_PRINT1 ("EXECUTING endbuf.\n"); + if (AT_STRINGS_END (d)) + break; + goto fail; + + + /* on_failure_keep_string_jump is used to optimize `.*\n'. It + pushes NULL as the value for the string on the stack. Then + `pop_failure_point' will keep the current value for the + string, instead of restoring it. To see why, consider + matching `foo\nbar' against `.*\n'. The .* matches the foo; + then the . fails against the \n. But the next thing we want + to do is match the \n against the \n; if we restored the + string value, we would be back at the foo. + + Because this is used only in specific cases, we don't need to + check all the things that `on_failure_jump' does, to make + sure the right things get saved on the stack. Hence we don't + share its code. The only reason to push anything on the + stack at all is that otherwise we would have to change + `anychar's code to do something besides goto fail in this + case; that seems worse than this. */ + case on_failure_keep_string_jump: + DEBUG_PRINT1 ("EXECUTING on_failure_keep_string_jump"); + + EXTRACT_NUMBER_AND_INCR (mcnt, p); +#ifdef _LIBC + DEBUG_PRINT3 (" %d (to %p):\n", mcnt, p + mcnt); +#else + DEBUG_PRINT3 (" %d (to 0x%x):\n", mcnt, p + mcnt); +#endif + + PUSH_FAILURE_POINT (p + mcnt, NULL, -2); + break; + + + /* Uses of on_failure_jump: + + Each alternative starts with an on_failure_jump that points + to the beginning of the next alternative. Each alternative + except the last ends with a jump that in effect jumps past + the rest of the alternatives. (They really jump to the + ending jump of the following alternative, because tensioning + these jumps is a hassle.) + + Repeats start with an on_failure_jump that points past both + the repetition text and either the following jump or + pop_failure_jump back to this on_failure_jump. */ + case on_failure_jump: + on_failure: + DEBUG_PRINT1 ("EXECUTING on_failure_jump"); + + EXTRACT_NUMBER_AND_INCR (mcnt, p); +#ifdef _LIBC + DEBUG_PRINT3 (" %d (to %p)", mcnt, p + mcnt); +#else + DEBUG_PRINT3 (" %d (to 0x%x)", mcnt, p + mcnt); +#endif + + /* If this on_failure_jump comes right before a group (i.e., + the original * applied to a group), save the information + for that group and all inner ones, so that if we fail back + to this point, the group's information will be correct. + For example, in \(a*\)*\1, we need the preceding group, + and in \(zz\(a*\)b*\)\2, we need the inner group. */ + + /* We can't use `p' to check ahead because we push + a failure point to `p + mcnt' after we do this. */ + p1 = p; + + /* We need to skip no_op's before we look for the + start_memory in case this on_failure_jump is happening as + the result of a completed succeed_n, as in \(a\)\{1,3\}b\1 + against aba. */ + while (p1 < pend && (re_opcode_t) *p1 == no_op) + p1++; + + if (p1 < pend && (re_opcode_t) *p1 == start_memory) + { + /* We have a new highest active register now. This will + get reset at the start_memory we are about to get to, + but we will have saved all the registers relevant to + this repetition op, as described above. */ + highest_active_reg = *(p1 + 1) + *(p1 + 2); + if (lowest_active_reg == NO_LOWEST_ACTIVE_REG) + lowest_active_reg = *(p1 + 1); + } + + DEBUG_PRINT1 (":\n"); + PUSH_FAILURE_POINT (p + mcnt, d, -2); + break; + + + /* A smart repeat ends with `maybe_pop_jump'. + We change it to either `pop_failure_jump' or `jump'. */ + case maybe_pop_jump: + EXTRACT_NUMBER_AND_INCR (mcnt, p); + DEBUG_PRINT2 ("EXECUTING maybe_pop_jump %d.\n", mcnt); + { + register unsigned char *p2 = p; + + /* Compare the beginning of the repeat with what in the + pattern follows its end. If we can establish that there + is nothing that they would both match, i.e., that we + would have to backtrack because of (as in, e.g., `a*a') + then we can change to pop_failure_jump, because we'll + never have to backtrack. + + This is not true in the case of alternatives: in + `(a|ab)*' we do need to backtrack to the `ab' alternative + (e.g., if the string was `ab'). But instead of trying to + detect that here, the alternative has put on a dummy + failure point which is what we will end up popping. */ + + /* Skip over open/close-group commands. + If what follows this loop is a ...+ construct, + look at what begins its body, since we will have to + match at least one of that. */ + while (1) + { + if (p2 + 2 < pend + && ((re_opcode_t) *p2 == stop_memory + || (re_opcode_t) *p2 == start_memory)) + p2 += 3; + else if (p2 + 6 < pend + && (re_opcode_t) *p2 == dummy_failure_jump) + p2 += 6; + else + break; + } + + p1 = p + mcnt; + /* p1[0] ... p1[2] are the `on_failure_jump' corresponding + to the `maybe_finalize_jump' of this case. Examine what + follows. */ + + /* If we're at the end of the pattern, we can change. */ + if (p2 == pend) + { + /* Consider what happens when matching ":\(.*\)" + against ":/". I don't really understand this code + yet. */ + p[-3] = (unsigned char) pop_failure_jump; + DEBUG_PRINT1 + (" End of pattern: change to `pop_failure_jump'.\n"); + } + + else if ((re_opcode_t) *p2 == exactn + || (bufp->newline_anchor && (re_opcode_t) *p2 == endline)) + { + register unsigned char c + = *p2 == (unsigned char) endline ? '\n' : p2[2]; + + if ((re_opcode_t) p1[3] == exactn && p1[5] != c) + { + p[-3] = (unsigned char) pop_failure_jump; + DEBUG_PRINT3 (" %c != %c => pop_failure_jump.\n", + c, p1[5]); + } + + else if ((re_opcode_t) p1[3] == charset + || (re_opcode_t) p1[3] == charset_not) + { + int not = (re_opcode_t) p1[3] == charset_not; + + if (c < (unsigned char) (p1[4] * BYTEWIDTH) + && p1[5 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH))) + not = !not; + + /* `not' is equal to 1 if c would match, which means + that we can't change to pop_failure_jump. */ + if (!not) + { + p[-3] = (unsigned char) pop_failure_jump; + DEBUG_PRINT1 (" No match => pop_failure_jump.\n"); + } + } + } + else if ((re_opcode_t) *p2 == charset) + { +#ifdef DEBUG + register unsigned char c + = *p2 == (unsigned char) endline ? '\n' : p2[2]; +#endif + +#if 0 + if ((re_opcode_t) p1[3] == exactn + && ! ((int) p2[1] * BYTEWIDTH > (int) p1[5] + && (p2[2 + p1[5] / BYTEWIDTH] + & (1 << (p1[5] % BYTEWIDTH))))) +#else + if ((re_opcode_t) p1[3] == exactn + && ! ((int) p2[1] * BYTEWIDTH > (int) p1[4] + && (p2[2 + p1[4] / BYTEWIDTH] + & (1 << (p1[4] % BYTEWIDTH))))) +#endif + { + p[-3] = (unsigned char) pop_failure_jump; + DEBUG_PRINT3 (" %c != %c => pop_failure_jump.\n", + c, p1[5]); + } + + else if ((re_opcode_t) p1[3] == charset_not) + { + int idx; + /* We win if the charset_not inside the loop + lists every character listed in the charset after. */ + for (idx = 0; idx < (int) p2[1]; idx++) + if (! (p2[2 + idx] == 0 + || (idx < (int) p1[4] + && ((p2[2 + idx] & ~ p1[5 + idx]) == 0)))) + break; + + if (idx == p2[1]) + { + p[-3] = (unsigned char) pop_failure_jump; + DEBUG_PRINT1 (" No match => pop_failure_jump.\n"); + } + } + else if ((re_opcode_t) p1[3] == charset) + { + int idx; + /* We win if the charset inside the loop + has no overlap with the one after the loop. */ + for (idx = 0; + idx < (int) p2[1] && idx < (int) p1[4]; + idx++) + if ((p2[2 + idx] & p1[5 + idx]) != 0) + break; + + if (idx == p2[1] || idx == p1[4]) + { + p[-3] = (unsigned char) pop_failure_jump; + DEBUG_PRINT1 (" No match => pop_failure_jump.\n"); + } + } + } + } + p -= 2; /* Point at relative address again. */ + if ((re_opcode_t) p[-1] != pop_failure_jump) + { + p[-1] = (unsigned char) jump; + DEBUG_PRINT1 (" Match => jump.\n"); + goto unconditional_jump; + } + /* Note fall through. */ + + + /* The end of a simple repeat has a pop_failure_jump back to + its matching on_failure_jump, where the latter will push a + failure point. The pop_failure_jump takes off failure + points put on by this pop_failure_jump's matching + on_failure_jump; we got through the pattern to here from the + matching on_failure_jump, so didn't fail. */ + case pop_failure_jump: + { + /* We need to pass separate storage for the lowest and + highest registers, even though we don't care about the + actual values. Otherwise, we will restore only one + register from the stack, since lowest will == highest in + `pop_failure_point'. */ + active_reg_t dummy_low_reg, dummy_high_reg; + unsigned char *pdummy; + const char *sdummy; + + DEBUG_PRINT1 ("EXECUTING pop_failure_jump.\n"); + POP_FAILURE_POINT (sdummy, pdummy, + dummy_low_reg, dummy_high_reg, + reg_dummy, reg_dummy, reg_info_dummy); + } + /* Note fall through. */ + + unconditional_jump: +#ifdef _LIBC + DEBUG_PRINT2 ("\n%p: ", p); +#else + DEBUG_PRINT2 ("\n0x%x: ", p); +#endif + /* Note fall through. */ + + /* Unconditionally jump (without popping any failure points). */ + case jump: + EXTRACT_NUMBER_AND_INCR (mcnt, p); /* Get the amount to jump. */ + DEBUG_PRINT2 ("EXECUTING jump %d ", mcnt); + p += mcnt; /* Do the jump. */ +#ifdef _LIBC + DEBUG_PRINT2 ("(to %p).\n", p); +#else + DEBUG_PRINT2 ("(to 0x%x).\n", p); +#endif + break; + + + /* We need this opcode so we can detect where alternatives end + in `group_match_null_string_p' et al. */ + case jump_past_alt: + DEBUG_PRINT1 ("EXECUTING jump_past_alt.\n"); + goto unconditional_jump; + + + /* Normally, the on_failure_jump pushes a failure point, which + then gets popped at pop_failure_jump. We will end up at + pop_failure_jump, also, and with a pattern of, say, `a+', we + are skipping over the on_failure_jump, so we have to push + something meaningless for pop_failure_jump to pop. */ + case dummy_failure_jump: + DEBUG_PRINT1 ("EXECUTING dummy_failure_jump.\n"); + /* It doesn't matter what we push for the string here. What + the code at `fail' tests is the value for the pattern. */ + PUSH_FAILURE_POINT (0, 0, -2); + goto unconditional_jump; + + + /* At the end of an alternative, we need to push a dummy failure + point in case we are followed by a `pop_failure_jump', because + we don't want the failure point for the alternative to be + popped. For example, matching `(a|ab)*' against `aab' + requires that we match the `ab' alternative. */ + case push_dummy_failure: + DEBUG_PRINT1 ("EXECUTING push_dummy_failure.\n"); + /* See comments just above at `dummy_failure_jump' about the + two zeroes. */ + PUSH_FAILURE_POINT (0, 0, -2); + break; + + /* Have to succeed matching what follows at least n times. + After that, handle like `on_failure_jump'. */ + case succeed_n: + EXTRACT_NUMBER (mcnt, p + 2); + DEBUG_PRINT2 ("EXECUTING succeed_n %d.\n", mcnt); + + assert (mcnt >= 0); + /* Originally, this is how many times we HAVE to succeed. */ + if (mcnt > 0) + { + mcnt--; + p += 2; + STORE_NUMBER_AND_INCR (p, mcnt); +#ifdef _LIBC + DEBUG_PRINT3 (" Setting %p to %d.\n", p - 2, mcnt); +#else + DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p - 2, mcnt); +#endif + } + else if (mcnt == 0) + { +#ifdef _LIBC + DEBUG_PRINT2 (" Setting two bytes from %p to no_op.\n", p+2); +#else + DEBUG_PRINT2 (" Setting two bytes from 0x%x to no_op.\n", p+2); +#endif + p[2] = (unsigned char) no_op; + p[3] = (unsigned char) no_op; + goto on_failure; + } + break; + + case jump_n: + EXTRACT_NUMBER (mcnt, p + 2); + DEBUG_PRINT2 ("EXECUTING jump_n %d.\n", mcnt); + + /* Originally, this is how many times we CAN jump. */ + if (mcnt) + { + mcnt--; + STORE_NUMBER (p + 2, mcnt); +#ifdef _LIBC + DEBUG_PRINT3 (" Setting %p to %d.\n", p + 2, mcnt); +#else + DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p + 2, mcnt); +#endif + goto unconditional_jump; + } + /* If don't have to jump any more, skip over the rest of command. */ + else + p += 4; + break; + + case set_number_at: + { + DEBUG_PRINT1 ("EXECUTING set_number_at.\n"); + + EXTRACT_NUMBER_AND_INCR (mcnt, p); + p1 = p + mcnt; + EXTRACT_NUMBER_AND_INCR (mcnt, p); +#ifdef _LIBC + DEBUG_PRINT3 (" Setting %p to %d.\n", p1, mcnt); +#else + DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p1, mcnt); +#endif + STORE_NUMBER (p1, mcnt); + break; + } + +#if 0 + /* The DEC Alpha C compiler 3.x generates incorrect code for the + test WORDCHAR_P (d - 1) != WORDCHAR_P (d) in the expansion of + AT_WORD_BOUNDARY, so this code is disabled. Expanding the + macro and introducing temporary variables works around the bug. */ + + case wordbound: + DEBUG_PRINT1 ("EXECUTING wordbound.\n"); + if (AT_WORD_BOUNDARY (d)) + break; + goto fail; + + case notwordbound: + DEBUG_PRINT1 ("EXECUTING notwordbound.\n"); + if (AT_WORD_BOUNDARY (d)) + goto fail; + break; +#else + case wordbound: + { + boolean prevchar, thischar; + + DEBUG_PRINT1 ("EXECUTING wordbound.\n"); + if (AT_STRINGS_BEG (d) || AT_STRINGS_END (d)) + break; + + prevchar = WORDCHAR_P (d - 1); + thischar = WORDCHAR_P (d); + if (prevchar != thischar) + break; + goto fail; + } + + case notwordbound: + { + boolean prevchar, thischar; + + DEBUG_PRINT1 ("EXECUTING notwordbound.\n"); + if (AT_STRINGS_BEG (d) || AT_STRINGS_END (d)) + goto fail; + + prevchar = WORDCHAR_P (d - 1); + thischar = WORDCHAR_P (d); + if (prevchar != thischar) + goto fail; + break; + } +#endif + + case wordbeg: + DEBUG_PRINT1 ("EXECUTING wordbeg.\n"); + if (WORDCHAR_P (d) && (AT_STRINGS_BEG (d) || !WORDCHAR_P (d - 1))) + break; + goto fail; + + case wordend: + DEBUG_PRINT1 ("EXECUTING wordend.\n"); + if (!AT_STRINGS_BEG (d) && WORDCHAR_P (d - 1) + && (!WORDCHAR_P (d) || AT_STRINGS_END (d))) + break; + goto fail; + +#ifdef emacs + case before_dot: + DEBUG_PRINT1 ("EXECUTING before_dot.\n"); + if (PTR_CHAR_POS ((unsigned char *) d) >= point) + goto fail; + break; + + case at_dot: + DEBUG_PRINT1 ("EXECUTING at_dot.\n"); + if (PTR_CHAR_POS ((unsigned char *) d) != point) + goto fail; + break; + + case after_dot: + DEBUG_PRINT1 ("EXECUTING after_dot.\n"); + if (PTR_CHAR_POS ((unsigned char *) d) <= point) + goto fail; + break; + + case syntaxspec: + DEBUG_PRINT2 ("EXECUTING syntaxspec %d.\n", mcnt); + mcnt = *p++; + goto matchsyntax; + + case wordchar: + DEBUG_PRINT1 ("EXECUTING Emacs wordchar.\n"); + mcnt = (int) Sword; + matchsyntax: + PREFETCH (); + /* Can't use *d++ here; SYNTAX may be an unsafe macro. */ + d++; + if (SYNTAX (d[-1]) != (enum syntaxcode) mcnt) + goto fail; + SET_REGS_MATCHED (); + break; + + case notsyntaxspec: + DEBUG_PRINT2 ("EXECUTING notsyntaxspec %d.\n", mcnt); + mcnt = *p++; + goto matchnotsyntax; + + case notwordchar: + DEBUG_PRINT1 ("EXECUTING Emacs notwordchar.\n"); + mcnt = (int) Sword; + matchnotsyntax: + PREFETCH (); + /* Can't use *d++ here; SYNTAX may be an unsafe macro. */ + d++; + if (SYNTAX (d[-1]) == (enum syntaxcode) mcnt) + goto fail; + SET_REGS_MATCHED (); + break; + +#else /* not emacs */ + case wordchar: + DEBUG_PRINT1 ("EXECUTING non-Emacs wordchar.\n"); + PREFETCH (); + if (!WORDCHAR_P (d)) + goto fail; + SET_REGS_MATCHED (); + d++; + break; + + case notwordchar: + DEBUG_PRINT1 ("EXECUTING non-Emacs notwordchar.\n"); + PREFETCH (); + if (WORDCHAR_P (d)) + goto fail; + SET_REGS_MATCHED (); + d++; + break; +#endif /* not emacs */ + + default: + abort (); + } + continue; /* Successfully executed one pattern command; keep going. */ + + + /* We goto here if a matching operation fails. */ + fail: + if (!FAIL_STACK_EMPTY ()) + { /* A restart point is known. Restore to that state. */ + DEBUG_PRINT1 ("\nFAIL:\n"); + POP_FAILURE_POINT (d, p, + lowest_active_reg, highest_active_reg, + regstart, regend, reg_info); + + /* If this failure point is a dummy, try the next one. */ + if (!p) + goto fail; + + /* If we failed to the end of the pattern, don't examine *p. */ + assert (p <= pend); + if (p < pend) + { + boolean is_a_jump_n = false; + + /* If failed to a backwards jump that's part of a repetition + loop, need to pop this failure point and use the next one. */ + switch ((re_opcode_t) *p) + { + case jump_n: + is_a_jump_n = true; + case maybe_pop_jump: + case pop_failure_jump: + case jump: + p1 = p + 1; + EXTRACT_NUMBER_AND_INCR (mcnt, p1); + p1 += mcnt; + + if ((is_a_jump_n && (re_opcode_t) *p1 == succeed_n) + || (!is_a_jump_n + && (re_opcode_t) *p1 == on_failure_jump)) + goto fail; + break; + default: + /* do nothing */ ; + } + } + + if (d >= string1 && d <= end1) + dend = end_match_1; + } + else + break; /* Matching at this starting point really fails. */ + } /* for (;;) */ + + if (best_regs_set) + goto restore_best_regs; + + FREE_VARIABLES (); + + return -1; /* Failure to match. */ +} /* re_match_2 */ + +/* Subroutine definitions for re_match_2. */ + + +/* We are passed P pointing to a register number after a start_memory. + + Return true if the pattern up to the corresponding stop_memory can + match the empty string, and false otherwise. + + If we find the matching stop_memory, sets P to point to one past its number. + Otherwise, sets P to an undefined byte less than or equal to END. + + We don't handle duplicates properly (yet). */ + +static boolean +group_match_null_string_p (p, end, reg_info) + unsigned char **p, *end; + register_info_type *reg_info; +{ + int mcnt; + /* Point to after the args to the start_memory. */ + unsigned char *p1 = *p + 2; + + while (p1 < end) + { + /* Skip over opcodes that can match nothing, and return true or + false, as appropriate, when we get to one that can't, or to the + matching stop_memory. */ + + switch ((re_opcode_t) *p1) + { + /* Could be either a loop or a series of alternatives. */ + case on_failure_jump: + p1++; + EXTRACT_NUMBER_AND_INCR (mcnt, p1); + + /* If the next operation is not a jump backwards in the + pattern. */ + + if (mcnt >= 0) + { + /* Go through the on_failure_jumps of the alternatives, + seeing if any of the alternatives cannot match nothing. + The last alternative starts with only a jump, + whereas the rest start with on_failure_jump and end + with a jump, e.g., here is the pattern for `a|b|c': + + /on_failure_jump/0/6/exactn/1/a/jump_past_alt/0/6 + /on_failure_jump/0/6/exactn/1/b/jump_past_alt/0/3 + /exactn/1/c + + So, we have to first go through the first (n-1) + alternatives and then deal with the last one separately. */ + + + /* Deal with the first (n-1) alternatives, which start + with an on_failure_jump (see above) that jumps to right + past a jump_past_alt. */ + + while ((re_opcode_t) p1[mcnt-3] == jump_past_alt) + { + /* `mcnt' holds how many bytes long the alternative + is, including the ending `jump_past_alt' and + its number. */ + + if (!alt_match_null_string_p (p1, p1 + mcnt - 3, + reg_info)) + return false; + + /* Move to right after this alternative, including the + jump_past_alt. */ + p1 += mcnt; + + /* Break if it's the beginning of an n-th alternative + that doesn't begin with an on_failure_jump. */ + if ((re_opcode_t) *p1 != on_failure_jump) + break; + + /* Still have to check that it's not an n-th + alternative that starts with an on_failure_jump. */ + p1++; + EXTRACT_NUMBER_AND_INCR (mcnt, p1); + if ((re_opcode_t) p1[mcnt-3] != jump_past_alt) + { + /* Get to the beginning of the n-th alternative. */ + p1 -= 3; + break; + } + } + + /* Deal with the last alternative: go back and get number + of the `jump_past_alt' just before it. `mcnt' contains + the length of the alternative. */ + EXTRACT_NUMBER (mcnt, p1 - 2); + + if (!alt_match_null_string_p (p1, p1 + mcnt, reg_info)) + return false; + + p1 += mcnt; /* Get past the n-th alternative. */ + } /* if mcnt > 0 */ + break; + + + case stop_memory: + assert (p1[1] == **p); + *p = p1 + 2; + return true; + + + default: + if (!common_op_match_null_string_p (&p1, end, reg_info)) + return false; + } + } /* while p1 < end */ + + return false; +} /* group_match_null_string_p */ + + +/* Similar to group_match_null_string_p, but doesn't deal with alternatives: + It expects P to be the first byte of a single alternative and END one + byte past the last. The alternative can contain groups. */ + +static boolean +alt_match_null_string_p (p, end, reg_info) + unsigned char *p, *end; + register_info_type *reg_info; +{ + int mcnt; + unsigned char *p1 = p; + + while (p1 < end) + { + /* Skip over opcodes that can match nothing, and break when we get + to one that can't. */ + + switch ((re_opcode_t) *p1) + { + /* It's a loop. */ + case on_failure_jump: + p1++; + EXTRACT_NUMBER_AND_INCR (mcnt, p1); + p1 += mcnt; + break; + + default: + if (!common_op_match_null_string_p (&p1, end, reg_info)) + return false; + } + } /* while p1 < end */ + + return true; +} /* alt_match_null_string_p */ + + +/* Deals with the ops common to group_match_null_string_p and + alt_match_null_string_p. + + Sets P to one after the op and its arguments, if any. */ + +static boolean +common_op_match_null_string_p (p, end, reg_info) + unsigned char **p, *end; + register_info_type *reg_info; +{ + int mcnt; + boolean ret; + int reg_no; + unsigned char *p1 = *p; + + switch ((re_opcode_t) *p1++) + { + case no_op: + case begline: + case endline: + case begbuf: + case endbuf: + case wordbeg: + case wordend: + case wordbound: + case notwordbound: +#ifdef emacs + case before_dot: + case at_dot: + case after_dot: +#endif + break; + + case start_memory: + reg_no = *p1; + assert (reg_no > 0 && reg_no <= MAX_REGNUM); + ret = group_match_null_string_p (&p1, end, reg_info); + + /* Have to set this here in case we're checking a group which + contains a group and a back reference to it. */ + + if (REG_MATCH_NULL_STRING_P (reg_info[reg_no]) == MATCH_NULL_UNSET_VALUE) + REG_MATCH_NULL_STRING_P (reg_info[reg_no]) = ret; + + if (!ret) + return false; + break; + + /* If this is an optimized succeed_n for zero times, make the jump. */ + case jump: + EXTRACT_NUMBER_AND_INCR (mcnt, p1); + if (mcnt >= 0) + p1 += mcnt; + else + return false; + break; + + case succeed_n: + /* Get to the number of times to succeed. */ + p1 += 2; + EXTRACT_NUMBER_AND_INCR (mcnt, p1); + + if (mcnt == 0) + { + p1 -= 4; + EXTRACT_NUMBER_AND_INCR (mcnt, p1); + p1 += mcnt; + } + else + return false; + break; + + case duplicate: + if (!REG_MATCH_NULL_STRING_P (reg_info[*p1])) + return false; + break; + + case set_number_at: + p1 += 4; + + default: + /* All other opcodes mean we cannot match the empty string. */ + return false; + } + + *p = p1; + return true; +} /* common_op_match_null_string_p */ + + +/* Return zero if TRANSLATE[S1] and TRANSLATE[S2] are identical for LEN + bytes; nonzero otherwise. */ + +static int +bcmp_translate (s1, s2, len, translate) + const char *s1, *s2; + register int len; + RE_TRANSLATE_TYPE translate; +{ + register const unsigned char *p1 = (const unsigned char *) s1; + register const unsigned char *p2 = (const unsigned char *) s2; + while (len) + { + if (translate[*p1++] != translate[*p2++]) return 1; + len--; + } + return 0; +} + +/* Entry points for GNU code. */ + +/* re_compile_pattern is the GNU regular expression compiler: it + compiles PATTERN (of length SIZE) and puts the result in BUFP. + Returns 0 if the pattern was valid, otherwise an error string. + + Assumes the `allocated' (and perhaps `buffer') and `translate' fields + are set in BUFP on entry. + + We call regex_compile to do the actual compilation. */ + +const char * +re_compile_pattern (pattern, length, bufp) + const char *pattern; + size_t length; + struct re_pattern_buffer *bufp; +{ + reg_errcode_t ret; + + /* GNU code is written to assume at least RE_NREGS registers will be set + (and at least one extra will be -1). */ + bufp->regs_allocated = REGS_UNALLOCATED; + + /* And GNU code determines whether or not to get register information + by passing null for the REGS argument to re_match, etc., not by + setting no_sub. */ + bufp->no_sub = 0; + + /* Match anchors at newline. */ + bufp->newline_anchor = 1; + + ret = regex_compile (pattern, length, re_syntax_options, bufp); + + if (!ret) + return NULL; + return gettext (re_error_msgid[(int) ret]); +} + +/* Entry points compatible with 4.2 BSD regex library. We don't define + them unless specifically requested. */ + +#if defined (_REGEX_RE_COMP) || defined (_LIBC) + +/* BSD has one and only one pattern buffer. */ +static struct re_pattern_buffer re_comp_buf; + +char * +#ifdef _LIBC +/* Make these definitions weak in libc, so POSIX programs can redefine + these names if they don't use our functions, and still use + regcomp/regexec below without link errors. */ +weak_function +#endif +re_comp (s) + const char *s; +{ + reg_errcode_t ret; + + if (!s) + { + if (!re_comp_buf.buffer) + return gettext ("No previous regular expression"); + return 0; + } + + if (!re_comp_buf.buffer) + { + re_comp_buf.buffer = (unsigned char *) malloc (200); /* __MEM_CHECKED__ */ + if (re_comp_buf.buffer == NULL) + return gettext (re_error_msgid[(int) REG_ESPACE]); + re_comp_buf.allocated = 200; + + re_comp_buf.fastmap = (char *) malloc (1 << BYTEWIDTH); /* __MEM_CHECKED__ */ + if (re_comp_buf.fastmap == NULL) + return gettext (re_error_msgid[(int) REG_ESPACE]); + } + + /* Since `re_exec' always passes NULL for the `regs' argument, we + don't need to initialize the pattern buffer fields which affect it. */ + + /* Match anchors at newlines. */ + re_comp_buf.newline_anchor = 1; + + ret = regex_compile (s, strlen (s), re_syntax_options, &re_comp_buf); + + if (!ret) + return NULL; + + /* Yes, we're discarding `const' here if !HAVE_LIBINTL. */ + return (char *) gettext (re_error_msgid[(int) ret]); +} + + +int +#ifdef _LIBC +weak_function +#endif +re_exec (s) + const char *s; +{ + const int len = strlen (s); + return + 0 <= re_search (&re_comp_buf, s, len, 0, len, (struct re_registers *) 0); +} + +#endif /* _REGEX_RE_COMP */ + +/* POSIX.2 functions. Don't define these for Emacs. */ + +#ifndef emacs + +/* regcomp takes a regular expression as a string and compiles it. + + PREG is a regex_t *. We do not expect any fields to be initialized, + since POSIX says we shouldn't. Thus, we set + + `buffer' to the compiled pattern; + `used' to the length of the compiled pattern; + `syntax' to RE_SYNTAX_POSIX_EXTENDED if the + REG_EXTENDED bit in CFLAGS is set; otherwise, to + RE_SYNTAX_POSIX_BASIC; + `newline_anchor' to REG_NEWLINE being set in CFLAGS; + `fastmap' and `fastmap_accurate' to zero; + `re_nsub' to the number of subexpressions in PATTERN. + + PATTERN is the address of the pattern string. + + CFLAGS is a series of bits which affect compilation. + + If REG_EXTENDED is set, we use POSIX extended syntax; otherwise, we + use POSIX basic syntax. + + If REG_NEWLINE is set, then . and [^...] don't match newline. + Also, regexec will try a match beginning after every newline. + + If REG_ICASE is set, then we considers upper- and lowercase + versions of letters to be equivalent when matching. + + If REG_NOSUB is set, then when PREG is passed to regexec, that + routine will report only success or failure, and nothing about the + registers. + + It returns 0 if it succeeds, nonzero if it doesn't. (See regex.h for + the return codes and their meanings.) */ + +int +regcomp (preg, pattern, cflags) + regex_t *preg; + const char *pattern; + int cflags; +{ + reg_errcode_t ret; + reg_syntax_t syntax + = (cflags & REG_EXTENDED) ? + RE_SYNTAX_POSIX_EXTENDED : RE_SYNTAX_POSIX_BASIC; + + /* regex_compile will allocate the space for the compiled pattern. */ + preg->buffer = 0; + preg->allocated = 0; + preg->used = 0; + + /* Don't bother to use a fastmap when searching. This simplifies the + REG_NEWLINE case: if we used a fastmap, we'd have to put all the + characters after newlines into the fastmap. This way, we just try + every character. */ + preg->fastmap = 0; + + if (cflags & REG_ICASE) + { + unsigned i; + + preg->translate + = (RE_TRANSLATE_TYPE) malloc (CHAR_SET_SIZE /* __MEM_CHECKED__ */ + * sizeof (*(RE_TRANSLATE_TYPE)0)); + if (preg->translate == NULL) + return (int) REG_ESPACE; + + /* Map uppercase characters to corresponding lowercase ones. */ + for (i = 0; i < CHAR_SET_SIZE; i++) + preg->translate[i] = ISUPPER (i) ? tolower (i) : i; + } + else + preg->translate = NULL; + + /* If REG_NEWLINE is set, newlines are treated differently. */ + if (cflags & REG_NEWLINE) + { /* REG_NEWLINE implies neither . nor [^...] match newline. */ + syntax &= ~RE_DOT_NEWLINE; + syntax |= RE_HAT_LISTS_NOT_NEWLINE; + /* It also changes the matching behavior. */ + preg->newline_anchor = 1; + } + else + preg->newline_anchor = 0; + + preg->no_sub = !!(cflags & REG_NOSUB); + + /* POSIX says a null character in the pattern terminates it, so we + can use strlen here in compiling the pattern. */ + ret = regex_compile (pattern, strlen (pattern), syntax, preg); + + /* POSIX doesn't distinguish between an unmatched open-group and an + unmatched close-group: both are REG_EPAREN. */ + if (ret == REG_ERPAREN) ret = REG_EPAREN; + + return (int) ret; +} + + +/* regexec searches for a given pattern, specified by PREG, in the + string STRING. + + If NMATCH is zero or REG_NOSUB was set in the cflags argument to + `regcomp', we ignore PMATCH. Otherwise, we assume PMATCH has at + least NMATCH elements, and we set them to the offsets of the + corresponding matched substrings. + + EFLAGS specifies `execution flags' which affect matching: if + REG_NOTBOL is set, then ^ does not match at the beginning of the + string; if REG_NOTEOL is set, then $ does not match at the end. + + We return 0 if we find a match and REG_NOMATCH if not. */ + +int +regexec (preg, string, nmatch, pmatch, eflags) + const regex_t *preg; + const char *string; + size_t nmatch; + regmatch_t pmatch[]; + int eflags; +{ + int ret; + struct re_registers regs; + regex_t private_preg; + int len = strlen (string); + boolean want_reg_info = !preg->no_sub && nmatch > 0; + + private_preg = *preg; + + private_preg.not_bol = !!(eflags & REG_NOTBOL); + private_preg.not_eol = !!(eflags & REG_NOTEOL); + + /* The user has told us exactly how many registers to return + information about, via `nmatch'. We have to pass that on to the + matching routines. */ + private_preg.regs_allocated = REGS_FIXED; + + if (want_reg_info) + { + regs.num_regs = nmatch; + regs.start = TALLOC (nmatch, regoff_t); + regs.end = TALLOC (nmatch, regoff_t); + if (regs.start == NULL || regs.end == NULL) + return (int) REG_NOMATCH; + } + + /* Perform the searching operation. */ + ret = re_search (&private_preg, string, len, + /* start: */ 0, /* range: */ len, + want_reg_info ? ®s : (struct re_registers *) 0); + + /* Copy the register information to the POSIX structure. */ + if (want_reg_info) + { + if (ret >= 0) + { + unsigned r; + + for (r = 0; r < nmatch; r++) + { + pmatch[r].rm_so = regs.start[r]; + pmatch[r].rm_eo = regs.end[r]; + } + } + + /* If we needed the temporary register info, free the space now. */ + free (regs.start); /* __MEM_CHECKED__ */ + free (regs.end); /* __MEM_CHECKED__ */ + } + + /* We want zero return to mean success, unlike `re_search'. */ + return ret >= 0 ? (int) REG_NOERROR : (int) REG_NOMATCH; +} + + +/* Returns a message corresponding to an error code, ERRCODE, returned + from either regcomp or regexec. We don't use PREG here. */ + +size_t +regerror (errcode, preg, errbuf, errbuf_size) + int errcode; + const regex_t *preg; + char *errbuf; + size_t errbuf_size; +{ + const char *msg; + size_t msg_size; + + if (errcode < 0 + || errcode >= (int) (sizeof (re_error_msgid) + / sizeof (re_error_msgid[0]))) + /* Only error codes returned by the rest of the code should be passed + to this routine. If we are given anything else, or if other regex + code generates an invalid error code, then the program has a bug. + Dump core so we can fix it. */ + abort (); + + msg = gettext (re_error_msgid[errcode]); + + msg_size = strlen (msg) + 1; /* Includes the null. */ + + if (errbuf_size != 0) + { + if (msg_size > errbuf_size) + { + strncpy (errbuf, msg, errbuf_size - 1); + errbuf[errbuf_size - 1] = 0; + } + else + strcpy (errbuf, msg); /* __STRCPY_CHECKED__ */ + } + + return msg_size; +} + + +/* Free dynamically allocated space used by PREG. */ + +void +regfree (preg) + regex_t *preg; +{ + if (preg->buffer != NULL) + free (preg->buffer); /* __MEM_CHECKED__ */ + preg->buffer = NULL; + + preg->allocated = 0; + preg->used = 0; + + if (preg->fastmap != NULL) + free (preg->fastmap); /* __MEM_CHECKED__ */ + preg->fastmap = NULL; + preg->fastmap_accurate = 0; + + if (preg->translate != NULL) + free (preg->translate); /* __MEM_CHECKED__ */ + preg->translate = NULL; +} + +#endif /* not emacs */ diff --git a/src/testdir/Makefile b/src/testdir/Makefile new file mode 100644 index 0000000..40fab0d --- /dev/null +++ b/src/testdir/Makefile @@ -0,0 +1,45 @@ +# +# Makefile to run all tests for Fim (Vim-styled!) +# + +BASE=../../ +FIMPROG = $(BASE)/src/fim + +# Uncomment this line for using valgrind. +# The output goes into a file "valgrind.$PID" (sorry, no test number). +# VALGRIND = valgrind --tool=memcheck --leak-check=yes --num-callers=15 --log-file=valgrind.log + +SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out test7.out test8.out test9.out test10.out test11.out test12.out test13.out test14.out test15.out test16.out + +.SUFFIXES: .in .out + +nongui: nolog $(SCRIPTS) + @echo + @cat test.log + @echo "[*] ALL DONE" + + +$(SCRIPTS): $(FIMPROG) + +clean: + -rm -rf *.out *.failed *.rej *.orig test.log tiny.fim small.fim mbyte.fim test.ok X* valgrind.pid* fiminfo + +.in.out: + -rm -rf $*.failed test.ok test.out X* fiminfo + cp $*.ok test.ok + # Sleep a moment to avoid that the xterm title is messed up + @-sleep .2 + -$(VALGRIND) $(FIMPROG) -o dumb -c "quit;" -N --no-etc-rc-file -E $*.in $(BASE)/media/*jpg $(BASE)/media/fim.png $(BASE)/media/image.png > test.out +# -$(VALGRIND) $(FIMPROG) -u unix.fim -U NONE --noplugin -s dotest.in $*.in + @/bin/sh -c "if test -f test.out; then\ + if diff $*.ok test.out; \ + then mv -f test.out $*.out; \ + else echo $* FAILED >>test.log; mv -f test.out $*.failed; \ + fi \ + else echo $* NO OUTPUT >>test.log; \ + fi" + -rm -rf X* test.ok fiminfo + +nolog: + -echo Test results: >test.log + diff --git a/src/testdir/test1.in b/src/testdir/test1.in new file mode 100644 index 0000000..711900f --- /dev/null +++ b/src/testdir/test1.in @@ -0,0 +1,37 @@ + +# These scripts tests the Fim language correctness. +# They are used during Fim maintenance, debugging, and developement. +# +# Fim should execute this and other scripts and quit 0 if all tests pass. + +if ( 1 ) { stdout "if construct seems working"; } +else { stdout "if construct seems not working"; } + +if ( 0 ) { stdout "if construct seems not working"; } +else { stdout "if construct seems working"; } + +if ( 0 == 0 ) { stdout "equality works"; } +else { stdout "equality does not work"; quit -1; } + +if ( 0 != 1 ) { stdout "disequality works"; } +else { stdout "disequality does not work"; quit -1; } + +if ( 40 == 50-10 ) { stdout "basic integer arithmetics works"; } +else { stdout "basic integer arithmetics does not work"; quit -1; } + +if ( 41 != 50-10 ) { stdout "basic integer arithmetics works"; } +else { stdout "basic integer arithmetics does not work"; quit -1; } + +if ( 1 | 2 ) { stdout "basic integer bitwise OR works"; } +else { stdout "basic integer bitwise OR does not work"; quit -1; } + +if ( ! 0 ) { stdout "basic integer bitwise OR works"; } +else { stdout "basic integer bitwise OR does not work"; quit -1; } + +if ( 1 & 3 ) { stdout "basic integer bitwise AND works"; } +else { stdout "basic integer bitwise AND does not work"; quit -1; } + +if ( !( 1 & 0) ) { stdout "basic integer bitwise AND works"; } +else { stdout "basic integer bitwise AND does not work"; quit -1; } + +stdout "basic integer arithmetic test success"; diff --git a/src/testdir/test1.ok b/src/testdir/test1.ok new file mode 100644 index 0000000..5d508f0 --- /dev/null +++ b/src/testdir/test1.ok @@ -0,0 +1,11 @@ +if construct seems working +if construct seems working +equality works +disequality works +basic integer arithmetics works +basic integer arithmetics works +basic integer bitwise OR works +basic integer bitwise OR works +basic integer bitwise AND works +basic integer bitwise AND works +basic integer arithmetic test success diff --git a/src/testdir/test10.in b/src/testdir/test10.in new file mode 100644 index 0000000..1669681 --- /dev/null +++ b/src/testdir/test10.in @@ -0,0 +1,23 @@ +# we need an image in order for i: scoped variables to work +load; +display; +reload; +redisplay; +stdout "-------------------"; +a=77777; +stdout a; +stdout "-------------------"; +stdout g:a; +stdout "-------------------"; +g:a=77778; +stdout g:a; +stdout "-------------------"; +stdout a; +stdout "-------------------"; +i:a=99999; +stdout i:a; +stdout "-------------------"; +# b: v: are not active anymore +# b:a=99999; +# stdout b:a; +# stdout "-------------------"; diff --git a/src/testdir/test10.ok b/src/testdir/test10.ok new file mode 100644 index 0000000..9d7f488 --- /dev/null +++ b/src/testdir/test10.ok @@ -0,0 +1,11 @@ +------------------- +77777 +------------------- +77777 +------------------- +77778 +------------------- +77778 +------------------- +99999 +------------------- diff --git a/src/testdir/test11.in b/src/testdir/test11.in new file mode 100644 index 0000000..23643bd --- /dev/null +++ b/src/testdir/test11.in @@ -0,0 +1,8 @@ +stdout "square root algorithm computation with the babylonian method"; +s="256.0"; +r=s/2; +#stdout r s; +stdout r*r==s; +while(r*r!=s){r=r/2+s/(2*r);} +#stdout r s; +stdout r*r==s; diff --git a/src/testdir/test11.ok b/src/testdir/test11.ok new file mode 100644 index 0000000..01025a3 --- /dev/null +++ b/src/testdir/test11.ok @@ -0,0 +1,3 @@ +square root algorithm computation with the babylonian method +0 +1 diff --git a/src/testdir/test12.in b/src/testdir/test12.in new file mode 100644 index 0000000..0b7dd6f --- /dev/null +++ b/src/testdir/test12.in @@ -0,0 +1,27 @@ +autocmd "" "" ""; +alias "aalib_fix" ""; # FIXME : autocmd "" "" "" should suffice, but it does not! +#_autocmd_trace_stack=1; +stdout "asymmetric scaling test"; +load; + +i:ascale=1; +i:scale=2; +magnify; +reduce; +display; +#stdout i:width; +#stdout i:swidth; +stdout i:swidth==i:width; +stdout i:swidth==2*i:width; + +stdout ""; + +i:ascale=2; +i:scale=2; +# FIXME : workaround +if(_device_string=="aalib") { ascale=ascale*2; } +magnify; +reduce; +display; +stdout i:swidth==2*i:width; +stdout i:swidth==i:width; diff --git a/src/testdir/test12.ok b/src/testdir/test12.ok new file mode 100644 index 0000000..cdb6e41 --- /dev/null +++ b/src/testdir/test12.ok @@ -0,0 +1,6 @@ +asymmetric scaling test +1 +0 + +1 +0 diff --git a/src/testdir/test13.in b/src/testdir/test13.in new file mode 100644 index 0000000..dc22e57 --- /dev/null +++ b/src/testdir/test13.in @@ -0,0 +1,7 @@ +# file browsing test +# in order for this test to terminate, we need some files .. +if(_filelistlen>1){stdout "at least one file in the list.";quit 1;} +if(_filelistlen<1){stdout "probable problems with file browser.";quit 1;} +while(_filelistlen>1){list "pop";} +stdout _filelistlen; +stdout "browser test ok."; diff --git a/src/testdir/test13.ok b/src/testdir/test13.ok new file mode 100644 index 0000000..dacf142 --- /dev/null +++ b/src/testdir/test13.ok @@ -0,0 +1,3 @@ +at least one file in the list. +1 +browser test ok. diff --git a/src/testdir/test14.in b/src/testdir/test14.in new file mode 100644 index 0000000..3da0a81 --- /dev/null +++ b/src/testdir/test14.in @@ -0,0 +1,8 @@ +# this should test fim internals +stdout "this test will break if user configuration breaks in."; +stdout "so it is temporary :)"; +autocmd "" "" ""; +_debug_commands=1; +alias "aalib_fix" ""; # FIXME : autocmd "" "" "" should suffice, but it does not! +echo "ciao"; +next; diff --git a/src/testdir/test14.ok b/src/testdir/test14.ok new file mode 100644 index 0000000..95de701 --- /dev/null +++ b/src/testdir/test14.ok @@ -0,0 +1,11 @@ +this test will break if user configuration breaks in. +so it is temporary :) +in echo: +in goto: +in reload: +in redisplay: +in scale: +in reload: +in redisplay: +in scale: +in quit: diff --git a/src/testdir/test15.in b/src/testdir/test15.in new file mode 100644 index 0000000..4886a1d --- /dev/null +++ b/src/testdir/test15.in @@ -0,0 +1,8 @@ +stdout "this test checks recording capabilities."; +stdout "it is unfinished, as recording is only supported for interactive usage."; +#_debug_commands=1; +#start_recording; +#stdout "you are recording, aren't you?"; +#stop_recording; +#execute_record_buffer; +#do_dump_record_buffer; diff --git a/src/testdir/test15.ok b/src/testdir/test15.ok new file mode 100644 index 0000000..161905c --- /dev/null +++ b/src/testdir/test15.ok @@ -0,0 +1,2 @@ +this test checks recording capabilities. +it is unfinished, as recording is only supported for interactive usage. diff --git a/src/testdir/test16.in b/src/testdir/test16.in new file mode 100644 index 0000000..b9ff73e --- /dev/null +++ b/src/testdir/test16.in @@ -0,0 +1,9 @@ +stdout "this is a minimal test case for directory load capability"; +#stdout _filelistlen; +#stdout offl; +offl=_filelistlen; +list "pushdir" "../../media"; +#stdout _filelistlen; +if(_filelistlen==ofll) { stdout "no new file loaded ?"; } +if(_filelistlen!=offl) { stdout "some files loaded: ok"; } +stdout "end of test"; diff --git a/src/testdir/test16.ok b/src/testdir/test16.ok new file mode 100644 index 0000000..f472b17 --- /dev/null +++ b/src/testdir/test16.ok @@ -0,0 +1,3 @@ +this is a minimal test case for directory load capability +some files loaded: ok +end of test diff --git a/src/testdir/test2.in b/src/testdir/test2.in new file mode 100644 index 0000000..f6b6af9 --- /dev/null +++ b/src/testdir/test2.in @@ -0,0 +1,29 @@ +iv=1; + +if ( iv ) { stdout "integer variables evaluation works"; } +else { stdout "integer variables evaluation doesn't work"; } + +iv=0; + +if ( !iv ) { stdout "negated integer variables evaluation works"; } +else { stdout "negated integer variables evaluation doesn't work"; } + +if ( !!iv ) { stdout "double negated integer variables evaluation doesn't work"; } +else { stdout "double negated integer variables evaluation works"; } + +if ( !!!iv ) { stdout "triply negated integer variables evaluation works"; } +else { stdout "triply negated integer variables evaluation doesn't work"; } + +if ( iv == 0 ) { stdout "integer variables comparison works"; } +else { stdout "integer variables comparison don't work"; } + +if ( iv == 3*iv-2*iv ) { stdout "integer variables to expression comparison works"; } +else { stdout "integer variables to expression comparison don't work"; } + +if ( iv != 3*iv-2*iv ) { stdout "integer variables to expression inequality don't work"; } +else { stdout "integer variables works"; } + +if ( iv != iv ) { stdout "integer variables self inequality does't work"; } +else { stdout "integer variables self inequality works"; } + +stdout "basic integer variables test success"; diff --git a/src/testdir/test2.ok b/src/testdir/test2.ok new file mode 100644 index 0000000..1d9ec8d --- /dev/null +++ b/src/testdir/test2.ok @@ -0,0 +1,9 @@ +integer variables evaluation works +negated integer variables evaluation works +double negated integer variables evaluation works +triply negated integer variables evaluation works +integer variables comparison works +integer variables to expression comparison works +integer variables works +integer variables self inequality works +basic integer variables test success diff --git a/src/testdir/test3.in b/src/testdir/test3.in new file mode 100644 index 0000000..fded9fc --- /dev/null +++ b/src/testdir/test3.in @@ -0,0 +1,42 @@ +# Like in Vim, the following form is not correct for an arithmetic assignment: +# fv=2.0; +# The next one is the correct one: +fv="2.1"; + +if ( fv ) { stdout "float variables evaluation works"; } +else { stdout "float variables evaluation doesn't work"; quit -1; } + +if ( !fv ) { stdout "negated float variables evaluation doesn't work"; quit -1; } +else { stdout "negated float variables evaluation works"; } + +if ( !!fv ) { stdout "negated negated float variables evaluation works"; } +else { stdout "negated negated float variables evaluation doesn't work"; quit -1; } + +if ( !!!fv ) { stdout "triply negated float variables evaluation doesn't work"; quit -1; } +else { stdout "triply negated float variables evaluation work"; } + +if ( fv == "0.0" ) { stdout "float variables to constant comparison doesn't work"; quit -1; } +else { stdout "float variables to constant comparison works"; } + +if ( ! ( fv != "0.0" ) ) { stdout "float variables to negated constant inequality doesn't work"; quit -1; } +else { stdout "float variables to negated constant inequality works"; } + +if ( !!! ( fv != "0.0" ) ) { stdout "float variables to triply negated constant inequality doesn't work"; quit -1; } +else { stdout "float variables to triply negated constant inequality works"; } + +if ( !! ( fv == "0.0" ) ) { stdout "double negated float to constant variables comparison doesn't work"; quit -1; } +else { stdout "double negated float to constant variables comparison works"; } + +#stdout "2.0 != 2.1"; +# FIXME : should we allow int conversion ? +if ( fv == "2.1" ) { stdout "float variables to constant comparison works"; } +else { stdout "float variables to constant comparison doesn't work"; quit -1; } + +if ( fv != "2.0" ) { stdout "float variables to constant comparison works"; } +else { stdout "float variables to constant comparison doesn't work"; quit -1; } + + +if ( fv != "3.0" ) { stdout "float variables to constant inequality works"; } +else { stdout "float variables to constant inequality doesn't work"; quit -1; } + +stdout "basic float variables test success"; diff --git a/src/testdir/test3.ok b/src/testdir/test3.ok new file mode 100644 index 0000000..17c4f60 --- /dev/null +++ b/src/testdir/test3.ok @@ -0,0 +1,12 @@ +float variables evaluation works +negated float variables evaluation works +negated negated float variables evaluation works +triply negated float variables evaluation work +float variables to constant comparison works +float variables to negated constant inequality works +float variables to triply negated constant inequality works +double negated float to constant variables comparison works +float variables to constant comparison works +float variables to constant comparison works +float variables to constant inequality works +basic float variables test success diff --git a/src/testdir/test4.in b/src/testdir/test4.in new file mode 100644 index 0000000..21a254a --- /dev/null +++ b/src/testdir/test4.in @@ -0,0 +1,15 @@ + +stdout "tab in expressions works"; +stdout + "newline in expressions works"; + +if +( 1==1 ) +{ + stdout "multiline" " and multiarg constructs ". + "work" +} +else +{ stdout "multiline and multiarg constructs don't work." ; quit -1; } + +stdout "muiltiline and tab-based test success"; diff --git a/src/testdir/test4.ok b/src/testdir/test4.ok new file mode 100644 index 0000000..f64907a --- /dev/null +++ b/src/testdir/test4.ok @@ -0,0 +1,5 @@ +tab in expressions works +newline in expressions works +multiline + and multiarg constructs work +muiltiline and tab-based test success diff --git a/src/testdir/test5.in b/src/testdir/test5.in new file mode 100644 index 0000000..62ae67e --- /dev/null +++ b/src/testdir/test5.in @@ -0,0 +1,17 @@ +if( "aba"."a"=="a"."ba"."a" ){stdout "string collation comparison works";} +else {stdout "string collation comparison does not work"; quit -1;} + +if( "aba"!="a"."sba"."a" ){stdout "string collation inequality works";} +else {stdout "string collation inequality does not work"; quit -1;} + +if( "aba"=~"a.*a" ){stdout "regular expressions operator works";} +else {stdout "regular expressions operator does not work"; quit -1;} + +if( !("aba"=~"a.*a") ) {stdout "single negations on regular expressions don't work"; quit -1;} +else {stdout "single negations on regular expressions work";} + +# the following doesn't work in fim 0.3. +if( !(!("aba"=~"a.*a")) ){stdout "double negations on regular expressions work";} +else {stdout "double negations on regular expressions don't work"; } + +stdout "string test success"; diff --git a/src/testdir/test5.ok b/src/testdir/test5.ok new file mode 100644 index 0000000..465e18c --- /dev/null +++ b/src/testdir/test5.ok @@ -0,0 +1,6 @@ +string collation comparison works +string collation inequality works +regular expressions operator works +single negations on regular expressions work +double negations on regular expressions work +string test success diff --git a/src/testdir/test6.in b/src/testdir/test6.in new file mode 100644 index 0000000..672954f --- /dev/null +++ b/src/testdir/test6.in @@ -0,0 +1,22 @@ + +a=1; +{a=5} +if( a==5 ){stdout "{command} constructs work";} +else {stdout "{command} constructs don't work";} + +{a=10;} +if( a==10 ){stdout "{command;} constructs work";} +else {stdout "{command;} constructs don't work";} + +#the following does not work +{a=20;;} + +if( a==20 ){stdout "{command;;} constructs work";} +else {stdout "{command;;} constructs don't work";} + + +stdout "please note that the 'quit' command is still untested"; +rc=0; +stdout "command blocking test success"; +quit rc; + diff --git a/src/testdir/test6.ok b/src/testdir/test6.ok new file mode 100644 index 0000000..74b687a --- /dev/null +++ b/src/testdir/test6.ok @@ -0,0 +1,5 @@ +{command} constructs work +{command;} constructs work +{command;;} constructs work +please note that the 'quit' command is still untested +command blocking test success diff --git a/src/testdir/test7.in b/src/testdir/test7.in new file mode 100644 index 0000000..52051e0 --- /dev/null +++ b/src/testdir/test7.in @@ -0,0 +1,96 @@ +# This script tests auto width scaling capabilities of fim. +# floating point madness.. this test will break easily (maybe better to deactivate it at all!) +# todo : auto width +autocmd "" "" ""; +alias "toggleAutoWidth" "i:autowidth=1-i:autowidth;g:auto_scale_v=0;reload;"; +load; +display; +# when loaded, images should have no relationship to screeen width +# FIXME : the following has no policy +#stdout "i:width==i:swidth :".(i:width==i:swidth); +#stdout "i:height==i:sheight:".(i:height==i:sheight); + +if(1==0) +{ +stdout "i:width :" .i:width; +stdout "i:swidth :".i:swidth; +stdout "i:height :".i:height; +stdout "i:sheight:".i:sheight; +} +i:autowidth=0; +#stdout "ii"; +#i:autowidth=1; +#stdout i:autowidth; +#stdout i:autowidth; +#stdout "ii"; +toggleAutoWidth; +# 20110622 commented the following +#stdout "i:autowidth=".i:autowidth." (should be 1)"; +stdout "#i:autowidth=1 (should be 1)"; +#stdout "ia:"; +#toggleAutoWidth; +#stdout i:autowidth; +reload; +display; +#magnify; +reload; +#if(0) +#{ +# stdout _screen_width; +# stdout i:swidth; +# stdout _screen_height; +# stdout i:sheight; +#}; +# +scaled_width= ((i:width *scale)/100.0); +# FIXME : missing ascale effect +scaled_height=((i:height*scale)/100.0); +if(scaled_height<1) scaled_height=1; # fix for dumb driver +if(_device_string=="aalib") +{ + scaled_width=scaled_width*2; +} +#stdout "FIXME : aalib dual resolution is not well handled!"; + +#stdout "_screen_width==i:swidth._screen_width:".(_screen_width==i:swidth); +#stdout "_screen_height==i:sheight :".(_screen_height==i:sheight); +#stdout "_screen_height="._screen_height." != i:sheight=".i:sheight." "; +#stdout "_screen_height="._screen_height." != i:sheight=".scaled_height." "; +#stdout "_screen_width="._screen_width." != i:swidth=".scaled_width." "; +#stdout " _screen_width="._screen_width." should equal scaled_width=".scaled_width." "; +#stdout "_screen_height="._screen_height." should equal scaled_height=".scaled_height." "; + +#if ( (scaled_width!=i:swidth) || (scaled_height!=i:sheight) ) +if ( i:swidth > 2.0 ) +{ +if ( (scaled_width!=i:swidth) || (scaled_height!=i:sheight) ) +{ + stdout "[!]"; + stdout "something went wrong..."; + stdout "scaled_height:".scaled_height; + stdout "scaled_width :".scaled_width; + stdout "sheight :".i:sheight; + stdout "swidth :".i:swidth; + + stdout "_screen_height:"._screen_height; + stdout "_screen_width :"._screen_width; + stdout "i:height :".i:height; + stdout "i:width :".i:width; + stdout "i:scale :".i:scale; + stdout "g:scale :".g:scale; + stdout "scale :".scale; +} +} +else +{ + stdout "auto scaling seems ok"; +} + +# auto height scaling missing +#stdout _screen_height==i:sheight; + +rc=0; +if ( i:swidth > 2.0 ) +if(_screen_width!=i:swidth)stdout "PLEASE FINISH WRITING THIS TEST"; +#quit rc; + diff --git a/src/testdir/test7.ok b/src/testdir/test7.ok new file mode 100644 index 0000000..3658210 --- /dev/null +++ b/src/testdir/test7.ok @@ -0,0 +1,2 @@ +#i:autowidth=1 (should be 1) +auto scaling seems ok diff --git a/src/testdir/test8.in b/src/testdir/test8.in new file mode 100644 index 0000000..0795269 --- /dev/null +++ b/src/testdir/test8.in @@ -0,0 +1,98 @@ +# This script tests file browsing capabilities. +sep="#"; +autocmd "" "" ""; +alias "sn" "stdout _filename;"; +alias "sf" "stdout _fileindex;"; +#alias "u" "load;reload;i:fresh=1;display;redisplay;"; +#alias "u" "load;reload;i:fresh=1;display;redisplay;"; +alias "U" "reload;redisplay;magnify;reload;"; +alias "u" "U;next '1';"; +#alias "sf" "stdout _fileindex;sn;"; +alias "n" "next 1;u;"; +#alias "n" "next 1;sleep 1;"; +stdout sep."this test is probably flawed"; +stdout sep."'next' testing:"; +n; +sf; +n; +sf; +stdout sep."'goto' testing:"; +goto 1;U;ffn=_filename; +goto 1;u; +sf; +goto 2;u; +sf; +goto 3;u; +sf; +stdout sep."'goto' testing first/last:"; +goto '^'; sf; +goto '$'; sf; +goto 'f'; sf; +goto 'l'; sf; +stdout sep."'goto' testing percent:"; +goto '0%'; sf; +goto '50%'; sf; +goto '100%'; sf; +stdout sep."'goto' testing percent, with file specifier:"; +goto '0%f'; sf; +goto '50%f'; sf; +goto '100%f'; sf; +stdout sep."'goto' testing percent, with page specifier:"; +goto '0%p'; sf; +goto '50%p'; sf; +goto '100%p'; sf; +stdout sep."'goto' testing + relative file jump:"; +goto '+1f'; sf; +goto '+1f'; sf; +goto '+1f'; sf; +goto '+2f'; sf; +goto '+2f'; sf; +goto '+2f'; sf; +goto '+3f'; sf; +goto '+3f'; sf; +goto '+3f'; sf; +stdout sep."'goto' testing - relative file jump:"; +goto '-1f'; sf; +goto '-1f'; sf; +goto '-1f'; sf; +goto '-2f'; sf; +goto '-2f'; sf; +goto '-2f'; sf; +goto '-3f'; sf; +goto '-3f'; sf; +goto '-3f'; sf; +stdout sep."'goto' testing + relative page jump:"; +goto '+1p'; sf; +goto '+1p'; sf; +goto '+1p'; sf; +goto '+2p'; sf; +goto '+2p'; sf; +goto '+2p'; sf; +goto '+3p'; sf; +goto '+3p'; sf; +goto '+3p'; sf; +stdout sep."'goto' testing - relative page jump:"; +goto '-1p'; sf; +goto '-1p'; sf; +goto '-1p'; sf; +goto '-2p'; sf; +goto '-2p'; sf; +goto '-2p'; sf; +goto '-3p'; sf; +goto '-3p'; sf; +goto '-3p'; sf; +stdout sep."'goto ?' testing"; +stdout sep.""._filename; +stdout sep."".ffn; +goto '?'._filename;U; sf; +goto '?'.ffn;U; sf; +stdout sep."'goto //' and 'goto +// testing"; +goto '/jpg/'; sf; +goto '/jpg/'; sf; +goto '+//'; sf; +goto '+//'; sf; +goto '/png/'; sf; +goto '/png/'; sf; +goto '+//'; sf; +goto '+//'; sf; +stdout sep."'goto' testing done"; diff --git a/src/testdir/test8.ok b/src/testdir/test8.ok new file mode 100644 index 0000000..eb7ad70 --- /dev/null +++ b/src/testdir/test8.ok @@ -0,0 +1,80 @@ +#this test is probably flawed +#'next' testing: +3 +2 +#'goto' testing: +2 +3 +1 +#'goto' testing first/last: +1 +3 +1 +3 +#'goto' testing percent: +1 +2 +3 +#'goto' testing percent, with file specifier: +1 +2 +3 +#'goto' testing percent, with page specifier: +3 +3 +3 +#'goto' testing + relative file jump: +1 +2 +3 +2 +1 +3 +3 +3 +3 +#'goto' testing - relative file jump: +2 +1 +3 +1 +2 +3 +3 +3 +3 +#'goto' testing + relative page jump: +3 +3 +3 +3 +3 +3 +3 +3 +3 +#'goto' testing - relative page jump: +3 +3 +3 +3 +3 +3 +3 +3 +3 +#'goto ?' testing +#../..//media/image.png +#../..//media/image.jpg +3 +1 +#'goto //' and 'goto +// testing +1 +1 +1 +1 +2 +3 +2 +3 +#'goto' testing done diff --git a/src/testdir/test9.in b/src/testdir/test9.in new file mode 100644 index 0000000..5802eb4 --- /dev/null +++ b/src/testdir/test9.in @@ -0,0 +1,10 @@ +# greatest common divisor +autocmd "" "" ""; +unalias "-a"; +# this test (and 11,13 too) gives a pipe error when /dev/zero is fed as stdin to fim +alias 'gcd' 'stdout "gcd(".p.",".q.")";stdout p;stdout q;while(p>q){p=p-q;if(p\"\n" +"FIM_AUTHOR_EMAIL = \"\"\n" +"FIM_AUTHOR_NAME = \"Michele Martone\"\n" +"FIM_CONFIGURATION = \"./configure CXXFLAGS=-O2 -pipe -I/home/dez/Downloads/tmp/code/poppler-0.24.2 -I/home/dez/Downloads/tmp/code/poppler-0.24.2/poppler -I/opt/librsb-debug/include/ -Wall -Wredundant-decls -Wno-switch -Wdisabled-optimization -Wpointer-arith -msse2 -march=native --enable-aa --enable-djvu --enable-ps --enable-imlib2 --enable-jasper --enable-xyz --enable-archive --disable-pdf --disable-poppler --enable-cacalib --enable-seek-magic --enable-long-int-vars --disable-convert --with-font-magnifying-factor=0 --enable-matrices-rendering LIBS= -L/opt/librsb-debug/lib /opt/librsb-debug/lib/librsb.a -lm -lhwloc -lz -fopenmp --no-create --no-recursion\"\n" +"FIM_TMP_FILENAME = \"/tmp/__FIM_TEMPORARY_FILE\"\n" +"FIM_VERSION = \"0.5-rc3\"\n" +"-FIM_BIG_ENDIAN " +"-FIM_BUGGED_CACHE " +"-FIM_CACHE_DEBUG " +"-FIM_DEFAULT_CONSOLEFONT " +"-FIM_KEEP_BROKEN_CONSOLE " +"-FIM_NOFIMRC " +"-FIM_NOHISTORY " +"-FIM_SMART_COMPLETION " +"-FIM_TRY_CONVERT " +"-FIM_TRY_DIA " +"-FIM_TRY_XCFTOPNM " +"-FIM_USE_CXX11 " +"-FIM_USE_DESIGNATED_INITIALIZERS " +"-FIM_WANTS_SLOW_RESIZE " +"-FIM_WANT_EXIFTOOL " +"-FIM_WANT_NOSCRIPTING " +"-FIM_WANT_NO_OUTPUT_CONSOLE " +"-FIM_WANT_STATIC_BINARY " +"-FIM_WANT_UNICODE " +"-FIM_WITH_NO_FRAMEBUFFER " +"-FIM_WITH_UFRAW " +"\nCXXFLAGS=-O2 -pipe -I/home/dez/Downloads/tmp/code/poppler-0.24.2 -I/home/dez/Downloads/tmp/code/poppler-0.24.2/poppler -I/opt/librsb-debug/include/ -Wall -Wredundant-decls -Wno-switch -Wdisabled-optimization -Wpointer-arith -msse2 -march=native -I/usr/local/include/libpng16 -I/usr/include -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT\n" diff --git a/src/yacc.ypp b/src/yacc.ypp new file mode 100644 index 0000000..2df597f --- /dev/null +++ b/src/yacc.ypp @@ -0,0 +1,482 @@ +/* $Id: yacc.ypp 803 2015-02-11 16:51:25Z dezperado $ */ +/* + yacc.ypp : Parser source file template + + (c) 2007-2015 Michele Martone + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/* + * There are conflicts in this grammar. + * Some of them are harmless (like the shift/reduce IF conflict), but some other can be a problem. + * + * Right now the problems is related to the unsuitability of strict Vim compliance to + * Fim's purposes. + * Therefore, a Bash-like grammar, with Vim-like terminal symbols operators seems to be the best mix right now. + */ + +/* + * versions older than 1.875 (circa 2003) are known to be not working or give problems with C++ + */ +/* note that some compatible versions fail interpreting this directive ! */ +/* (will be enabled in the future, as some old working versions don't support this ) */ +/*%require "1.875"*/ + +/* + * we expect just a 'dangling else' shift/reduce ambiguity + */ +//%expect 1 + +/* + * A GLR (Generalized Left Recursive) parser could be useful to deal better with disambiguation. + +%glr-parser +%expect-rr 2 + + * + */ + +%{ + +#include +#include +#include +#include "common.h" +#include "lex.h" +#include "fim.h" + +#ifndef yylex +#define yylex lexer->yylex +#endif + +/* prototypes */ +nodeType *opr(int oper, int nops, ...); +nodeType *fid(float f); +nodeType *con(fim_int value); +nodeType *fcon(float fValue); +nodeType *scon(fim_char_t* s); +nodeType *vscon(fim_char_t*s,int typeHint); +void freeNode(nodeType *p); +Var ex(nodeType *p); + +void yyerror(const fim_char_t *s); + +%} + +%union { + fim_int iValue; /* integer value */ + float fValue; /* float value */ + fim_char_t* sValue; + nodeType *nPtr; /* node pointer */ +}; + +%token INTEGER +//%token PIPE +%token STRING +%token SLASH_AND_REGEXP +%token QUOTED_FLOAT +%token UNQUOTED_FLOAT +%token IDENTIFIER +%token FILE_PATH +//%token NEWLINE +%token COMMAND //unimplemented yet +%token WHILE IF DO ELSE SYSTEM AND BAND OR BOR NOT +//%token NEWLINE +//%nonassoc IFX +//%nonassoc FI +//%nonassoc ELSE +//%left '$' +//lower priority +%left ';' +%nonassoc '}' '{' +%left OR BOR +%left AND BAND +%left GE LE EQ REGEXP_MATCH NE '>' '<' +%left '.' +%nonassoc '(' ')' +%left '%' +%left '+' +%left '-' +%left '*' '/' +%left NOT +//%nonassoc UMINUS +%left UMINUS +//higher priority +%type statement expression statement_list statements_block arguments conditional_statement if_statement loop_statement atomic_statements_block non_atomic_statements_block +// func_dec + +%% + +/* + * we explicitly specify the starting nonterminal symbol + * (will be enabled in the future, as some old working versions don't support this ) + */ +/*%start program;*/ + +/* + * a whole program parse tree + */ +program: + //function { ; /*exit(0);*/ } + //statement { ex($1); freeNode($1); } + {} + | statement_list { ex($1); freeNode($1); }//conflict +// | func_dec { } + ; + +/* + * a statement_list is a list of two or more statements concatenated by the ';' operator or separated by brackets or newlines + */ +statement_list: + statement { $$ = $1; } + | statement ';' statement_list { $$ = opr(';', 2, $1, $3); } + | non_atomic_statements_block statement_list{ $$ = opr(';', 2, $1, $2); } + | statements_block { $$ = $1; } + ; + +non_atomic_statements_block: + '{' statement_list '}' { $$ = opr(';', 2, $2, NULL); } + | INTEGER '{' statement_list '}' { if($1>0){$$ = opr('r',2,opr(';', 2, $3, NULL) ,con($1)); }} + | conditional_statement { $$ = $1; } + ; +/* + * a statements_block is a block of one or more statements/statement lists + */ +statements_block: + atomic_statements_block { $$ = $1; } + | non_atomic_statements_block { $$ = $1; } + ; + +/* + * a conditional statement + */ +conditional_statement: + if_statement { $$ = $1; } + | loop_statement { $$ = $1; } + ; + +/* + * if statements + */ +/* + * here follows a 'dangling else' ambiguity ( dates back to Algol 60 :) ) + */ +if_statement: + IF '(' expression ')' statements_block { $$ = opr(IF, 2, $3, $5); } + | IF '(' expression ')' statements_block ELSE statements_block { $$ = opr(IF, 3, $3, $5, $7); } //<- causes shift-reduce conflict.. +// | IF '(' expression ')' statement ';' ELSE statements_block { $$ = opr(IF, 3, $3, $5, $8); } //<- causes shift-reduce conflict.. +// | IF '(' expression ')' statements_block ELSE statement ';' { $$ = opr(IF, 3, $3, $5, $7); } //<- causes shift-reduce conflict.. + ; + +/* + * a loop statement + */ +loop_statement: + WHILE '(' expression ')' statements_block { $$ = opr(WHILE, 2, $3, $5); } + | DO statements_block WHILE '(' expression ')' { $$ = opr(WHILE, 2, $5, $2); } + ; + +atomic_statements_block: + statement ';' { $$ = opr(';', 2, $1, NULL); } + | statement ';' ';' { $$ = opr(';', 2, $1, NULL); /*a hack for handling redundancy */ } + | statement ';' ';' ';' { $$ = opr(';', 2, $1, NULL); /*a hack for handling redundancy */ } + ; + + +/* + * function declaration + */ +//func_dec: +// "function" IDENTIFIER '(' /*TODO: ARG_DECS */ ')' statements_block { ; } +// ; + +/* + * function: + */ + //function statement { ex($2); freeNode($2); } + //function statement_list { ex($2); freeNode($2); } +// function statement{ ex($2); freeNode($2); } +// | /* NULL */ +// ; + +/* + * a simple statement + */ +statement: + // ! 'shell-cmd' + NOT arguments { $$ = opr('x',2,scon(dupstr(FIM_FLT_SYSTEM)),$2); } +// | SYSTEM arguments { $$ = opr('x',2,scon(dupstr(FIM_FLT_SYSTEM)),$2); } + // [n]cmd + | INTEGER IDENTIFIER { if($1>0){$$ = opr('r',2,opr('x',1,scon($2)),con($1)); }} + // goto + | SLASH_AND_REGEXP { $$ = opr('x',2,scon(dupstr(FIM_FLT_GOTO)),opr('a',1,opr('a',1,scon(dupsqstr ($1))))); } + // magnification + | '+' UNQUOTED_FLOAT '%' { $$ = opr('x',2,scon(dupstr(FIM_FLT_SCALE)),opr('a',1,opr('a',1,scon(dupnstr('+',((float)$2),'%'))))); } + | '+' QUOTED_FLOAT '%' { $$ = opr('x',2,scon(dupstr(FIM_FLT_SCALE)),opr('a',1,opr('a',1,scon(dupnstr('+',((float)$2),'%'))))); } + | '+' INTEGER '%' { $$ = opr('x',2,scon(dupstr(FIM_FLT_SCALE)),opr('a',1,opr('a',1,scon(dupnstr('+',((double)$2),'%'))))); } + | '*' UNQUOTED_FLOAT { $$ = opr('x',2,scon(dupstr(FIM_FLT_SCALE)),opr('a',1,opr('a',1,scon(dupnstr('*',((float)$2)))))); } + | '*' QUOTED_FLOAT { $$ = opr('x',2,scon(dupstr(FIM_FLT_SCALE)),opr('a',1,opr('a',1,scon(dupnstr('*',((float)$2)))))); } + | '*' INTEGER { $$ = opr('x',2,scon(dupstr(FIM_FLT_SCALE)),opr('a',1,opr('a',1,scon(dupnstr('*',((float)$2)))))); } + | UNQUOTED_FLOAT '%'{if($1>0.0){$$=opr('x',2,scon(dupstr(FIM_VID_SCALE)),opr('a',1,opr('a',1,scon(dupnstr(((float)$1)/100.0f)))));}else { $$ = opr('x',2,scon(dupstr(FIM_FLT_SCALE)),opr('a',1,opr('a',1,scon(dupnstr('-',-((float)$1),'%'))))); } } + | QUOTED_FLOAT '%'{if($1>0.0){$$=opr('x',2,scon(dupstr(FIM_VID_SCALE)),opr('a',1,opr('a',1,scon(dupnstr(((float)$1)/100.0f)))));}else { $$ = opr('x',2,scon(dupstr(FIM_FLT_SCALE)),opr('a',1,opr('a',1,scon(dupnstr('-',-((float)$1),'%'))))); } } + | INTEGER'%'{{$$=opr('x',2,scon(dupstr(FIM_VID_SCALE)),opr('a',1,opr('a',1,scon(dupnstr(((float)$1),'%')))));}} + // minification (yes, minification) + | '-' UNQUOTED_FLOAT '%' { $$ = opr('x',2,scon(dupstr(FIM_FLT_SCALE)),opr('a',1,opr('a',1,scon(dupnstr('-',((float)$2),'%'))))); } + | '-' QUOTED_FLOAT '%' { $$ = opr('x',2,scon(dupstr(FIM_FLT_SCALE)),opr('a',1,opr('a',1,scon(dupnstr('-',((float)$2),'%'))))); } + | '-' INTEGER '%' { $$ = opr('x',2,scon(dupstr(FIM_FLT_SCALE)),opr('a',1,opr('a',1,scon(dupnstr('-',((float)$2),'%'))))); } + // $ and ^ work too (see lex.lex) + | INTEGER { $$ = opr('x',2,scon(dupstr(FIM_FLT_GOTO)),opr('a',1,opr('a',1,scon(dupnstr( $1))))); } + | '-' INTEGER { $$ = opr('x',2,scon(dupstr(FIM_FLT_GOTO)),opr('a',1,opr('a',1,scon(dupnstr('-',$2))))); } + // cmd .. + | IDENTIFIER { $$ = opr('x',1,scon($1)); } + | IDENTIFIER FILE_PATH { +#ifdef FIM_SMART_COMPLETION + /* + This patch was thought with filename completion in mind, in a way + the user is not obligated to quote the filename if it is assured its existence. + */ + /* + FIXME : are we sure $2 should not be freed here ? + */ + $$ = opr('x',2,scon($1),opr('a',1,scon(dupstr($2)))); + fim_free($2); +#else + $$ = opr('x',2,scon(FIM_FLT_ECHO),opr('a',1,scon("Please quote or double-quote your argument or enable FIM_SMART_COMPLETION at compile time\n"))); +#endif + } + | IDENTIFIER arguments { $$ = opr('x',2,scon($1),$2); /* here I would like to use FIM_SMART_COMPLETION but for now it works with the FILE_PATH trick above. */ } + | INTEGER IDENTIFIER arguments { if($1>0){$$ = opr('r',2,opr('x',2,scon($2),$3),con($1)); }} + // assignment + | IDENTIFIER '=' expression { $$ = opr('=', 2, vscon($1,'a'), $3); } + // semicolons can be added arbitrarily with no harm (not so Vim'ish, though) +// | statement ';' { $$ = $1; } // new +// | NEWLINE { /* this still doesn't work as we would like to */ } +// | error { yyerrok ; /* can be evil */ } + ; + +/* + * command arguments are separated arguments + * + * Here a reduce/reduce problem arise: + * IDENTIFIER STRING '-' STRING -> IDENTIFIER ARG ARG -> IDENTIFIER ARGS or + * IDENTIFIER STRING '-' STRING -> IDENTIFIER ARG ARG -> IDENTIFIER ARGS ? + * + * should be interpeted as a a single expression or as two arguments ? + * + * the same for : + * + * IDENTIFIER INTEGER '-' INTEGER -> IDENTIFIER ARG ARG -> IDENTIFIER ARGS or + * IDENTIFIER INTEGER '-' INTEGER -> IDENTIFIER EXPR -> IDENTIFIER ARGS ? + * + * Vim seems to handle this in a context (command) dependent way: + * + * :echo -1 -1 + * -2 + * vs + * + * :imap + */ +arguments: + expression { $$ = opr('a',1, $1 ); } + | expression arguments { $$ = opr('a', 2, $1, $2); } + ; + +/* + * a command argument is an expressionession or a concatenation of expressionessions + */ +//arg: +// expression { $$ = opr('a',1, $1 ); } +// | expression '.' expression { $$ = opr('.', 2, $1, $3); } +// ; + +/* + * expressionessions (mostly numerical: strings are not well supported right now) + */ +expression: + '(' expression ')' { $$ = $2; } + | expression '.' expression { $$ = opr('.', 2, $1, $3); } + | NOT expression { $$ = opr('!', 1, $2); } + | expression '%' expression { $$ = opr('%', 2, $1, $3); } + | expression '+' expression { $$ = opr('+', 2, $1, $3); } + | expression '-' expression { $$ = opr('-', 2, $1, $3); } + | expression '*' expression { $$ = opr('*', 2, $1, $3); } + | expression '/' expression { $$ = opr('/', 2, $1, $3); } + | expression '<' expression { $$ = opr('<', 2, $1, $3); } + | expression '>' expression { $$ = opr('>', 2, $1, $3); } + | expression OR expression { $$ = opr( OR , 2, $1, $3); } + | expression BOR expression { $$ = opr( BOR , 2, $1, $3); } + | expression AND expression { $$ = opr( AND, 2, $1, $3); } + | expression BAND expression { $$ = opr( BAND, 2, $1, $3); } + | expression GE expression { $$ = opr(GE, 2, $1, $3); } + | expression LE expression { $$ = opr(LE, 2, $1, $3); } + | expression NE expression { $$ = opr(NE, 2, $1, $3); } + | expression EQ expression { $$ = opr(EQ, 2, $1, $3); } + | expression REGEXP_MATCH expression { $$ = opr(REGEXP_MATCH, 2, $1, $3); } + /* + * writing the same next rule with '-' instead UMINUS + * would cause lots of conflicts, because UMINUS gets + * caught by the lexer, contrarily to the lone '-' string. + */ +// | UMINUS expression { $$ = opr('-', 1, $2); } // conflict +// | UMINUS expression { $$ = opr('-', 1, $2); } // conflict + | '-' expression %prec UMINUS { $$ = opr(UMINUS, 1, $2); } //conflicts +// | '(' '-' expression ')' %prec UMINUS { $$ = opr('-', 1, $3); } // conflict +// | '`' IDENTIFIER '`' { $$ = opr('x',1,scon($2)); } + | IDENTIFIER { $$ = vscon($1,'v'); } + | INTEGER { $$ = con($1); } + | QUOTED_FLOAT { $$ = fcon($1); } + | UNQUOTED_FLOAT { $$ = fcon($1); } + | STRING { $$ = scon($1); } + ; + +%% +#define SIZEOF_NODETYPE ((fim_char_t *)&p->con - (fim_char_t *)p) + +/* + * string constant handling + */ +nodeType *scon(fim_char_t*s) +{ + if(s==NULL)yyerror("TOKEN NULL!\n"); + nodeType *p; + size_t nodeSize; + /* allocate node */ + nodeSize = SIZEOF_NODETYPE + sizeof(stringNodeType); + if ((p =(nodeType*) malloc(nodeSize)) == NULL) + yyerror(FIM_EMSG_OUT_OF_MEM); + /* copy information */ + p->type = stringCon; + p->scon.s=s; + return p; +} + +nodeType *vscon(fim_char_t*s,int typeHint) +{ + /* + * NOTE: + * + * The following code is much more complicated than it could be. + * But I like it in this way :) + */ +#ifdef FIM_RANDOM +#ifndef FIM_BIG_ENDIAN +#if ((SIZEOF_INT)>=8) + if( *(int*)(s+0) == 0x006d6f646e6172 ) // ..modnar +#else + /* + * Warning : this is LSB order, so it is not portable code. + */ + if( *(int*)(s+0) == 0x646e6172 // dnar + && (*(int*)(s+4)<<8)== 0x006d6f00 ) // .mo. +#endif +#else + /* WARNING : UNTESTED */ +#if ((SIZEOF_INT)>=8) + if( *(int*)(s+0) == 0x72616e646f6d00 ) // random.. +#else + if( *(int*)(s+0) == 0x646e6172 // rand + && (*(int*)(s+4)<<8)== 0x006f6d00 ) // .om. +#endif +#endif + return con(fim_rand()); +#endif + nodeType *p=scon(s); + if(p)p->type = vId; + if(p)p->typeHint = typeHint; + return p; +} + + +nodeType *fcon(float fValue) +{ + nodeType *p; + size_t nodeSize; + /* allocate node */ + nodeSize = SIZEOF_NODETYPE + sizeof(fidNodeType); + if ((p =(nodeType*) malloc(nodeSize)) == NULL) + yyerror(FIM_EMSG_OUT_OF_MEM); + /* copy information */ + p->type = floatCon; + p->fid.f = fValue; + return p; +} + + + +nodeType *con(fim_int value) +{ + nodeType *p; + size_t nodeSize; + /* allocate node */ + nodeSize = SIZEOF_NODETYPE + sizeof(conNodeType); + if ((p =(nodeType*) malloc(nodeSize)) == NULL) + yyerror(FIM_EMSG_OUT_OF_MEM); + /* copy information */ + p->type = intCon; + p->con.value = value; + return p; +} + + + + +nodeType *opr(int oper, int nops, ...) +{ + va_list ap; + nodeType *p; + size_t nodeSize; + int i; + /* allocate node */ + nodeSize = SIZEOF_NODETYPE + sizeof(oprNodeType) + + (nops - 1) * sizeof(nodeType*); + if ((p =(nodeType*) malloc(nodeSize)) == NULL) + yyerror(FIM_EMSG_OUT_OF_MEM); + /* copy information */ + p->type = typeOpr; + p->opr.oper = oper; + p->opr.nops = nops; + va_start(ap, nops); + for (i = 0; i < nops; i++) + p->opr.op[i] = va_arg(ap, nodeType*); + va_end(ap); + return p; +} + +void freeNode(nodeType *p) +{ + int i; + if (!p) return; + if (p->type == stringCon) + {fim_free(p->scon.s);p->scon.s=NULL;} + if (p->type == vId) + {fim_free(p->scon.s);p->scon.s=NULL;} + if (p->type == typeOpr) + { + for (i = 0; i < p->opr.nops; i++) + freeNode(p->opr.op[i]); + } + free (p); +} + +void yyerror(const fim_char_t *s) +{ + //fprintf(stdout, "%s \n", s); + /* omitting std:: causes error on darwin gcc */ + //std::cout << s << "\n"; + fim::cout << s << FIM_SYM_ENDL; +} + + diff --git a/var/fonts/Lat15-Terminus16.psf b/var/fonts/Lat15-Terminus16.psf new file mode 100644 index 0000000..b63122b Binary files /dev/null and b/var/fonts/Lat15-Terminus16.psf differ -- cgit v1.2.3 From c7a34d4a521b626b5fc49ec1ce673eb49fc6a559 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Laboissi=C3=A8re?= Date: Sun, 15 Aug 2021 05:28:18 -0300 Subject: Import fim_0.5.3-7.debian.tar.xz [dgit import tarball fim 0.5.3-7 fim_0.5.3-7.debian.tar.xz] --- README.Debian | 11 + changelog | 200 +++++++++ clean | 2 + control | 49 +++ copyright | 32 ++ docs | 6 + fim.doc-base | 18 + patches/compile-with-gcc-10.patch | 75 ++++ patches/compile-with-gcc-9.patch | 27 ++ patches/reproducible-build.patch | 32 ++ patches/series | 4 + patches/update-configure-ac.patch | 839 ++++++++++++++++++++++++++++++++++++++ rules | 17 + source/format | 1 + source/options | 1 + tests/control | 3 + tests/run-tests | 5 + upstream/metadata | 4 + upstream/signing-key.asc | 57 +++ watch | 3 + 20 files changed, 1386 insertions(+) create mode 100644 README.Debian create mode 100644 changelog create mode 100644 clean create mode 100644 control create mode 100644 copyright create mode 100644 docs create mode 100644 fim.doc-base create mode 100644 patches/compile-with-gcc-10.patch create mode 100644 patches/compile-with-gcc-9.patch create mode 100644 patches/reproducible-build.patch create mode 100644 patches/series create mode 100644 patches/update-configure-ac.patch create mode 100755 rules create mode 100644 source/format create mode 100644 source/options create mode 100644 tests/control create mode 100755 tests/run-tests create mode 100644 upstream/metadata create mode 100644 upstream/signing-key.asc create mode 100644 watch diff --git a/README.Debian b/README.Debian new file mode 100644 index 0000000..55cecd8 --- /dev/null +++ b/README.Debian @@ -0,0 +1,11 @@ +fim for Debian +-------------- + + +There are lots of ./configure options and customizations missing in +this binary build (e.g.: SDL (X) support). + +If you are interested in them, please read fim's documentation and +build it from sources. + + -- Michele Martone Wed, 25 Feb 2009 01:06:16 +0100 diff --git a/changelog b/changelog new file mode 100644 index 0000000..0b60d84 --- /dev/null +++ b/changelog @@ -0,0 +1,200 @@ +fim (0.5.3-7) unstable; urgency=medium + + * Upload to unstable + + -- Rafael Laboissière Sun, 15 Aug 2021 05:28:18 -0300 + +fim (0.5.3-6) experimental; urgency=medium + + * d/control: Force build-dependency on autoconf >= 2.71 + + -- Rafael Laboissière Fri, 09 Jul 2021 14:03:23 -0300 + +fim (0.5.3-5) experimental; urgency=medium + + * d/control: Bump Standards-Version to 4.5.1 (no changes needed) + * d/rules: Use execute_after_ instead of override_dh_auto_install + * d/p/update-configure-ac.patch: New patch + + -- Rafael Laboissière Fri, 09 Jul 2021 06:35:24 -0300 + +fim (0.5.3-4) unstable; urgency=medium + + [ Debian Janitor ] + * Use secure URI in Homepage field. + * Set field Upstream-Name in debian/copyright. + * Drop unnecessary dependency on dh-autoreconf. + + -- Rafael Laboissière Fri, 31 Jul 2020 17:53:29 -0300 + +fim (0.5.3-3) unstable; urgency=medium + + * d/control: + + Bump Standards-Version to 4.5.0 (no changes needed) + + Bump debhelper compatibitlity level to 13 + * d/p/compile-with-gcc-10.patch: New patch (Closes: #957202) + * d/u/metadata: New file + + -- Rafael Laboissière Mon, 20 Jul 2020 03:35:22 -0300 + +fim (0.5.3-2) unstable; urgency=medium + + * d/p/compile-with-gcc-9.patch: New patch (Closes: #925679) + * d/p/reproducible-build.patch: New patch. + Thanks to Chris Lamb (Closes: #928183) + + -- Rafael Laboissiere Sat, 13 Jul 2019 07:12:26 -0300 + +fim (0.5.3-1) unstable; urgency=medium + + * New upstream version 0.5.3 + This is not really a new upstream version, but a change in the + version numbering scheme, replacing the "-rc" by ".". This + avoids the Lintian warning about hyphen in the upstream part of + the Debian changelog version. + * d/watch: Mangle upstream version according to new scheme + * d/control: Bump Standards-Version to 4.4.0 (no changes needed) + + -- Rafael Laboissiere Fri, 12 Jul 2019 20:10:41 -0300 + +fim (0.5~rc3-4) unstable; urgency=medium + + * d/control: + + Add Rules-Requires-Root: no + + Bump Standards-Version to 4.3.0 + + Bump debhelper to compat level 12 + + -- Rafael Laboissiere Sun, 06 Jan 2019 17:21:28 -0200 + +fim (0.5~rc3-3) unstable; urgency=medium + + * Bump debhelper compatibility level to 11 + * d/control: Bump Standards-Version to 4.1.4 (no changes needed) + * Run unit tests (both at build time and for autopkgtest) + * d/fim.doc-base: Register HTML and TXT documentation files + + -- Rafael Laboissiere Sun, 27 May 2018 15:16:45 -0300 + +fim (0.5~rc3-2) unstable; urgency=medium + + * d/control: + + Bump Standards-Version to 4.1.2 (no changes needed) + + Use URLs from Debian's GitLab server + * d/watch: Use secure URL + + -- Rafael Laboissiere Sat, 23 Dec 2017 07:05:58 -0200 + +fim (0.5~rc3-1) unstable; urgency=medium + + [ Rafael Laboissiere ] + * d/copyright: Use secure URL in Format + * d/control: Drop useless build-dependency on dh-autoreconf + * d/control: Bump Standards-version to 4.0.0 (no changes needed) + * d/watch: Bump to format version 4 + * d/control: Change Priority to optional. + The priority extra is deprecated in Debian Policy 4.0.1.0. + + [ Michele Martone ] + * New upstream version 0.5~rc3 + * Debian 0.5~rc2 patches integrated in 0.5~rc3 upstream. + + -- Rafael Laboissiere Tue, 08 Aug 2017 02:55:26 -0300 + +fim (0.5~rc2-5) unstable; urgency=medium + + [ Michele Martone ] + * d/control: Added libfl-dev to the Build-Depends list. + Thanks to Helmut Grohne for notification. (Closes: #846424) + + -- Rafael Laboissiere Mon, 05 Dec 2016 21:31:53 -0200 + +fim (0.5~rc2-4) unstable; urgency=medium + + [ Rafael Laboissiere ] + * Change email address of Michele Martone + + [ Michele Martone ] + * d/control: Updated and corrected the "Description:" field + + -- Rafael Laboissiere Sat, 12 Nov 2016 12:35:30 -0200 + +fim (0.5~rc2-3) unstable; urgency=medium + + * d/p/allow-concurrent-bison.patch: New patch (Closes: 842751) + + -- Rafael Laboissiere Wed, 02 Nov 2016 09:48:49 -0200 + +fim (0.5~rc2-2) unstable; urgency=medium + + * Bump debhelper compatibility level to 10 + * d/control: + + Add Vcs-* URL fields + + Add myself to the list of Uploaders + + Bump Standards-Version to 3.9.8 (no changes needed) + + Drop article at the beginning of package synopsis + * d/rules: + + Avoid installation of duplicated upstream changelog + + Use hardening flags + + Build-depends on groff + * d/watch: Ignore the "-trunk" upstream tarballs + * Use upstream tarball cryptographic signature + + d/watch: Add pgpsigurlmangle option + + d/u/signing-key.asc: Add file with GPG key of upstream author + * d/s/options: Add file with extend-diff-ignore list + * d/docs: Drop duplicated entry + * d/p/endianness-robust.patch: Add patch (Closes: 841471) + + -- Rafael Laboissiere Mon, 31 Oct 2016 06:49:34 -0200 + +fim (0.5~rc2-1) unstable; urgency=medium + + * New upstream release snapshot (Closes: #814673). + * Use watch file version 4. + * Switch to autoreconf. + * Wrap-and-sort + * Remove autistici from watch file. + + -- Gianfranco Costamagna Wed, 17 Feb 2016 08:56:58 +0100 + +fim (0.5~rc1-1) unstable; urgency=medium + + * New upstream release snapshot. + * Bump std-version to 3.9.7, no changes required. + * Use autoreconf + * Add libsdl1.2-dev and libexif-dev to build-dependencies. + + -- Michele Martone Thu, 04 Feb 2016 14:44:43 +0100 + +fim (0.3-beta-prerelease-1.3) unstable; urgency=low + + * Non-maintainer upload. + * Fix "Please Build-Depends on libjpeg-dev, not libjpeg62-dev": + do as the bug report request. + (Closes: #633935) + * Also fix "FTBFS with libpng 1.5" while we're there: apply patch from + Nobuhiro Iwamatsu: preparation for libpng 1.5 transition. + (Closes: #636968) + + -- gregor herrmann Thu, 26 Jan 2012 21:41:23 +0100 + +fim (0.3-beta-prerelease-1.2) unstable; urgency=high + + * Updated to svn revision 273 + * Fixes compilation problems on sid / g++-4.4 (Closes: #560453) (Closes: #564233) + * Replaced libreadline5-dev dependency with libreadline-dev (Closes: #553755) + * Enabled djvu files rendering. + + -- Michele Martone Thu, 21 Jan 2010 03:25:24 +0100 + +fim (0.3-beta-prerelease-1.1) unstable; urgency=low + + * Non-maintainer upload. + * Build for all archs (Closes: #541696) + + -- Moritz Muehlenhoff Tue, 13 Oct 2009 23:47:48 +0200 + +fim (0.3-beta-prerelease-1) unstable; urgency=low + + * Initial release (Closes: #532261) + + -- Michele Martone Sun, 26 Jul 2009 13:37:50 +0200 diff --git a/clean b/clean new file mode 100644 index 0000000..e62f299 --- /dev/null +++ b/clean @@ -0,0 +1,2 @@ +src/testdir/*.out +src/testdir/test.log diff --git a/control b/control new file mode 100644 index 0000000..0a897e0 --- /dev/null +++ b/control @@ -0,0 +1,49 @@ +Source: fim +Section: graphics +Priority: optional +Maintainer: Michele Martone +Uploaders: Rafael Laboissière +Build-Depends: autoconf (>= 2.71), + bison, + debhelper-compat (= 13), + flex, + groff, + libaa1-dev, + libdjvulibre-dev, + libexif-dev, + libgif-dev, + libjpeg-dev, + libpng-dev, + libreadline-dev, + libsdl1.2-dev, + libtiff-dev, + libfl-dev +Standards-Version: 4.5.1 +Homepage: https://savannah.nongnu.org/projects/fbi-improved/ +Vcs-Git: https://salsa.debian.org/debian/fim.git +Vcs-Browser: https://salsa.debian.org/debian/fim +Rules-Requires-Root: no + +Package: fim +Architecture: any +Depends: ${misc:Depends}, ${shlibs:Depends} +Description: scriptable frame buffer, X.org and ascii art image viewer + FIM is a highly customizable scriptable image viewer targeted at the + users who are comfortable with software like the Vim text editor or the Mutt + mail user agent. FIM aims to be a "swiss army knife" for viewing images. + Its code derives from the "Fbi" framebuffer image viewer by Gerd Hoffmann. + FIM is multidevice: it has X support via the SDL library and ascii art output + via the aalib library. + . + It supports image description files, file search and filtering using regular + expressions on filenames and descriptions, caption display, customizable + status line, EXIF tags display, EXIF-based image rotation, recursive directory + traversal, reading from stdin, and can e.g. jump between two images + remembering scale and position. + . + It can speed up loading by image caching and speed up scaling with mipmaps. + It offers GNU readline command line autocompletion and history, + completely customizable key bindings, external/internal (if-while based) + scriptability (through return codes, standard input/output, and commands given + at invocation time, an initialization file, Vim-like autocommands), and much + more. diff --git a/copyright b/copyright new file mode 100644 index 0000000..fa7dfb3 --- /dev/null +++ b/copyright @@ -0,0 +1,32 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Source: http://savannah.nongnu.org/projects/fbi-improved/ +Upstream-Contact: Michele Martone +Upstream-Name: fim + +Files: * +Copyright: 2008-2016 Michele Martone +License: GPL-2.0+ + +Files: debian/* +Copyright: 2009 Michele Martone + 2016 Gianfranco Costamagna + 2016-2020 Rafael Laboissière +License: GPL-2.0+ + +License: GPL-2.0+ + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, + or (at your option) any later version. + . + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + . + On Debian systems, the complete text of the GNU General Public License + can be found in /usr/share/common-licenses/GPL-2 file. diff --git a/docs b/docs new file mode 100644 index 0000000..6443ccc --- /dev/null +++ b/docs @@ -0,0 +1,6 @@ +BUGS +FAQ.TXT +NEWS +README +README.FIRST +TODO diff --git a/fim.doc-base b/fim.doc-base new file mode 100644 index 0000000..23fe5d0 --- /dev/null +++ b/fim.doc-base @@ -0,0 +1,18 @@ +Document: fim-documentation +Title: Tutorial & Miscellaneous documentation for Fim +Author: Michele Martone +Abstract: Fim stands for Fbi IMproved. Fbi is a framebuffer based + image viewer, made by Gerd Knorr, and Fim is primarily an interface + rework applied roughly as a patch to it, and is its main purpose is + to boost the features present in Fbi and to add new ones, to achieve + configurability and use flexibility, as well as usage speed. This + document provide miscellaneous documentation and a tutorial for Fim. +Section: Viewers + +Format: HTML +Index: /usr/share/doc/fim/FIM.html +Files: /usr/share/doc/fim/FIM.html + +Format: Text +Index: /usr/share/doc/fim/FIM.TXT.gz +Files: /usr/share/doc/fim/FIM.TXT.gz diff --git a/patches/compile-with-gcc-10.patch b/patches/compile-with-gcc-10.patch new file mode 100644 index 0000000..df7bc97 --- /dev/null +++ b/patches/compile-with-gcc-10.patch @@ -0,0 +1,75 @@ +Description: Compile with GCC 10 + This patch remove a non-active code (inside "#if 0") in file + src/fim.cpp which, according to the upstream author, contains + "leftovers from the old man file". This removal seems harmless and + allows the package to be built with GCC 10. +Author: Rafael Laboissière +Bug-Debian: https://bugs.debian.org/957202 +Forwarded: https://savannah.nongnu.org/bugs/index.php?58399#comment1 +Last-Update: 2020-07-20 + +--- fim-0.5.3.orig/src/fim.cpp ++++ fim-0.5.3/src/fim.cpp +@@ -302,62 +302,6 @@ FIM_NULL + {0,0,0,0,0,0} + }; + +-#if 0 +-// leftovers from the old man file; shall adapt these using .\" +- .TP +- .B -f font +- Set font. This can be either a pcf console font file or a X11 font +- spec. Using X11 fonts requires a font server (The one specified in +- the environment variable FONTSERVER or on localhost). The FBFONT +- environment variable is used as default. If unset, fim will +- fallback to 10x20 (X11) / lat1u-16.psf (console). +- .TP +- .B --autoup +- Like autozoom, but scale up only. +- .TP +- .B --autodown +- Like autozoom, but scale down only. +- .TP +- .B -u +- Randomize the order of the filenames. +- .TP +- .B -e +- Enable editing commands. +- .TP +- .B -b +- create backup files (when editing images). +- .TP +- .B -p +- preserve timestamps (when editing images). +- .TP +- .B --comments +- Display comment tags (if present) instead of the filename. Probaby +- only useful if you added reasonable comments yourself (using wrjpgcom +- for example), otherwise you likely just find texts pointing to the +- software which created the image. +- P pause the slideshow (if started with -t, toggle) +- {number}g jump to image {number} +- .SH EDIT IMAGE +- fim also provides some very basic image editing facilities. You have +- to start fim with the -e switch to use them. +- .P +- .nf +- Shift+D delete image +- R rotate 90° clockwise +- L rotate 90° counter-clock wise +- .fi +- .P +- The delete function actually wants a capital letter 'D', thus you have +- to type Shift+D. This is done to avoid deleting images by mistake +- because there are no safety bells: If you ask fim to delete the image, +- it will be deleted without questions asked. +- .P +- The rotate function actually works for JPEG images only because it +- calls the jpegtran command to perform a lossless rotation if the image. +- It is especially useful if you review the images of your digital +- camera. +-#endif +- + const int fim_options_count=sizeof(fim_options)/sizeof(fim_options_t); + struct option options[fim_options_count]; + diff --git a/patches/compile-with-gcc-9.patch b/patches/compile-with-gcc-9.patch new file mode 100644 index 0000000..8b75c78 --- /dev/null +++ b/patches/compile-with-gcc-9.patch @@ -0,0 +1,27 @@ +Description: Adjust code for compilation against GCC 9 +Author: Rafael Laboissiere +Forwarded: https://savannah.nongnu.org/bugs/index.php?58792 +Last-Update: 2019-07-13 + +--- fim-0.5.3.orig/src/Var.h ++++ fim-0.5.3/src/Var.h +@@ -175,7 +175,7 @@ class Var + if(sizeof(fim_int)==sizeof(int)) + sprintf(buf,"%d",(int)i); + else +- sprintf(buf,"%lld",(int64_t)i); ++ sprintf(buf,"%ld",(int64_t)i); + } + else + if(type=='f') +--- fim-0.5.3.orig/src/fim_types.h ++++ fim-0.5.3/src/fim_types.h +@@ -64,7 +64,7 @@ + typedef int fim_var_t; /* a type for fim's variable types */ + typedef int fim_str_t; /* a type for stdin/stdout streams */ + typedef int fim_sys_int; /* always int */ +- typedef int fim_color_t; /* >= 4 bytes */ ++ typedef unsigned int fim_color_t; /* >= 4 bytes */ + + typedef int fim_ts_t; /* a type for time, in seconds */ + typedef int fim_tms_t; /* a type for time, in milliseconds */ diff --git a/patches/reproducible-build.patch b/patches/reproducible-build.patch new file mode 100644 index 0000000..475a770 --- /dev/null +++ b/patches/reproducible-build.patch @@ -0,0 +1,32 @@ +Description: Make the build reproducible +Author: Chris Lamb +Forwarded: https://savannah.nongnu.org/bugs/index.php?58793 +Reviewed-by: Rafael Laboissière +Last-Update: 2019-04-29 + +--- fim-0.5~rc3.orig/src/fim.cpp ++++ fim-0.5~rc3/src/fim.cpp +@@ -1603,13 +1603,6 @@ fim_perr_t main(int argc,char *argv[]) + #ifdef FIM_CONFIGURATION + "Configuration invocation: " FIM_CONFIGURATION "\n" + #endif /* FIM_CONFIGURATION */ +- #ifdef CXXFLAGS +- "Compile flags: CXXFLAGS=" CXXFLAGS +- #ifdef CFLAGS +- " CFLAGS=" CFLAGS +- #endif /* CFLAGS */ +- "\n" +- #endif /* CXXFLAGS */ + "Fim options (features included (+) or not (-)):\n" + #include "version.h" + /* i think some flags are missing .. */ +--- fim-0.5~rc3.orig/src/Makefile.am ++++ fim-0.5~rc3/src/Makefile.am +@@ -51,7 +51,6 @@ version.h: ../config.h + $(ECHO) "\"\n\"" >> $@ + $(GREP) define $< | $(GREP) FIM.*'"' | LC_ALL=C $(SORT) | $(SED) 's/^#//g;s/define //g;s/^\([A-Za-z0-9_]*\) "\(.*\)"$$/"\1 = \\"\2\\"\\n"/g' >> $@ + $(GREP) undef $< | $(GREP) FIM | LC_ALL=C $(SORT) | $(SED) 's/^#//g;s/.*undef //g;s/^\([A-Za-z0-9_]*\).\+$$/-\1 /g;s/^/\"/g;s/$$/\"/g' >> $@ +- $(ECHO) '"\n'CXXFLAGS=$(CXXFLAGS)'\n"' >> $@ + + help.cpp: fim.h + $(ECHO) -e "#ifdef FIM_WANT_INLINE_HELP\n" > $@ diff --git a/patches/series b/patches/series new file mode 100644 index 0000000..a2d3d75 --- /dev/null +++ b/patches/series @@ -0,0 +1,4 @@ +compile-with-gcc-9.patch +reproducible-build.patch +compile-with-gcc-10.patch +update-configure-ac.patch diff --git a/patches/update-configure-ac.patch b/patches/update-configure-ac.patch new file mode 100644 index 0000000..c82a192 --- /dev/null +++ b/patches/update-configure-ac.patch @@ -0,0 +1,839 @@ +Description: Update configure.ac + This patch is the result of running autoupdate +Author: Rafael Laboissière +Forwarded: https://savannah.nongnu.org/bugs/?60900 +Last-Update: 2021-07-09 + +--- fim-0.5.3.orig/configure.ac ++++ fim-0.5.3/configure.ac +@@ -1,10 +1,10 @@ + dnl Process this file with autoconf to produce a configure script. + dnl $LastChangedDate: 2017-07-19 15:46:18 +0200 (Wed, 19 Jul 2017) $ + +-AC_PREREQ([2.54]) ++AC_PREREQ([2.71]) + + # we'll move forward, one day or another +-#AC_PREREQ([2.61]) ++#AC_PREREQ([2.71]) + + # for future use, too + #AC_PROG_CC(cc gcc) +@@ -46,7 +46,7 @@ AC_MSG_NOTICE([ + + # + #AM_INIT_AUTOMAKE($PACKAGE_NAME, $PACKAGE_VERSION) +-AC_GNU_SOURCE ++AC_USE_SYSTEM_EXTENSIONS + #AC_MANTAINER_MODE + #AC_CANONICAL_HOST + +@@ -97,7 +97,7 @@ else + fi + AC_MSG_RESULT($fim_cv_prefix) + +-AC_ISC_POSIX ++AC_SEARCH_LIBS([strerror],[cposix]) + #AM_C_PROTOTYPES + if test "x$U" != "x"; then + AC_MSG_ERROR(Compiler not ANSI compliant) +@@ -122,7 +122,7 @@ AC_CHECK_FUNC([rsb_lib_init]) + + AC_CHECK_LIB([m],[pow]) + AC_CHECK_LIB([fl],[yylex]) +-AC_ARG_ENABLE(graphicsmagick, AC_HELP_STRING([--enable-graphicsmagick], [Enable GraphicsMagick library support (EXPERIMENTAL).]), [ if test x$enableval != xno ; then fim_handle_graphicsmagick=yes ; fi ] ) ++AC_ARG_ENABLE(graphicsmagick, AS_HELP_STRING([--enable-graphicsmagick],[Enable GraphicsMagick library support (EXPERIMENTAL).]), [ if test x$enableval != xno ; then fim_handle_graphicsmagick=yes ; fi ] ) + AC_CHECK_LIB([GraphicsMagick],[GetMagickVersion], + [ + if test x"$fim_handle_graphicsmagick" = x"yes" ; then +@@ -133,7 +133,7 @@ if test x"$fim_handle_graphicsmagick" = + fi + ], []) + +-AC_ARG_ENABLE(imlib2, AC_HELP_STRING([--enable-imlib2], [Enable Imlib2 library support (EXPERIMENTAL,INCOMPLETE).]), [ if test x$enableval != xno ; then fim_handle_imlib2=yes ; fi ] ) ++AC_ARG_ENABLE(imlib2, AS_HELP_STRING([--enable-imlib2],[Enable Imlib2 library support (EXPERIMENTAL,INCOMPLETE).]), [ if test x$enableval != xno ; then fim_handle_imlib2=yes ; fi ] ) + AC_CHECK_LIB([Imlib2],[imlib_create_image], + [ + if test x"$fim_handle_imlib2" = x"yes" ; then +@@ -187,7 +187,7 @@ have_default_bindings=yes + have_default_mapping=yes + have_default_config=yes + +-AC_ARG_ENABLE(default_bindings, AC_HELP_STRING([--disable-default-bindings], [Builtin default minimal key binding]), ++AC_ARG_ENABLE(default_bindings, AS_HELP_STRING([--disable-default-bindings],[Builtin default minimal key binding]), + [ if test x$enableval = xyes; then + have_default_bindings=yes + else +@@ -195,7 +195,7 @@ AC_ARG_ENABLE(default_bindings, AC_HELP_ + fi + ]) + +-AC_ARG_ENABLE(default_mapping, AC_HELP_STRING([--disable-default-mapping], [Builtin default minimal key mapping]), ++AC_ARG_ENABLE(default_mapping, AS_HELP_STRING([--disable-default-mapping],[Builtin default minimal key mapping]), + [ if test x$enableval = xyes; then + have_default_mapping=yes + else +@@ -203,7 +203,7 @@ AC_ARG_ENABLE(default_mapping, AC_HELP_S + fi + ]) + +-AC_ARG_ENABLE(default_config, AC_HELP_STRING([--disable-default-config], [Builtin default minimal configuration]), ++AC_ARG_ENABLE(default_config, AS_HELP_STRING([--disable-default-config],[Builtin default minimal configuration]), + [ if test x$enableval = xyes; then + have_default_config=yes + else +@@ -234,14 +234,14 @@ AC_ARG_ENABLE(default_config, AC_HELP_ST + #AC_SUBST(LIBPNG_CXXFLAGS) + #AC_SUBST(LIBPNG_LIBS) + +-AC_ARG_ENABLE(system, AC_HELP_STRING([--disable-system], [Disable system() and pipe() calls.]), ++AC_ARG_ENABLE(system, AS_HELP_STRING([--disable-system],[Disable system() and pipe() calls.]), + [ if test x$enableval = xno ; then + fim_system_calls=no + fi + ]) + + dnl new: +-AC_ARG_ENABLE(framebuffer, AC_HELP_STRING([--disable-framebuffer], [Disable the framebuffer device driver.]), ++AC_ARG_ENABLE(framebuffer, AS_HELP_STRING([--disable-framebuffer],[Disable the framebuffer device driver.]), + [ if test x$enableval = xno ; then + fim_handle_framebuffer=no + fi +@@ -263,7 +263,15 @@ if test x$fim_handle_framebuffer = xno ; + AC_DEFINE(FIM_WITH_NO_FRAMEBUFFER, 1, [Defined when framebuffer device support is turned off.]) + fi + +-AC_HEADER_STDC ++m4_warn([obsolete], ++[The preprocessor macro `STDC_HEADERS' is obsolete. ++ Except in unusual embedded environments, you can safely include all ++ ISO C90 headers unconditionally.])dnl ++# Autoupdate added the next two lines to ensure that your configure ++# script's behavior did not change. They are probably safe to remove. ++AC_CHECK_INCLUDES_DEFAULT ++AC_PROG_EGREP ++ + AC_FUNC_MMAP + + AC_CHECK_FUNCS([bzero memset memcmp strncmp strcpy]) +@@ -320,11 +328,23 @@ dnl fi + + dnl AC_CHECK_FUNCS(setrlimit getsid) + +-AC_TYPE_SIGNAL ++m4_warn([obsolete], ++[your code may safely assume C89 semantics that RETSIGTYPE is void. ++Remove this warning and the `AC_CACHE_CHECK' when you adjust the code.])dnl ++AC_CACHE_CHECK([return type of signal handlers],[ac_cv_type_signal],[AC_COMPILE_IFELSE( ++[AC_LANG_PROGRAM([#include ++#include ++], ++ [return *(signal (0, 0)) (0) == 1;])], ++ [ac_cv_type_signal=int], ++ [ac_cv_type_signal=void])]) ++AC_DEFINE_UNQUOTED([RETSIGTYPE],[$ac_cv_type_signal],[Define as the return type of signal handlers ++ (`int' or `void').]) ++ + + dnl ================== + AH_TEMPLATE([FIM_WANT_STATIC_BINARY]) +-AC_ARG_ENABLE(static, AC_HELP_STRING([--enable-static], [Want a static binary. (disabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_static=1 ; else fim_cv_want_static=0 ; fi ],[ fim_cv_want_static=0 ]) ++AC_ARG_ENABLE(static, AS_HELP_STRING([--enable-static],[Want a static binary. (disabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_static=1 ; else fim_cv_want_static=0 ; fi ],[ fim_cv_want_static=0 ]) + if test x$fim_cv_want_static == x1 ; then + LIBS="$LIBS --static" + LIBDJVU_STATIC_EXTRA="-lpthread" +@@ -339,20 +359,19 @@ fi + dnl ================== + + +-AC_ARG_WITH(regex, AC_HELP_STRING([--with-regex], [Use the GNU regex library instead of the POSIX one]), ++AC_ARG_WITH(regex, AS_HELP_STRING([--with-regex],[Use the GNU regex library instead of the POSIX one]), + [fim_cv_regex=yes], + [AC_CHECK_FUNCS(regcomp, fim_cv_regex=no, fim_cv_regex=yes)]) + + if test X$fim_cv_regex = Xno ; then + AC_CACHE_CHECK([whether your system regexp library is completely broken], + [fim_cv_regex_broken], +- AC_TRY_RUN([ ++ AC_RUN_IFELSE([AC_LANG_SOURCE([[ + #include + #include +-int main() { regex_t blah ; regmatch_t p; p.rm_eo = p.rm_eo; return regcomp(&blah, "foo.*bar", REG_NOSUB) || regexec (&blah, "foobar", 0, NULL, 0); }], +- fim_cv_regex_broken=no, fim_cv_regex_broken=yes, fim_cv_regex_broken=yes)) ++int main() { regex_t blah ; regmatch_t p; p.rm_eo = p.rm_eo; return regcomp(&blah, "foo.*bar", REG_NOSUB) || regexec (&blah, "foobar", 0, NULL, 0); }]])],[fim_cv_regex_broken=no],[fim_cv_regex_broken=yes],[fim_cv_regex_broken=yes])) + if test X$fim_cv_regex_broken = Xyes ; then +- echo "Using the included GNU regex instead." >&AC_FD_MSG ++ echo "Using the included GNU regex instead." >&AS_MESSAGE_FD + fim_cv_regex=yes + fi + fi +@@ -365,7 +384,7 @@ fi + + + AC_MSG_CHECKING(where to put the documentation...) +-dnl AC_ARG_WITH(docdir, AC_HELP_STRING([--with-docdir=PATH], [Specify where to put the documentation]), ++dnl AC_ARG_WITH(docdir, AS_HELP_STRING([--with-docdir=PATH],[Specify where to put the documentation]), + dnl [fim_cv_docdir=$withval], + dnl [fim_cv_docdir='${prefix}/doc/fim-${fim_cv_version}']) + # FIXME : the above line seems troublesome, BUT IT IS NOT (see the muttrc for this trick). +@@ -378,7 +397,7 @@ AC_SUBST(fim_cv_version) + + dnl ============= gif file handling + +-AC_ARG_ENABLE(gif, AC_HELP_STRING([--disable-gif], [Disable gif support.]), ++AC_ARG_ENABLE(gif, AS_HELP_STRING([--disable-gif],[Disable gif support.]), + [ if test x$enableval = xno ; then + fim_handle_gif=no + fi +@@ -393,14 +412,11 @@ if test x$fim_handle_gif != xno ; then + AC_MSG_WARN([*** GIF loader will not be built (GIF library not found) ***])) + if test x"$have_gif" = xyes; then + AC_MSG_CHECKING([for gif.h]) +- AC_TRY_CPP( +-[#include ++ AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include + #undef PACKAGE + #undef VERSION + #undef HAVE_STDLIB_H +-#include ], +- have_gif=yes, +- have_gif=no) ++#include ]])],[have_gif=yes],[have_gif=no]) + AC_MSG_RESULT($have_gif) + if test x"$have_gif" = xyes; then + LIBGIF='-lgif' +@@ -432,7 +448,7 @@ AM_CONDITIONAL(ENABLE_GIF, test x$have_g + + dnl ============= tiff file handling + +-AC_ARG_ENABLE(tiff, AC_HELP_STRING([--disable-tiff], [Disable tiff support.]), ++AC_ARG_ENABLE(tiff, AS_HELP_STRING([--disable-tiff],[Disable tiff support.]), + [ if test x$enableval = xno ; then + fim_handle_tiff=no + fi +@@ -447,14 +463,11 @@ if test x$fim_handle_tiff != xno ; then + AC_MSG_WARN([*** TIFF loader will not be built (TIFF library not found) ***]) , [$LIBTIFF_STATIC_EXTRA]) + if test x"$have_tiff" = xyes; then + AC_MSG_CHECKING([for tiff.h]) +- AC_TRY_CPP( +-[#include ++ AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include + #undef PACKAGE + #undef VERSION + #undef HAVE_STDLIB_H +-#include ], +- have_tiff=yes, +- have_tiff=no) ++#include ]])],[have_tiff=yes],[have_tiff=no]) + AC_MSG_RESULT($have_tiff) + if test x"$have_tiff" = xyes; then + LIBTIFF="-ltiff $LIBTIFF_STATIC_EXTRA" +@@ -501,7 +514,7 @@ dnl ============= GNU gpm, unofficial ye + dnl ============= no readline case handling + + fim_want_cxx11=no +-AC_ARG_ENABLE(cxx11, AC_HELP_STRING([--enable-cxx11], [Enable C++11 standard constructs (requires appropriate CXXFLAGS, e.g. -std=c++11) (EXPERIMENTAL).]), ++AC_ARG_ENABLE(cxx11, AS_HELP_STRING([--enable-cxx11],[Enable C++11 standard constructs (requires appropriate CXXFLAGS, e.g. -std=c++11) (EXPERIMENTAL).]), + [ if test x$enableval = xno ; then + fim_want_cxx11=no + else +@@ -512,7 +525,7 @@ AC_ARG_ENABLE(cxx11, AC_HELP_STRING([--e + dnl ============= no readline case handling + + fim_want_readline=yes +-AC_ARG_ENABLE(readline, AC_HELP_STRING([--disable-readline], [Disable readline support (EXPERIMENTAL).]), ++AC_ARG_ENABLE(readline, AS_HELP_STRING([--disable-readline],[Disable readline support (EXPERIMENTAL).]), + [ if test x$enableval = xno ; then + fim_want_readline=no + else +@@ -561,7 +574,7 @@ fi + dnl ============= jpeg file handling + + #AC_ARG_WITH(jpeg, [ --disable-jpeg ], [ disable jpeg file support]) +-AC_ARG_ENABLE(jpeg, AC_HELP_STRING([--disable-jpeg], [Disable jpeg support.]), ++AC_ARG_ENABLE(jpeg, AS_HELP_STRING([--disable-jpeg],[Disable jpeg support.]), + [ if test x$enableval = xno ; then + fim_handle_jpeg=no + fi +@@ -576,14 +589,11 @@ if test x$fim_handle_jpeg != xno ; then + AC_MSG_WARN([*** JPEG loader will not be built (JPEG library not found) ***])) + if test x"$have_jpeg" = xyes; then + AC_MSG_CHECKING([for jpeglib.h]) +- AC_TRY_CPP( +-[#include ++ AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include + #undef PACKAGE + #undef VERSION + #undef HAVE_STDLIB_H +-#include ], +- have_jpeg=yes, +- have_jpeg=no) ++#include ]])],[have_jpeg=yes],[have_jpeg=no]) + AC_MSG_RESULT($have_jpeg) + if test x"$have_jpeg" = xyes; then + LIBJPEG='-ljpeg' +@@ -616,7 +626,7 @@ AM_CONDITIONAL(ENABLE_JPEG, test x$have_ + + dnl ============= dvi file handling (via TeX-Guy) + dnl +-dnl AC_ARG_ENABLE(dvi, AC_HELP_STRING([--disable-dvi], [Disable dvi support.]), ++dnl AC_ARG_ENABLE(dvi, AS_HELP_STRING([--disable-dvi],[Disable dvi support.]), + dnl [ if test x$enableval = xno ; then + dnl fim_handle_dvi=no + dnl fi +@@ -631,14 +641,11 @@ dnl have_dvi=no + dnl AC_MSG_WARN([*** DVI loader will not be built (libdvi29 library not found) ***])) + dnl if test x"$have_dvi" = xyes; then + dnl AC_MSG_CHECKING([for libdvi29.h]) +-dnl AC_TRY_CPP( +-dnl [#include ++dnl AC_PREPROC_IFELSE([AC_LANG_SOURCE([[dnl #include + dnl #undef PACKAGE + dnl #undef VERSION + dnl #undef HAVE_STDLIB_H +-dnl #include ], +-dnl have_dvi=yes, +-dnl have_dvi=no) ++dnl #include ]])],[dnl have_dvi=yes],[dnl have_dvi=no]) + dnl AC_MSG_RESULT($have_dvi) + dnl if test x"$have_dvi" = xyes; then + dnl LIBDVI='-ldvilib2' +@@ -670,7 +677,7 @@ dnl AM_CONDITIONAL(ENABLE_DVI, test x$ha + + dnl ============= ps file handling + +-AC_ARG_ENABLE(ps, AC_HELP_STRING([--disable-ps], [Disable ps support.]), ++AC_ARG_ENABLE(ps, AS_HELP_STRING([--disable-ps],[Disable ps support.]), + [ if test x$enableval = xno ; then + fim_handle_ps=no + fi +@@ -685,14 +692,11 @@ if test x$fim_handle_ps != xno ; then + AC_MSG_WARN([*** PS loader will not be built (spectre library not found) ***]) , [$LIBSPECTRE_STATIC_EXTRA]) + if test x"$have_ps" = xyes; then + AC_MSG_CHECKING([for libspectre/spectre.h]) +- AC_TRY_CPP( +-[#include ++ AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include + #undef PACKAGE + #undef VERSION + #undef HAVE_STDLIB_H +-#include ], +- have_ps=yes, +- have_ps=no) ++#include ]])],[have_ps=yes],[have_ps=no]) + AC_MSG_RESULT($have_ps) + if test x"$have_ps" = xyes; then + LIBPS="-lspectre $LIBSPECTRE_STATIC_EXTRA" +@@ -726,7 +730,7 @@ AM_CONDITIONAL(ENABLE_PS, test x$have_ps + + dnl ============= djvu file handling + +-AC_ARG_ENABLE(djvu, AC_HELP_STRING([--disable-djvu], [Disable djvu support.]), ++AC_ARG_ENABLE(djvu, AS_HELP_STRING([--disable-djvu],[Disable djvu support.]), + [ if test x$enableval = xno ; then + fim_handle_djvu=no + fi +@@ -741,14 +745,11 @@ if test x$fim_handle_djvu != xno ; then + AC_MSG_WARN([*** DJVU loader will not be built (DJVU library not found) ***]), [$LIBDJVU_STATIC_EXTRA]) + if test x"$have_djvu" = xyes; then + AC_MSG_CHECKING([for libdjvu/ddjvuapi.h]) +- AC_TRY_CPP( +-[#include ++ AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include + #undef PACKAGE + #undef VERSION + #undef HAVE_STDLIB_H +-#include ], +- have_djvu=yes, +- have_djvu=no) ++#include ]])],[have_djvu=yes],[have_djvu=no]) + AC_MSG_RESULT($have_djvu) + if test x"$have_djvu" = xyes; then + LIBDJVU="-ldjvulibre $LIBDJVU_STATIC_EXTRA" +@@ -784,7 +785,7 @@ dnl + dnl By default, we disable poppler : its API is still immature. + dnl + fim_handle_pdf=no +-AC_ARG_ENABLE(poppler, AC_HELP_STRING([--enable-poppler], [Enable poppler (PDF rendering) support. This will add LIBPOPPLER_CXXFLAGS="-I/usr/include/poppler/" to the compilation flags. You can override this by passing configure a suitable LIBPOPPLER_CXXFLAGS variable.]), ++AC_ARG_ENABLE(poppler, AS_HELP_STRING([--enable-poppler],[Enable poppler (PDF rendering) support. This will add LIBPOPPLER_CXXFLAGS="-I/usr/include/poppler/" to the compilation flags. You can override this by passing configure a suitable LIBPOPPLER_CXXFLAGS variable.]), + [ if test x$enableval = xyes ; then + fim_handle_pdf=yes + fi +@@ -801,8 +802,7 @@ dnl FIXME : the following is a dirty hac + AC_MSG_WARN([*** POPPLER loader will not be built (POPPLER library not found) ***]) ) + if test x"$have_poppler" = xyes; then + AC_MSG_CHECKING([for poppler/poppler-config.h]) +- AC_TRY_CPP( +- [#include ++ AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include + #undef PACKAGE + #undef VERSION + #undef HAVE_STDLIB_H +@@ -815,9 +815,7 @@ dnl FIXME : the following is a dirty hac + #include + #include + #include /* globalParams lives here */ +- ], +- have_poppler=yes, +- have_poppler=no) ++ ]])],[have_poppler=yes],[have_poppler=no]) + have_poppler=yes + AC_MSG_RESULT($have_poppler) + if test x"$have_poppler" = xyes; then +@@ -858,7 +856,7 @@ AM_CONDITIONAL(ENABLE_POPPLER, test x$ha + dnl FIXME : we have two libpoppler checks ... : + dnl ================== pdf checks =================================================== + AC_ARG_ENABLE(pdf, +- [AC_HELP_STRING([--enable-pdf], [Compile with pdf support])],enable_pdf="$enableval",enable_pdf=yes) ++ [AS_HELP_STRING([--enable-pdf],[Compile with pdf support])],enable_pdf="$enableval",enable_pdf=yes) + + if test "x$enable_pdf" = "xyes"; then + POPPLER_REQUIRED=0.8.7 +@@ -884,7 +882,7 @@ dnl ================== end of pdf checks + + dnl ================================================================================ + fim_handle_bmp=yes +-AC_ARG_ENABLE(bmp, AC_HELP_STRING([--disable-bmp], [Disable BMP file support (enabled by default).]), ++AC_ARG_ENABLE(bmp, AS_HELP_STRING([--disable-bmp],[Disable BMP file support (enabled by default).]), + [ if test x$enableval = xno ; then + fim_handle_bmp=no + fi +@@ -899,7 +897,7 @@ else + fi + dnl ================================================================================ + fim_handle_pcx=yes +-AC_ARG_ENABLE(pcx, AC_HELP_STRING([--disable-pcx], [Disable PCX file support (enabled by default).]), ++AC_ARG_ENABLE(pcx, AS_HELP_STRING([--disable-pcx],[Disable PCX file support (enabled by default).]), + [ if test x$enableval = xno ; then + fim_handle_pcx=no + fi +@@ -916,12 +914,12 @@ dnl ==================================== + + ## png file handling + +-AC_ARG_WITH(png-prefix, AC_HELP_STRING([--with-png-prefix=PFX], [prefix where libpng is installed (optional)]), ++AC_ARG_WITH(png-prefix, AS_HELP_STRING([--with-png-prefix=PFX],[prefix where libpng is installed (optional)]), + libpng_config_prefix="$withval", libpng_config_prefix="") + + fim_handle_png=yes + +-AC_ARG_ENABLE(png, AC_HELP_STRING([--disable-png], [Disable png support.]), ++AC_ARG_ENABLE(png, AS_HELP_STRING([--disable-png],[Disable png support.]), + [ if test x$enableval = xno ; then + fim_handle_png=no + fi +@@ -957,7 +955,7 @@ dnl ==================================== + + fim_handle_xyz=no + +-AC_ARG_ENABLE(xyz, AC_HELP_STRING([--enable-xyz], [Enable the sample bogus 'xyz' file loading support. This makes only sense in order to learn how to include a new file format and wish to play with src/FbiStuffXyz.cpp in the while.]), ++AC_ARG_ENABLE(xyz, AS_HELP_STRING([--enable-xyz],[Enable the sample bogus 'xyz' file loading support. This makes only sense in order to learn how to include a new file format and wish to play with src/FbiStuffXyz.cpp in the while.]), + [ if test x$enableval = xyes ; then + fim_handle_xyz=yes + fi +@@ -976,7 +974,7 @@ dnl ==================================== + + fim_handle_ufraw=no + +-AC_ARG_ENABLE(ufraw, AC_HELP_STRING([--enable-ufraw], [Enable UFRaw support (EXPERIMENTAL).]), ++AC_ARG_ENABLE(ufraw, AS_HELP_STRING([--enable-ufraw],[Enable UFRaw support (EXPERIMENTAL).]), + [ if test x$enableval = xno ; then + fim_handle_ufraw=no + else +@@ -999,7 +997,7 @@ dnl ==================================== + + fim_handle_archive=no + +-AC_ARG_ENABLE(archive, AC_HELP_STRING([--enable-archive], [Enable libarchive support (please provide ARCHIVE_LIBS, ARCHIVE_CXXFLAGS) (EXPERIMENTAL, UNFINISHED).]), ++AC_ARG_ENABLE(archive, AS_HELP_STRING([--enable-archive],[Enable libarchive support (please provide ARCHIVE_LIBS, ARCHIVE_CXXFLAGS) (EXPERIMENTAL, UNFINISHED).]), + [ if test x$enableval = xno ; then + fim_handle_archive=no + else +@@ -1018,7 +1016,7 @@ fi + dnl ================================================================================ + + AC_CHECK_LIB(exif, exif_data_new_from_data,have_libexif=yes,have_libexif=no) +-AC_ARG_ENABLE(exif, AC_HELP_STRING([--disable-exif], [JPEG EXIF tags support with libexif.]), [if test x$enableval != xno; then fim_cv_libexif=yes; fi],[fim_cv_libexif=yes;]) ++AC_ARG_ENABLE(exif, AS_HELP_STRING([--disable-exif],[JPEG EXIF tags support with libexif.]), [if test x$enableval != xno; then fim_cv_libexif=yes; fi],[fim_cv_libexif=yes;]) + + if test x$fim_cv_libexif = xyes; then + if test x$have_libexif = xyes; then +@@ -1036,7 +1034,7 @@ fi + + dnl ================================================================================ + +-AC_ARG_ENABLE(jasper, AC_HELP_STRING([--enable-jasper], [Turns on JPEG-2000 files support using JasPer (EXPERIMENTAL)]), ++AC_ARG_ENABLE(jasper, AS_HELP_STRING([--enable-jasper],[Turns on JPEG-2000 files support using JasPer (EXPERIMENTAL)]), + [if test x$enableval = xyes; then + fim_cv_libjasper=yes; + CXXFLAGS="$CXXFLAGS"; +@@ -1056,7 +1054,7 @@ AC_ARG_ENABLE(jasper, AC_HELP_STRING([-- + dnl ================================================================================ + + AC_CHECK_LIB(aa, aa_getfirst,fim_cv_libaa=yes,fim_cv_libaa=no) +-AC_ARG_ENABLE(aa, AC_HELP_STRING([--disable-aa], [Ascii Art (-o aa) support (via aalib)]), [if test x$enableval != xno; then fim_cv_libaa=yes; else fim_cv_libaa=no; fi],[fim_cv_libaa=yes;]) ++AC_ARG_ENABLE(aa, AS_HELP_STRING([--disable-aa],[Ascii Art (-o aa) support (via aalib)]), [if test x$enableval != xno; then fim_cv_libaa=yes; else fim_cv_libaa=no; fi],[fim_cv_libaa=yes;]) + if test x$fim_cv_libaa != xno; then + if test x$ac_cv_lib_aa_aa_getfirst = xyes; then + AC_MSG_NOTICE([Enabling aalib driver.]) +@@ -1091,18 +1089,18 @@ dnl ==================================== + + ## sdl driver + +-AC_ARG_WITH(sdl-prefix, AC_HELP_STRING([--with-sdl-prefix=PFX], [prefix where libsdl is installed (optional)]), ++AC_ARG_WITH(sdl-prefix, AS_HELP_STRING([--with-sdl-prefix=PFX],[prefix where libsdl is installed (optional)]), + libsdl_config_prefix="$withval", libsdl_config_prefix="") + + fim_handle_sdl='auto' + +-dnl AC_ARG_ENABLE(sdl, AC_HELP_STRING([--disable-sdl], [Disable libsdl support.]), ++dnl AC_ARG_ENABLE(sdl, AS_HELP_STRING([--disable-sdl],[Disable libsdl support.]), + dnl [ if test x$enableval = xno ; then + dnl fim_handle_sdl=no + dnl fi + dnl ]) + +-AC_ARG_ENABLE(sdl, AC_HELP_STRING([--disable-sdl], [Disable libsdl support.]), ++AC_ARG_ENABLE(sdl, AS_HELP_STRING([--disable-sdl],[Disable libsdl support.]), + [ if test x$enableval = xyes ; then fim_handle_sdl=yes ; fi ] + [ if test x$enableval = xno ; then fim_handle_sdl=no ; fi ]) + +@@ -1141,7 +1139,7 @@ dnl ==================================== + + AH_TEMPLATE([FIM_WANT_EXIFTOOL]) + fim_cv_exiftool=no +-AC_ARG_ENABLE(exiftool, AC_HELP_STRING([--enable-exiftool], [Turns on exiftool support (EXPERIMENTAL, shall provide the EXIFTOOLLINK variable with library or object files and EXIFTOOLCXXFLAGS)]), ++AC_ARG_ENABLE(exiftool, AS_HELP_STRING([--enable-exiftool],[Turns on exiftool support (EXPERIMENTAL, shall provide the EXIFTOOLLINK variable with library or object files and EXIFTOOLCXXFLAGS)]), + [if test x$enableval = xyes; then + fim_cv_exiftool=yes + CXXFLAGS="$CXXFLAGS $EXIFTOOLCXXFLAGS" +@@ -1162,7 +1160,7 @@ dnl ================== + + fim_cv_autocommands=yes + +-AC_ARG_ENABLE(autocommands, AC_HELP_STRING([--disable-autocommands], [Fim will by default use autocommands.]), ++AC_ARG_ENABLE(autocommands, AS_HELP_STRING([--disable-autocommands],[Fim will by default use autocommands.]), + [if test x$enableval = xno; then + fim_cv_autocommands=no + fi]) +@@ -1178,7 +1176,7 @@ fi + + dnl ================== + +-AC_ARG_ENABLE(hardcoded-font, AC_HELP_STRING([--enable-hardcoded-font], [Enable a hardcoded font in the executable (good as a fallback (FBFONT=fim://) when no PSF format consolefonts files are available).]), ++AC_ARG_ENABLE(hardcoded-font, AS_HELP_STRING([--enable-hardcoded-font],[Enable a hardcoded font in the executable (good as a fallback (FBFONT=fim://) when no PSF format consolefonts files are available).]), + [if test x$enableval = xyes; then + fim_cv_hardcoded_font=yes; + else +@@ -1197,7 +1195,7 @@ AM_CONDITIONAL(FIM_WANT_HARDCODED_CONSOL + + dnl ================== + +-AC_ARG_ENABLE(long-int-vars, AC_HELP_STRING([--enable-long-int-vars], [Internals shall use 64 bit integers (EXPERIMENTAL].), ++AC_ARG_ENABLE(long-int-vars, AS_HELP_STRING([--enable-long-int-vars],[Internals shall use 64 bit integers (EXPERIMENTAL.]), + [if test x$enableval = xyes; then + fim_cv_want_int64_int=yes; + else +@@ -1214,7 +1212,7 @@ dnl ================== + + fim_cv_windows=yes + +-AC_ARG_ENABLE(windows, AC_HELP_STRING([--disable-windows], [Disable windowing system in Fim. (deprecated)]), ++AC_ARG_ENABLE(windows, AS_HELP_STRING([--disable-windows],[Disable windowing system in Fim. (deprecated)]), + [if test x$enableval = xno; then + fim_cv_windows=no + fi]) +@@ -1231,7 +1229,7 @@ fi + dnl ================== + fim_cv_fimrc=yes + +-AC_ARG_ENABLE(fimrc, AC_HELP_STRING([--disable-fimrc], [Fim will by default load the ~/.fimrc file.]), ++AC_ARG_ENABLE(fimrc, AS_HELP_STRING([--disable-fimrc],[Fim will by default load the ~/.fimrc file.]), + [if test x$enableval = xno; then + fim_cv_fimrc=no + fi]) +@@ -1247,7 +1245,7 @@ dnl ================== + AH_TEMPLATE([FIM_NOHISTORY]) + fim_cv_history=yes + +-AC_ARG_ENABLE(history, AC_HELP_STRING([--disable-history], [Fim will by default load/save a ~/.fim_history file.]), ++AC_ARG_ENABLE(history, AS_HELP_STRING([--disable-history],[Fim will by default load/save a ~/.fim_history file.]), + [if test x$enableval = xno; then + fim_cv_history=no + fi]) +@@ -1262,7 +1260,7 @@ fi + dnl ================== + + fim_cv_warnings=no +-AC_ARG_ENABLE(screen, AC_HELP_STRING([--disable-screen], [Fim will try to work under screen by default (please read BUGS)]), ++AC_ARG_ENABLE(screen, AS_HELP_STRING([--disable-screen],[Fim will try to work under screen by default (please read BUGS)]), + [ if test x$enableval = xno; then + fim_cv_screen=no + else +@@ -1274,7 +1272,7 @@ AC_ARG_ENABLE(screen, AC_HELP_STRING([-- + dnl ================== + + fim_cv_resize_optimizations=yes +-AC_ARG_ENABLE(resize-optimizations, AC_HELP_STRING([--disable-resize-optimizations], [Some old (fbi) code is optimized for speedup in fim.]), ++AC_ARG_ENABLE(resize-optimizations, AS_HELP_STRING([--disable-resize-optimizations],[Some old (fbi) code is optimized for speedup in fim.]), + [ if test x$enableval = xno; then + fim_cv_resize_optimizations=no + else +@@ -1286,7 +1284,7 @@ AC_ARG_ENABLE(resize-optimizations, AC_H + dnl ================== + + fim_cv_read_stdin_image=yes +-AC_ARG_ENABLE(stdin-image-reading, AC_HELP_STRING([--disable-stdin-image-reading], [Fim will read an image from stdin with the -i switch. (experimental)]), ++AC_ARG_ENABLE(stdin-image-reading, AS_HELP_STRING([--disable-stdin-image-reading],[Fim will read an image from stdin with the -i switch. (experimental)]), + [ if test x$enableval = xno; then + fim_cv_read_stdin_image=no + else +@@ -1297,7 +1295,7 @@ AC_ARG_ENABLE(stdin-image-reading, AC_HE + + dnl ================== + fim_cv_scan_consolefonts=yes +-AC_ARG_ENABLE(scan-consolefonts, AC_HELP_STRING([--enable-scan-consolefonts], [Fim will scan some predefined directory in look for console fonts as a fallback. (experimental)]), ++AC_ARG_ENABLE(scan-consolefonts, AS_HELP_STRING([--enable-scan-consolefonts],[Fim will scan some predefined directory in look for console fonts as a fallback. (experimental)]), + [ if test x$enableval = xyes; then + fim_cv_scan_consolefonts=yes + else +@@ -1307,7 +1305,7 @@ AC_ARG_ENABLE(scan-consolefonts, AC_HELP + ) + dnl ================== + fim_cv_seek_magic=yes +-AC_ARG_ENABLE(seek-magic, AC_HELP_STRING([--enable-seek-magic], [Fim will be capable to seek on a specified magic string. (experimental)]), ++AC_ARG_ENABLE(seek-magic, AS_HELP_STRING([--enable-seek-magic],[Fim will be capable to seek on a specified magic string. (experimental)]), + [ if test x$enableval = xyes; then + fim_cv_seek_magic=yes + else +@@ -1316,7 +1314,7 @@ AC_ARG_ENABLE(seek-magic, AC_HELP_STRING + ],[ fim_cv_seek_magic=no ] + ) + dnl ================== +-AC_ARG_ENABLE(pushdir, AC_HELP_STRING([--enable-pushdir], [Fim will scan directories for files.]), ++AC_ARG_ENABLE(pushdir, AS_HELP_STRING([--enable-pushdir],[Fim will scan directories for files.]), + [ if test x$enableval = xno; then + fim_cv_read_dirs=no + else +@@ -1325,7 +1323,7 @@ AC_ARG_ENABLE(pushdir, AC_HELP_STRING([- + ],[ fim_cv_read_dirs=yes ] + ) + dnl ================== +-AC_ARG_ENABLE(recursive-pushdir, AC_HELP_STRING([--disable-recursive-pushdir], [Fim will be able to push directories recursively (implies --enable-push-dirs )]), ++AC_ARG_ENABLE(recursive-pushdir, AS_HELP_STRING([--disable-recursive-pushdir],[Fim will be able to push directories recursively (implies --enable-push-dirs )]), + [ if test x$enableval = xyes; then + fim_cv_recursive_dirs=yes; + fim_cv_read_dirs=yes; +@@ -1387,7 +1385,7 @@ fi + dnl ================== + + fim_cv_warnings=no +-AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [Turns on debug options (recommended for debugging)]), ++AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug],[Turns on debug options (recommended for debugging)]), + [if test x$enableval = xyes; then + fim_cv_debug=yes + fi]) +@@ -1395,7 +1393,7 @@ fi]) + dnl ================== + + fim_cv_warnings=no +-AC_ARG_ENABLE(warnings, AC_HELP_STRING([--enable-warnings], [Turns on compiler warnings (recommended, for debugging)]), ++AC_ARG_ENABLE(warnings, AS_HELP_STRING([--enable-warnings],[Turns on compiler warnings (recommended, for debugging)]), + [if test x$enableval = xyes; then + fim_cv_warnings=yes + fi]) +@@ -1419,7 +1417,7 @@ dnl ================== + + fim_cv_cacalib=no + +-AC_ARG_ENABLE(cacalib, AC_HELP_STRING([--enable-cacalib], [Turns on cacalib support (STILL INCOMPLETE)]), ++AC_ARG_ENABLE(cacalib, AS_HELP_STRING([--enable-cacalib],[Turns on cacalib support (STILL INCOMPLETE)]), + [if test x$enableval = xyes; then + if test x$have_cacalib = xyes; then + fim_cv_cacalib=yes +@@ -1433,8 +1431,7 @@ AC_ARG_ENABLE(cacalib, AC_HELP_STRING([- + dnl ================== + + # This code still awaits for integration ... +-AC_ARG_WITH(cflags, AC_HELP_STRING([--with-cflags=CXXFLAGS], +- [Specify a custom CXXFLAGS append value. e.g.: -pg ++AC_ARG_WITH(cflags, AS_HELP_STRING([--with-cflags=CXXFLAGS],[Specify a custom CXXFLAGS append value. e.g.: -pg + You cannot call this argument multiple times. + In case you want completely reset CXXFLAGS use : + CXXFLAGS='' ./configure .. +@@ -1456,7 +1453,7 @@ AC_ARG_WITH(cflags, AC_HELP_STRING([--wi + dnl ================== + + # This code still awaits for integration ... +-AC_ARG_WITH(exec-shell, AC_HELP_STRING([--with-exec-shell=SHELL], [Specify alternate shell (ONLY if /bin/sh is broken)]), ++AC_ARG_WITH(exec-shell, AS_HELP_STRING([--with-exec-shell=SHELL],[Specify alternate shell (ONLY if /bin/sh is broken)]), + [if test x$withval != xyes; then + AC_DEFINE_UNQUOTED(EXECSHELL, "$withval", + [program to use for shell commands]) +@@ -1466,7 +1463,7 @@ AC_ARG_WITH(exec-shell, AC_HELP_STRING([ + [AC_DEFINE_UNQUOTED(EXECSHELL, "/bin/sh")]) + + dnl ================== +-AC_ARG_ENABLE(convert, AC_HELP_STRING([--disable-smartautocompletion], [Fim will treat as a proper, unescaped string, nonquoted and nonevaluated strings which happen to match an existing filename.]), ++AC_ARG_ENABLE(convert, AS_HELP_STRING([--disable-smartautocompletion],[Fim will treat as a proper, unescaped string, nonquoted and nonevaluated strings which happen to match an existing filename.]), + [ if test x$enableval = xno; then + fim_cv_smartautcompletion=no + else +@@ -1484,7 +1481,7 @@ if test x$fim_cv_scan_consolefonts = xye + fi + dnl ================== + +-AC_ARG_ENABLE(convert, AC_HELP_STRING([--disable-convert], [Fim will try to use convert (ImageMagick) as a last resort for opening unknown format files.]), ++AC_ARG_ENABLE(convert, AS_HELP_STRING([--disable-convert],[Fim will try to use convert (ImageMagick) as a last resort for opening unknown format files.]), + [ if test x$enableval = xno; then + fim_cv_convert=no + else +@@ -1497,7 +1494,7 @@ AC_ARG_ENABLE(convert, AC_HELP_STRING([- + + dnl ================== + +-AC_ARG_ENABLE(xcftopnm, AC_HELP_STRING([--disable-xcftopnm], [Fim will try to use xcftopnm (Gimp) for opening XCF format files.]), ++AC_ARG_ENABLE(xcftopnm, AS_HELP_STRING([--disable-xcftopnm],[Fim will try to use xcftopnm (Gimp) for opening XCF format files.]), + [ if test x$enableval = xno; then + fim_cv_xcftopnm=no + else +@@ -1509,7 +1506,7 @@ AC_ARG_ENABLE(xcftopnm, AC_HELP_STRING([ + dnl ================== + + fim_cv_inkscape=yes +-AC_ARG_ENABLE(inkscape, AC_HELP_STRING([--disable-inkscape], [Fim will try to use Inkscape for opening SVG format files.]), ++AC_ARG_ENABLE(inkscape, AS_HELP_STRING([--disable-inkscape],[Fim will try to use Inkscape for opening SVG format files.]), + [ if test x$enableval = xno; then + fim_cv_inkscape=no + else +@@ -1520,7 +1517,7 @@ AC_ARG_ENABLE(inkscape, AC_HELP_STRING([ + + dnl ================== + +-AC_ARG_ENABLE(xfig, AC_HELP_STRING([--disable-xfig], [Fim will try to use xfig (fig2dev) for opening FIG format files.]), ++AC_ARG_ENABLE(xfig, AS_HELP_STRING([--disable-xfig],[Fim will try to use xfig (fig2dev) for opening FIG format files.]), + [ if test x$enableval = xno; then + fim_cv_xfig=no + else +@@ -1531,7 +1528,7 @@ AC_ARG_ENABLE(xfig, AC_HELP_STRING([--di + + dnl ================== + +-AC_ARG_ENABLE(dia, AC_HELP_STRING([--disable-dia], [Fim will try to use dia for opening DIA format files.]), ++AC_ARG_ENABLE(dia, AS_HELP_STRING([--disable-dia],[Fim will try to use dia for opening DIA format files.]), + [ if test x$enableval = xno; then + fim_cv_dia=no + else +@@ -1542,19 +1539,19 @@ AC_ARG_ENABLE(dia, AC_HELP_STRING([--dis + + dnl ================== + AH_TEMPLATE([FIM_DEFAULT_CONSOLEFONT]) +-AC_ARG_WITH(default-consolefont, AC_HELP_STRING([--with-default-consolefont=FILE], [Specify a default consolefont (psf or psf.gz format) file.]), [ AC_DEFINE_UNQUOTED(FIM_DEFAULT_CONSOLEFONT, "$withval") ], [fim_cv_defaultconsolefont=""]) ++AC_ARG_WITH(default-consolefont, AS_HELP_STRING([--with-default-consolefont=FILE],[Specify a default consolefont (psf or psf.gz format) file.]), [ AC_DEFINE_UNQUOTED(FIM_DEFAULT_CONSOLEFONT, "$withval") ], [fim_cv_defaultconsolefont=""]) + dnl ================== +-AC_ARG_WITH(custom-hardcoded-consolefont, AC_HELP_STRING([--with-custom-hardcoded-consolefont=FILE], [Specify a custom consolefont to be hardcoded (uncompressed psf format, absolute path) at build time (requires --enable-hardcoded-font).]), [ ++AC_ARG_WITH(custom-hardcoded-consolefont, AS_HELP_STRING([--with-custom-hardcoded-consolefont=FILE],[Specify a custom consolefont to be hardcoded (uncompressed psf format, absolute path) at build time (requires --enable-hardcoded-font).]), [ + fim_cv_want_custom_hardcoded_consolefont=true; + AC_SUBST(FIM_CUSTOM_HARDCODED_CONSOLEFONT, "$withval") + ], []) + AM_CONDITIONAL(FIM_WANT_CUSTOM_HARDCODED_CONSOLEFONT, test x$fim_cv_want_custom_hardcoded_consolefont = xtrue ) + dnl ================== +-AC_ARG_WITH(tmpfile, AC_HELP_STRING([--with-tmpfile=FILE], [Specify where to put temporary files created when interacting with external conversion programs (default is "/tmp/__FIM_TEMPORARY_FILE").]), ++AC_ARG_WITH(tmpfile, AS_HELP_STRING([--with-tmpfile=FILE],[Specify where to put temporary files created when interacting with external conversion programs (default is "/tmp/__FIM_TEMPORARY_FILE").]), + [fim_cv_tmpfile=$withval], + [fim_cv_tmpfile="/tmp/__FIM_TEMPORARY_FILE"]) + dnl ================== +-AC_ARG_ENABLE(custom-status-bar, AC_HELP_STRING([--disable-custom-status-bar], [Customization of status bar via a printf-like string.]), ++AC_ARG_ENABLE(custom-status-bar, AS_HELP_STRING([--disable-custom-status-bar],[Customization of status bar via a printf-like string.]), + [ if test x$enableval = xno; then + fim_cv_custom_status_bar=no; + else +@@ -1564,7 +1561,7 @@ AC_ARG_ENABLE(custom-status-bar, AC_HELP + ) + dnl ================== + +-AC_ARG_ENABLE(optimizations, AC_HELP_STRING([--enable-optimizations], [Will try to enhance compilation flags (EXPERIMENTAL)]), ++AC_ARG_ENABLE(optimizations, AS_HELP_STRING([--enable-optimizations],[Will try to enhance compilation flags (EXPERIMENTAL)]), + [ if test x$enableval = xno; then + fim_cv_optimizations=no + else +@@ -1722,23 +1719,23 @@ dnl ================== + + dnl ================== + AH_TEMPLATE([FIM_WANT_FILENAME_MARK_AND_DUMP]) +-AC_ARG_ENABLE(mark-and-dump, AC_HELP_STRING([--enable-mark-and-dump], [Fim will be capable of marking files while viewing and outputting their names on exit. (enabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_mark_and_dump=1 ; else fim_cv_want_mark_and_dump=0 ; fi ],[ fim_cv_want_mark_and_dump=1 ]) ++AC_ARG_ENABLE(mark-and-dump, AS_HELP_STRING([--enable-mark-and-dump],[Fim will be capable of marking files while viewing and outputting their names on exit. (enabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_mark_and_dump=1 ; else fim_cv_want_mark_and_dump=0 ; fi ],[ fim_cv_want_mark_and_dump=1 ]) + AC_DEFINE_UNQUOTED([FIM_WANT_FILENAME_MARK_AND_DUMP], $fim_cv_want_mark_and_dump, [Fim will be capable of marking files while viewing and outputting their names on exit.]) + dnl ================== + AH_TEMPLATE([FIM_WANT_NOSCRIPTING]) +-AC_ARG_ENABLE(scripting, AC_HELP_STRING([--enable-scripting], [Scripting. (enabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_noscripting=0 ; else fim_cv_want_noscripting=1 ; fi ],[ fim_cv_want_noscripting=0 ]) ++AC_ARG_ENABLE(scripting, AS_HELP_STRING([--enable-scripting],[Scripting. (enabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_noscripting=0 ; else fim_cv_want_noscripting=1 ; fi ],[ fim_cv_want_noscripting=0 ]) + if test x$fim_cv_want_noscripting == x1 ; then + AC_DEFINE_UNQUOTED([FIM_WANT_NOSCRIPTING], $fim_cv_want_noscripting, [Scripting. (enabled by default)]) + fi + dnl ================== + AH_TEMPLATE([FIM_WANT_NO_OUTPUT_CONSOLE]) +-AC_ARG_ENABLE(output-console, AC_HELP_STRING([--enable-output-console], [Output console. (enabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_no_output_console=0 ; else fim_cv_want_no_output_console=1 ; fi ],[ fim_cv_want_no_output_console=0 ]) ++AC_ARG_ENABLE(output-console, AS_HELP_STRING([--enable-output-console],[Output console. (enabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_no_output_console=0 ; else fim_cv_want_no_output_console=1 ; fi ],[ fim_cv_want_no_output_console=0 ]) + if test x$fim_cv_want_no_output_console == x1 ; then + AC_DEFINE_UNQUOTED([FIM_WANT_NO_OUTPUT_CONSOLE], $fim_cv_want_no_output_console, [Output console. (enabled by default)]) + fi + dnl ================== + AH_TEMPLATE([FIM_WANT_UNICODE]) +-AC_ARG_ENABLE(unicode, AC_HELP_STRING([--enable-unicode], [Unicode. (disabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_unicode=1 ; else fim_cv_want_unicode=0 ; fi ],[ fim_cv_want_unicode=0 ]) ++AC_ARG_ENABLE(unicode, AS_HELP_STRING([--enable-unicode],[Unicode. (disabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_unicode=1 ; else fim_cv_want_unicode=0 ; fi ],[ fim_cv_want_unicode=0 ]) + if test x$fim_cv_want_unicode == x1 ; then + # CXXFLAGS="$CXXFLAGS `freetype-config --cflags`" + # LIBS="$LIBS `freetype-config --libs`" +@@ -1747,7 +1744,7 @@ fi + dnl ================== + AH_TEMPLATE([FIM_WANT_TEXT_RENDERING]) + fim_want_astext=yes +-AC_ARG_ENABLE(as-text-rendering, AC_HELP_STRING([--disable-as-text-rendering], [Disable as-text rendering (viewing of any file as character bytes -- not to be confused with the ASCII art output).]), ++AC_ARG_ENABLE(as-text-rendering, AS_HELP_STRING([--disable-as-text-rendering],[Disable as-text rendering (viewing of any file as character bytes -- not to be confused with the ASCII art output).]), + [ if test x$enableval = xno ; then + fim_want_astext=no + fi +@@ -1758,7 +1755,7 @@ fi + dnl ================== + AH_TEMPLATE([FIM_WANT_RAW_BITS_RENDERING]) + fim_want_rbr=yes +-AC_ARG_ENABLE(raw-bits-rendering, AC_HELP_STRING([--disable-raw-bits-rendering], [Disable raw bits rendering (viewing of any file as either a 1 or 24 bpp bitmap).]), ++AC_ARG_ENABLE(raw-bits-rendering, AS_HELP_STRING([--disable-raw-bits-rendering],[Disable raw bits rendering (viewing of any file as either a 1 or 24 bpp bitmap).]), + [ if test x$enableval = xno ; then + fim_want_rbr=no + fi +@@ -1769,7 +1766,7 @@ fi + dnl ================== + AH_TEMPLATE([FIM_ALLOW_LOADER_STRING_SPECIFICATION]) + fim_want_lss=yes +-AC_ARG_ENABLE(loader-string-specification, AC_HELP_STRING([--disable-loader-string-specification], [Disables the chance to specify a file loader.]), ++AC_ARG_ENABLE(loader-string-specification, AS_HELP_STRING([--disable-loader-string-specification],[Disables the chance to specify a file loader.]), + [ if test x$enableval = xno ; then + fim_want_lss=no + fi +@@ -1851,7 +1848,7 @@ AC_DEFINE([FBI_AUTHOR],["Gerd Hoffmann < + dnl ############################################################################### + dnl this is experimental stuff + dnl ############################################################################### +-AC_ARG_ENABLE(matrices-rendering, AC_HELP_STRING([--enable-matrices-rendering], [Uses librsb for rendering of Matrix Market files (must have librsb-config in the PATH).]), ++AC_ARG_ENABLE(matrices-rendering, AS_HELP_STRING([--enable-matrices-rendering],[Uses librsb for rendering of Matrix Market files (must have librsb-config in the PATH).]), + [ if test x$enableval = xyes; then + if test x$ac_cv_func_rsb_lib_init = xyes; then + AH_TEMPLATE([HAVE_MATRIX_MARKET_DECODER]) +@@ -1881,12 +1878,13 @@ AC_SUBST(CXXFLAGS) + + #AC_CONFIG_FILES([Makefile],[src/Makefile]) + +-AC_OUTPUT(Makefile src/Makefile doc/Makefile distros/Makefile scripts/Makefile ++AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile distros/Makefile scripts/Makefile + scripts/maintenance/cron-build.sh + scripts/maintenance/remote-build.sh + scripts/maintenance/cron-svndump.pl + scripts/maintenance/cron-rsync.sh +- ) ++ ]) ++AC_OUTPUT + #AC_OUTPUT + + AC_MSG_NOTICE([ diff --git a/rules b/rules new file mode 100755 index 0000000..13446dd --- /dev/null +++ b/rules @@ -0,0 +1,17 @@ +#!/usr/bin/make -f +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +export DEB_BUILD_MAINT_OPTIONS = hardening=+all + +%: + dh $@ + +ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) +override_dh_auto_test: + VAR=' ' debian/tests/run-tests +endif + +execute_after_dh_auto_install: + ## Avoid installation of duplicated upstream changelog + rm -f debian/fim/usr/share/doc/fim/ChangeLog diff --git a/source/format b/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/source/options b/source/options new file mode 100644 index 0000000..24198f9 --- /dev/null +++ b/source/options @@ -0,0 +1 @@ +extend-diff-ignore=src/version\.h|config\.log|lex\.yy\.c|src/config\.h\.in|INSTALL|install-sh|aclocal\.m4|Makefile\.in|configure$|missing|scripts/Makefile\.in|distros/Makefile\.in|doc/fimrc\.man\.html|doc/FIM\.html|doc/fimgs\.man\.html|doc/Makefile\.in|doc/fim\.man\.html|src/Makefile\.in diff --git a/tests/control b/tests/control new file mode 100644 index 0000000..bbc486e --- /dev/null +++ b/tests/control @@ -0,0 +1,3 @@ +Tests: run-tests +Depends: fim +Restrictions: allow-stderr diff --git a/tests/run-tests b/tests/run-tests new file mode 100755 index 0000000..e0ef18d --- /dev/null +++ b/tests/run-tests @@ -0,0 +1,5 @@ +#!/bin/sh + +VAR=${VAR:-FIMPROG=/usr/bin/fim} +make -C src/testdir clean +make -C src/testdir $VAR diff --git a/upstream/metadata b/upstream/metadata new file mode 100644 index 0000000..8a5c1a8 --- /dev/null +++ b/upstream/metadata @@ -0,0 +1,4 @@ +Repository: https://git.savannah.nongnu.org/git/fbi-improved.git/ +Repository-Browse: https://git.savannah.nongnu.org/git/fbi-improved.git/ +Bug-Database: http://savannah.nongnu.org/bugs/?group=fbi-improved +Bug-Submit: http://savannah.nongnu.org/bugs/?func=additem&group=fbi-improved diff --git a/upstream/signing-key.asc b/upstream/signing-key.asc new file mode 100644 index 0000000..9a3308a --- /dev/null +++ b/upstream/signing-key.asc @@ -0,0 +1,57 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQGiBEK+qrURBACrVQC6nGM05V26HmUAyZADfFXb89uOqSTAaoDXi5uF4QXI1oKe +/gzFcqmKug1Jm/wmq83CHLtMy/CvwDbgDHKwV7STvkYKebW+hTzsyNDgLAk2+4FK +8XninQKdnVAboDxQMbIygybsd593NUA/vlalNA0QioansTmnTaynecsX8wCgio6v +wySGO8ZXOyGZnsazV7pCHUcD/RSg2cqMg+HqcAETowhavmhPAP0T28lGgAqzmEdV +TzYDagrkppn6WH+7dyddFO64eQU0Pfs3y8BkaHm7VBE4fJN5cJenTg97XlHGUlXt +nEcv5CSqyzg6IA+KhjRHGQ2vQBOajwB1QHcQtNWBvDSHJ8JL7wLjB77d0lMrTP1L +JL87BACR1G7uzDM+b9LoVuHbiPCTIKZnkllx2lfvbBXJ7eDQkaXMURtuTLdOgW6q +ff01rMOxDP4P0x8YdQi/s//Og3u8Uyzf5BPHpUaz2O6Q/WiQtiPMBcAKRXb1LLuh +Occk6JVSrisd8CPLGRr2/ZxRSsFCKoS1XmLnDEE5wO9TYg4eDbQgZGV6cGVyYWRv +IDxkZXpwZXJhZG9AdGlzY2FsaS5pdD6IXgQTEQIAHgUCQr6qtQIbAwYLCQgHAwID +FQIDAxYCAQIeAQIXgAAKCRDg5mnI7xJYuPzHAJ4yetjAo/iWuoxnwZlO1Gm9BZEm +2QCfdU0M98SL5AFnFaBzwV+X5WCz7j60I2RlenBlcmFkbyA8ZGV6cGVyYWRvQGF1 +dGlzdGljaS5vcmc+iF8EExECAB8FAkcUj8sCGwMGCwkIBwMCBBUCCAMDFgIBAh4B +AheAAAoJEODmacjvEli4XxkAnAzhq+Kl4+UpW+zbJcMuU95N7uMTAJkBBM3FA/2j +9K9D8BIQT95z52m8+bQjbWljaGVsZSBtYXJ0b25lIDxtLm1AYXV0aXN0aWNpLm9y +Zz6IYAQTEQIAIAUCR034HAIbAwYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJEODm +acjvEli4ju0An2xZ88bm2fYMhLK/c7HOXSAi/adKAJ4s5ehUv1wmaNw73O0U9msl +VsZIDbQrTWljaGVsZSBNYXJ0b25lIDxtaWNoZWxlLm1hcnRvbmVAcG9zdGVvLmRl +PohiBBMRAgAiBQJWryJVAhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRDg +5mnI7xJYuETvAJ92QwkNIV77yz0m2RXCfVi1U2aIHACffPsvdbXutad+UfAojH54 +pYBKBNK0LE1pY2hlbGUgTWFydG9uZSA8bWljaGVsZS5tYXJ0b25lQGlwcC5tcGcu +ZGU+iGIEExECACIFAle94AoCGwMGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJ +EODmacjvEli4nhUAmwc9ykg4jj5gfwAoUawPYmRuGyZ1AKCFFikyFb1qHVD9X0pR +257psXI5JrQsbWljaGVsZSBtYXJ0b25lIDxtaWNoZWxlLm1hcnRvbmVAdGlzY2Fs +aS5pdD6IXgQTEQIAHgUCQr6srgIbAwYLCQgHAwIDFQIDAxYCAQIeAQIXgAAKCRDg +5mnI7xJYuIK7AJ95vf7G87PR7c3VHl/+2FU3DusKiQCfYLYzIScFDUeMkRVYYF/p +f9J5R720LW1pY2hlbGUgbWFydG9uZSA8bWljaGVsZS5tYXJ0b25lQHVuaXJvbWEy +Lml0PohgBBMRAgAgBQJHsIdOAhsDBgsJCAcDAgQVAggDBBYCAwECHgECF4AACgkQ +4OZpyO8SWLgxcwCggsg/418NOTt27Ib1TpJrdKe37ucAn1cQ6xBE4NJqFLgbcv39 +fSRdT/tPuQQNBEK+q6EQEADQyNObOhZR3iZVRlBthImLCnRPOnWjvVAeHHckBmL5 +NRfok3e+4g7nFNKWQC+NFeeFjF2vJZZbCqhnqU2fQiREp5G7jc9SmmywBLN1YTAj +HZgj/D6aqAppygEN8WYlXYk5Sg6oKUJ5XtZbKj8+S1kGwBZUKQn9Y6IhZ/40yfqR +vLxYYbIYCDa0MRqNP/AwzLe94CQupoAI+zo8y40J8S8jWuk4Kd6uz2DEk+GEuflF +Jg9298qAtfyZ+ULqoEh47lDcQRfXo5xRgEG/bpMHESfId2BaXuNutseSmKW1Hr2F +81CPp4znqvGx6I1M/Hb26Foh3clem7pQNOp4rKhrjdc0XGlHuAJaeAt49rpcvBxQ +t5Ht53LFlEo1otP3xKaajEuyvfEbuE1UPVv95E3UwYHzIpbriM6vcg80gviwHxsY +rNqY3MG6Dbbj5WE3B/L3vZLnDwXeaY3dGGWIc8q/tttcK/m8na362JQePphZP3d7 +RcgQDRJ+KccCkseuXHRv2/+kx1IZUhcq63LYXZGt3MlUYvd0SZT3ecsK/xbYk3sx +2RW+kV04HjJkyibwsxyaQ/Ra4ywlj0pKOk7hcjx8gKzZlq7h7vKdCNqlXtSKVUHF +JYs02UmjUwhehv8QX5Gt7yc4cwshmUo7GESSwry+JXn7g3ewryY482lm/S48ZS3b +CwADBQ/+I4+7F6Vq3BxFjjZmXbzSxODHv6ospupYpLVrHFLATf4qfYr35V277Qeu +QdHli5LCmLENdytdx8+T0JsLlBmn7HSb3h7PY/x22S73GyZM9N7aJBUHKcNmiStY +NYIH4cmNrFu9lIXUsou8u4E8IEs9NoGYwodpJ412nKbCvBnTqeQFBFszKj2Ub3hN +USy5a3CGnJsrJE2gztQ7U0n04Fq3orXtRdsdCxa67mqyjowg1/6BaWatPWavMncl +kD7QeRDPcd/OGVE/n7FlRBINiIdhsiErGWRultNQBu786F4v+XiVW0nyCD4FUau+ +BRBc0VFFVnpwHzyq8H58vb2eoP8n9DLtWb8htBfJNI3OPRvW6da8+lbu2+UdGOzv +qrdkOGasL/7D+mBGHot7eMxBxvsTaHuObRFGuEVJ3o66UlGiaq4+cBTpI+Bis2Id +VVMBRkBqFJMI35h+szdpBlKBdk/WULPOVUk5lh6SZLXIFYxoSLM3RIUDSWxhdjdD +AmdbI/r9VRnAxh/NwMfLXLpLjp2E+qPLWq1fdLLsO0dc8bJN2/AArTvxlKeXghgy +d6rTZ9BxEx9Ly9lj9s2xNN4U6giXocqYBooFAQcZq2PqHOn16bOY+GtG+z10BSDF +VYOLkbdkfHsW4oCXvnlDY7KeDvf+V5w+oVq+dHYPqn+9XeQxE6GISQQYEQIACQUC +Qr6roQIbDAAKCRDg5mnI7xJYuDc/AJ4o/GoedGpD+K6O8jUHRedSkuJyJwCeJLqI +F5/yfR4rQwQmF2kr9hkxjjc= +=3DLJ +-----END PGP PUBLIC KEY BLOCK----- diff --git a/watch b/watch new file mode 100644 index 0000000..84d1ad0 --- /dev/null +++ b/watch @@ -0,0 +1,3 @@ +version=4 +opts=pgpsigurlmangle=s/$/.sig/,uversionmangle=s/-rc/./ \ +https://download.savannah.nongnu.org/releases/fbi-improved/fim-([\d.]+(?:-rc\d)?)\.tar\.gz -- cgit v1.2.3 From 8ab28b9db62bb4926502ed32f345ec78c64a9edd Mon Sep 17 00:00:00 2001 From: Rafael Laboissiere Date: Sun, 15 Aug 2021 05:28:18 -0300 Subject: Adjust code for compilation against GCC 9 Forwarded: https://savannah.nongnu.org/bugs/index.php?58792 Last-Update: 2019-07-13 Gbp-Pq: Name compile-with-gcc-9.patch --- src/Var.h | 2 +- src/fim_types.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Var.h b/src/Var.h index 1339ac1..1c06c47 100644 --- a/src/Var.h +++ b/src/Var.h @@ -175,7 +175,7 @@ class Var if(sizeof(fim_int)==sizeof(int)) sprintf(buf,"%d",(int)i); else - sprintf(buf,"%lld",(int64_t)i); + sprintf(buf,"%ld",(int64_t)i); } else if(type=='f') diff --git a/src/fim_types.h b/src/fim_types.h index 3c66422..711366b 100644 --- a/src/fim_types.h +++ b/src/fim_types.h @@ -64,7 +64,7 @@ typedef int fim_var_t; /* a type for fim's variable types */ typedef int fim_str_t; /* a type for stdin/stdout streams */ typedef int fim_sys_int; /* always int */ - typedef int fim_color_t; /* >= 4 bytes */ + typedef unsigned int fim_color_t; /* >= 4 bytes */ typedef int fim_ts_t; /* a type for time, in seconds */ typedef int fim_tms_t; /* a type for time, in milliseconds */ -- cgit v1.2.3 From 6d8f81b45e6d838782661c15d6d400a531523339 Mon Sep 17 00:00:00 2001 From: Chris Lamb Date: Sun, 15 Aug 2021 05:28:18 -0300 Subject: Make the build reproducible MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Forwarded: https://savannah.nongnu.org/bugs/index.php?58793 Reviewed-by: Rafael Laboissière Last-Update: 2019-04-29 Gbp-Pq: Name reproducible-build.patch --- src/Makefile.am | 1 - src/fim.cpp | 7 ------- 2 files changed, 8 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 7a4fdfb..f82e4f8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -51,7 +51,6 @@ version.h: ../config.h $(ECHO) "\"\n\"" >> $@ $(GREP) define $< | $(GREP) FIM.*'"' | LC_ALL=C $(SORT) | $(SED) 's/^#//g;s/define //g;s/^\([A-Za-z0-9_]*\) "\(.*\)"$$/"\1 = \\"\2\\"\\n"/g' >> $@ $(GREP) undef $< | $(GREP) FIM | LC_ALL=C $(SORT) | $(SED) 's/^#//g;s/.*undef //g;s/^\([A-Za-z0-9_]*\).\+$$/-\1 /g;s/^/\"/g;s/$$/\"/g' >> $@ - $(ECHO) '"\n'CXXFLAGS=$(CXXFLAGS)'\n"' >> $@ help.cpp: fim.h $(ECHO) -e "#ifdef FIM_WANT_INLINE_HELP\n" > $@ diff --git a/src/fim.cpp b/src/fim.cpp index c6ba3fd..a2257af 100644 --- a/src/fim.cpp +++ b/src/fim.cpp @@ -1603,13 +1603,6 @@ fim_perr_t main(int argc,char *argv[]) #ifdef FIM_CONFIGURATION "Configuration invocation: " FIM_CONFIGURATION "\n" #endif /* FIM_CONFIGURATION */ - #ifdef CXXFLAGS - "Compile flags: CXXFLAGS=" CXXFLAGS - #ifdef CFLAGS - " CFLAGS=" CFLAGS - #endif /* CFLAGS */ - "\n" - #endif /* CXXFLAGS */ "Fim options (features included (+) or not (-)):\n" #include "version.h" /* i think some flags are missing .. */ -- cgit v1.2.3 From 73a3468506c882614d677c27a2695c75fcdfcf5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Laboissi=C3=A8re?= Date: Sun, 15 Aug 2021 05:28:18 -0300 Subject: Compile with GCC 10 Bug-Debian: https://bugs.debian.org/957202 Forwarded: https://savannah.nongnu.org/bugs/index.php?58399#comment1 Last-Update: 2020-07-20 This patch remove a non-active code (inside "#if 0") in file src/fim.cpp which, according to the upstream author, contains "leftovers from the old man file". This removal seems harmless and allows the package to be built with GCC 10. Gbp-Pq: Name compile-with-gcc-10.patch --- src/fim.cpp | 56 -------------------------------------------------------- 1 file changed, 56 deletions(-) diff --git a/src/fim.cpp b/src/fim.cpp index a2257af..e777d24 100644 --- a/src/fim.cpp +++ b/src/fim.cpp @@ -302,62 +302,6 @@ FIM_NULL {0,0,0,0,0,0} }; -#if 0 -// leftovers from the old man file; shall adapt these using .\" - .TP - .B -f font - Set font. This can be either a pcf console font file or a X11 font - spec. Using X11 fonts requires a font server (The one specified in - the environment variable FONTSERVER or on localhost). The FBFONT - environment variable is used as default. If unset, fim will - fallback to 10x20 (X11) / lat1u-16.psf (console). - .TP - .B --autoup - Like autozoom, but scale up only. - .TP - .B --autodown - Like autozoom, but scale down only. - .TP - .B -u - Randomize the order of the filenames. - .TP - .B -e - Enable editing commands. - .TP - .B -b - create backup files (when editing images). - .TP - .B -p - preserve timestamps (when editing images). - .TP - .B --comments - Display comment tags (if present) instead of the filename. Probaby - only useful if you added reasonable comments yourself (using wrjpgcom - for example), otherwise you likely just find texts pointing to the - software which created the image. - P pause the slideshow (if started with -t, toggle) - {number}g jump to image {number} - .SH EDIT IMAGE - fim also provides some very basic image editing facilities. You have - to start fim with the -e switch to use them. - .P - .nf - Shift+D delete image - R rotate 90° clockwise - L rotate 90° counter-clock wise - .fi - .P - The delete function actually wants a capital letter 'D', thus you have - to type Shift+D. This is done to avoid deleting images by mistake - because there are no safety bells: If you ask fim to delete the image, - it will be deleted without questions asked. - .P - The rotate function actually works for JPEG images only because it - calls the jpegtran command to perform a lossless rotation if the image. - It is especially useful if you review the images of your digital - camera. -#endif - const int fim_options_count=sizeof(fim_options)/sizeof(fim_options_t); struct option options[fim_options_count]; -- cgit v1.2.3 From 723a287336d11b4c27bb4cefa56b5659669cb0a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Laboissi=C3=A8re?= Date: Sun, 15 Aug 2021 05:28:18 -0300 Subject: Update configure.ac Forwarded: https://savannah.nongnu.org/bugs/?60900 Last-Update: 2021-07-09 This patch is the result of running autoupdate Gbp-Pq: Name update-configure-ac.patch --- configure.ac | 236 +++++++++++++++++++++++++++++------------------------------ 1 file changed, 117 insertions(+), 119 deletions(-) diff --git a/configure.ac b/configure.ac index b600f50..64ecc07 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,10 @@ dnl Process this file with autoconf to produce a configure script. dnl $LastChangedDate: 2017-07-19 15:46:18 +0200 (Wed, 19 Jul 2017) $ -AC_PREREQ([2.54]) +AC_PREREQ([2.71]) # we'll move forward, one day or another -#AC_PREREQ([2.61]) +#AC_PREREQ([2.71]) # for future use, too #AC_PROG_CC(cc gcc) @@ -46,7 +46,7 @@ AC_MSG_NOTICE([ # #AM_INIT_AUTOMAKE($PACKAGE_NAME, $PACKAGE_VERSION) -AC_GNU_SOURCE +AC_USE_SYSTEM_EXTENSIONS #AC_MANTAINER_MODE #AC_CANONICAL_HOST @@ -97,7 +97,7 @@ else fi AC_MSG_RESULT($fim_cv_prefix) -AC_ISC_POSIX +AC_SEARCH_LIBS([strerror],[cposix]) #AM_C_PROTOTYPES if test "x$U" != "x"; then AC_MSG_ERROR(Compiler not ANSI compliant) @@ -122,7 +122,7 @@ AC_CHECK_FUNC([rsb_lib_init]) AC_CHECK_LIB([m],[pow]) AC_CHECK_LIB([fl],[yylex]) -AC_ARG_ENABLE(graphicsmagick, AC_HELP_STRING([--enable-graphicsmagick], [Enable GraphicsMagick library support (EXPERIMENTAL).]), [ if test x$enableval != xno ; then fim_handle_graphicsmagick=yes ; fi ] ) +AC_ARG_ENABLE(graphicsmagick, AS_HELP_STRING([--enable-graphicsmagick],[Enable GraphicsMagick library support (EXPERIMENTAL).]), [ if test x$enableval != xno ; then fim_handle_graphicsmagick=yes ; fi ] ) AC_CHECK_LIB([GraphicsMagick],[GetMagickVersion], [ if test x"$fim_handle_graphicsmagick" = x"yes" ; then @@ -133,7 +133,7 @@ if test x"$fim_handle_graphicsmagick" = x"yes" ; then fi ], []) -AC_ARG_ENABLE(imlib2, AC_HELP_STRING([--enable-imlib2], [Enable Imlib2 library support (EXPERIMENTAL,INCOMPLETE).]), [ if test x$enableval != xno ; then fim_handle_imlib2=yes ; fi ] ) +AC_ARG_ENABLE(imlib2, AS_HELP_STRING([--enable-imlib2],[Enable Imlib2 library support (EXPERIMENTAL,INCOMPLETE).]), [ if test x$enableval != xno ; then fim_handle_imlib2=yes ; fi ] ) AC_CHECK_LIB([Imlib2],[imlib_create_image], [ if test x"$fim_handle_imlib2" = x"yes" ; then @@ -187,7 +187,7 @@ have_default_bindings=yes have_default_mapping=yes have_default_config=yes -AC_ARG_ENABLE(default_bindings, AC_HELP_STRING([--disable-default-bindings], [Builtin default minimal key binding]), +AC_ARG_ENABLE(default_bindings, AS_HELP_STRING([--disable-default-bindings],[Builtin default minimal key binding]), [ if test x$enableval = xyes; then have_default_bindings=yes else @@ -195,7 +195,7 @@ AC_ARG_ENABLE(default_bindings, AC_HELP_STRING([--disable-default-bindings], [Bu fi ]) -AC_ARG_ENABLE(default_mapping, AC_HELP_STRING([--disable-default-mapping], [Builtin default minimal key mapping]), +AC_ARG_ENABLE(default_mapping, AS_HELP_STRING([--disable-default-mapping],[Builtin default minimal key mapping]), [ if test x$enableval = xyes; then have_default_mapping=yes else @@ -203,7 +203,7 @@ AC_ARG_ENABLE(default_mapping, AC_HELP_STRING([--disable-default-mapping], [Buil fi ]) -AC_ARG_ENABLE(default_config, AC_HELP_STRING([--disable-default-config], [Builtin default minimal configuration]), +AC_ARG_ENABLE(default_config, AS_HELP_STRING([--disable-default-config],[Builtin default minimal configuration]), [ if test x$enableval = xyes; then have_default_config=yes else @@ -234,14 +234,14 @@ AC_ARG_ENABLE(default_config, AC_HELP_STRING([--disable-default-config], [Builti #AC_SUBST(LIBPNG_CXXFLAGS) #AC_SUBST(LIBPNG_LIBS) -AC_ARG_ENABLE(system, AC_HELP_STRING([--disable-system], [Disable system() and pipe() calls.]), +AC_ARG_ENABLE(system, AS_HELP_STRING([--disable-system],[Disable system() and pipe() calls.]), [ if test x$enableval = xno ; then fim_system_calls=no fi ]) dnl new: -AC_ARG_ENABLE(framebuffer, AC_HELP_STRING([--disable-framebuffer], [Disable the framebuffer device driver.]), +AC_ARG_ENABLE(framebuffer, AS_HELP_STRING([--disable-framebuffer],[Disable the framebuffer device driver.]), [ if test x$enableval = xno ; then fim_handle_framebuffer=no fi @@ -263,7 +263,15 @@ if test x$fim_handle_framebuffer = xno ; then AC_DEFINE(FIM_WITH_NO_FRAMEBUFFER, 1, [Defined when framebuffer device support is turned off.]) fi -AC_HEADER_STDC +m4_warn([obsolete], +[The preprocessor macro `STDC_HEADERS' is obsolete. + Except in unusual embedded environments, you can safely include all + ISO C90 headers unconditionally.])dnl +# Autoupdate added the next two lines to ensure that your configure +# script's behavior did not change. They are probably safe to remove. +AC_CHECK_INCLUDES_DEFAULT +AC_PROG_EGREP + AC_FUNC_MMAP AC_CHECK_FUNCS([bzero memset memcmp strncmp strcpy]) @@ -320,11 +328,23 @@ dnl fi dnl AC_CHECK_FUNCS(setrlimit getsid) -AC_TYPE_SIGNAL +m4_warn([obsolete], +[your code may safely assume C89 semantics that RETSIGTYPE is void. +Remove this warning and the `AC_CACHE_CHECK' when you adjust the code.])dnl +AC_CACHE_CHECK([return type of signal handlers],[ac_cv_type_signal],[AC_COMPILE_IFELSE( +[AC_LANG_PROGRAM([#include +#include +], + [return *(signal (0, 0)) (0) == 1;])], + [ac_cv_type_signal=int], + [ac_cv_type_signal=void])]) +AC_DEFINE_UNQUOTED([RETSIGTYPE],[$ac_cv_type_signal],[Define as the return type of signal handlers + (`int' or `void').]) + dnl ================== AH_TEMPLATE([FIM_WANT_STATIC_BINARY]) -AC_ARG_ENABLE(static, AC_HELP_STRING([--enable-static], [Want a static binary. (disabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_static=1 ; else fim_cv_want_static=0 ; fi ],[ fim_cv_want_static=0 ]) +AC_ARG_ENABLE(static, AS_HELP_STRING([--enable-static],[Want a static binary. (disabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_static=1 ; else fim_cv_want_static=0 ; fi ],[ fim_cv_want_static=0 ]) if test x$fim_cv_want_static == x1 ; then LIBS="$LIBS --static" LIBDJVU_STATIC_EXTRA="-lpthread" @@ -339,20 +359,19 @@ fi dnl ================== -AC_ARG_WITH(regex, AC_HELP_STRING([--with-regex], [Use the GNU regex library instead of the POSIX one]), +AC_ARG_WITH(regex, AS_HELP_STRING([--with-regex],[Use the GNU regex library instead of the POSIX one]), [fim_cv_regex=yes], [AC_CHECK_FUNCS(regcomp, fim_cv_regex=no, fim_cv_regex=yes)]) if test X$fim_cv_regex = Xno ; then AC_CACHE_CHECK([whether your system regexp library is completely broken], [fim_cv_regex_broken], - AC_TRY_RUN([ + AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include #include -int main() { regex_t blah ; regmatch_t p; p.rm_eo = p.rm_eo; return regcomp(&blah, "foo.*bar", REG_NOSUB) || regexec (&blah, "foobar", 0, NULL, 0); }], - fim_cv_regex_broken=no, fim_cv_regex_broken=yes, fim_cv_regex_broken=yes)) +int main() { regex_t blah ; regmatch_t p; p.rm_eo = p.rm_eo; return regcomp(&blah, "foo.*bar", REG_NOSUB) || regexec (&blah, "foobar", 0, NULL, 0); }]])],[fim_cv_regex_broken=no],[fim_cv_regex_broken=yes],[fim_cv_regex_broken=yes])) if test X$fim_cv_regex_broken = Xyes ; then - echo "Using the included GNU regex instead." >&AC_FD_MSG + echo "Using the included GNU regex instead." >&AS_MESSAGE_FD fim_cv_regex=yes fi fi @@ -365,7 +384,7 @@ fi AC_MSG_CHECKING(where to put the documentation...) -dnl AC_ARG_WITH(docdir, AC_HELP_STRING([--with-docdir=PATH], [Specify where to put the documentation]), +dnl AC_ARG_WITH(docdir, AS_HELP_STRING([--with-docdir=PATH],[Specify where to put the documentation]), dnl [fim_cv_docdir=$withval], dnl [fim_cv_docdir='${prefix}/doc/fim-${fim_cv_version}']) # FIXME : the above line seems troublesome, BUT IT IS NOT (see the muttrc for this trick). @@ -378,7 +397,7 @@ AC_SUBST(fim_cv_version) dnl ============= gif file handling -AC_ARG_ENABLE(gif, AC_HELP_STRING([--disable-gif], [Disable gif support.]), +AC_ARG_ENABLE(gif, AS_HELP_STRING([--disable-gif],[Disable gif support.]), [ if test x$enableval = xno ; then fim_handle_gif=no fi @@ -393,14 +412,11 @@ if test x$fim_handle_gif != xno ; then AC_MSG_WARN([*** GIF loader will not be built (GIF library not found) ***])) if test x"$have_gif" = xyes; then AC_MSG_CHECKING([for gif.h]) - AC_TRY_CPP( -[#include + AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include #undef PACKAGE #undef VERSION #undef HAVE_STDLIB_H -#include ], - have_gif=yes, - have_gif=no) +#include ]])],[have_gif=yes],[have_gif=no]) AC_MSG_RESULT($have_gif) if test x"$have_gif" = xyes; then LIBGIF='-lgif' @@ -432,7 +448,7 @@ AM_CONDITIONAL(ENABLE_GIF, test x$have_gif = xyes) dnl ============= tiff file handling -AC_ARG_ENABLE(tiff, AC_HELP_STRING([--disable-tiff], [Disable tiff support.]), +AC_ARG_ENABLE(tiff, AS_HELP_STRING([--disable-tiff],[Disable tiff support.]), [ if test x$enableval = xno ; then fim_handle_tiff=no fi @@ -447,14 +463,11 @@ if test x$fim_handle_tiff != xno ; then AC_MSG_WARN([*** TIFF loader will not be built (TIFF library not found) ***]) , [$LIBTIFF_STATIC_EXTRA]) if test x"$have_tiff" = xyes; then AC_MSG_CHECKING([for tiff.h]) - AC_TRY_CPP( -[#include + AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include #undef PACKAGE #undef VERSION #undef HAVE_STDLIB_H -#include ], - have_tiff=yes, - have_tiff=no) +#include ]])],[have_tiff=yes],[have_tiff=no]) AC_MSG_RESULT($have_tiff) if test x"$have_tiff" = xyes; then LIBTIFF="-ltiff $LIBTIFF_STATIC_EXTRA" @@ -501,7 +514,7 @@ dnl ============= GNU gpm, unofficial yet dnl ============= no readline case handling fim_want_cxx11=no -AC_ARG_ENABLE(cxx11, AC_HELP_STRING([--enable-cxx11], [Enable C++11 standard constructs (requires appropriate CXXFLAGS, e.g. -std=c++11) (EXPERIMENTAL).]), +AC_ARG_ENABLE(cxx11, AS_HELP_STRING([--enable-cxx11],[Enable C++11 standard constructs (requires appropriate CXXFLAGS, e.g. -std=c++11) (EXPERIMENTAL).]), [ if test x$enableval = xno ; then fim_want_cxx11=no else @@ -512,7 +525,7 @@ AC_ARG_ENABLE(cxx11, AC_HELP_STRING([--enable-cxx11], [Enable C++11 standard con dnl ============= no readline case handling fim_want_readline=yes -AC_ARG_ENABLE(readline, AC_HELP_STRING([--disable-readline], [Disable readline support (EXPERIMENTAL).]), +AC_ARG_ENABLE(readline, AS_HELP_STRING([--disable-readline],[Disable readline support (EXPERIMENTAL).]), [ if test x$enableval = xno ; then fim_want_readline=no else @@ -561,7 +574,7 @@ fi dnl ============= jpeg file handling #AC_ARG_WITH(jpeg, [ --disable-jpeg ], [ disable jpeg file support]) -AC_ARG_ENABLE(jpeg, AC_HELP_STRING([--disable-jpeg], [Disable jpeg support.]), +AC_ARG_ENABLE(jpeg, AS_HELP_STRING([--disable-jpeg],[Disable jpeg support.]), [ if test x$enableval = xno ; then fim_handle_jpeg=no fi @@ -576,14 +589,11 @@ if test x$fim_handle_jpeg != xno ; then AC_MSG_WARN([*** JPEG loader will not be built (JPEG library not found) ***])) if test x"$have_jpeg" = xyes; then AC_MSG_CHECKING([for jpeglib.h]) - AC_TRY_CPP( -[#include + AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include #undef PACKAGE #undef VERSION #undef HAVE_STDLIB_H -#include ], - have_jpeg=yes, - have_jpeg=no) +#include ]])],[have_jpeg=yes],[have_jpeg=no]) AC_MSG_RESULT($have_jpeg) if test x"$have_jpeg" = xyes; then LIBJPEG='-ljpeg' @@ -616,7 +626,7 @@ AM_CONDITIONAL(ENABLE_JPEG, test x$have_jpeg = xyes) dnl ============= dvi file handling (via TeX-Guy) dnl -dnl AC_ARG_ENABLE(dvi, AC_HELP_STRING([--disable-dvi], [Disable dvi support.]), +dnl AC_ARG_ENABLE(dvi, AS_HELP_STRING([--disable-dvi],[Disable dvi support.]), dnl [ if test x$enableval = xno ; then dnl fim_handle_dvi=no dnl fi @@ -631,14 +641,11 @@ dnl have_dvi=no dnl AC_MSG_WARN([*** DVI loader will not be built (libdvi29 library not found) ***])) dnl if test x"$have_dvi" = xyes; then dnl AC_MSG_CHECKING([for libdvi29.h]) -dnl AC_TRY_CPP( -dnl [#include +dnl AC_PREPROC_IFELSE([AC_LANG_SOURCE([[dnl #include dnl #undef PACKAGE dnl #undef VERSION dnl #undef HAVE_STDLIB_H -dnl #include ], -dnl have_dvi=yes, -dnl have_dvi=no) +dnl #include ]])],[dnl have_dvi=yes],[dnl have_dvi=no]) dnl AC_MSG_RESULT($have_dvi) dnl if test x"$have_dvi" = xyes; then dnl LIBDVI='-ldvilib2' @@ -670,7 +677,7 @@ dnl AM_CONDITIONAL(ENABLE_DVI, test x$have_dvi = xyes) dnl ============= ps file handling -AC_ARG_ENABLE(ps, AC_HELP_STRING([--disable-ps], [Disable ps support.]), +AC_ARG_ENABLE(ps, AS_HELP_STRING([--disable-ps],[Disable ps support.]), [ if test x$enableval = xno ; then fim_handle_ps=no fi @@ -685,14 +692,11 @@ if test x$fim_handle_ps != xno ; then AC_MSG_WARN([*** PS loader will not be built (spectre library not found) ***]) , [$LIBSPECTRE_STATIC_EXTRA]) if test x"$have_ps" = xyes; then AC_MSG_CHECKING([for libspectre/spectre.h]) - AC_TRY_CPP( -[#include + AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include #undef PACKAGE #undef VERSION #undef HAVE_STDLIB_H -#include ], - have_ps=yes, - have_ps=no) +#include ]])],[have_ps=yes],[have_ps=no]) AC_MSG_RESULT($have_ps) if test x"$have_ps" = xyes; then LIBPS="-lspectre $LIBSPECTRE_STATIC_EXTRA" @@ -726,7 +730,7 @@ AM_CONDITIONAL(ENABLE_PS, test x$have_ps = xyes) dnl ============= djvu file handling -AC_ARG_ENABLE(djvu, AC_HELP_STRING([--disable-djvu], [Disable djvu support.]), +AC_ARG_ENABLE(djvu, AS_HELP_STRING([--disable-djvu],[Disable djvu support.]), [ if test x$enableval = xno ; then fim_handle_djvu=no fi @@ -741,14 +745,11 @@ if test x$fim_handle_djvu != xno ; then AC_MSG_WARN([*** DJVU loader will not be built (DJVU library not found) ***]), [$LIBDJVU_STATIC_EXTRA]) if test x"$have_djvu" = xyes; then AC_MSG_CHECKING([for libdjvu/ddjvuapi.h]) - AC_TRY_CPP( -[#include + AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include #undef PACKAGE #undef VERSION #undef HAVE_STDLIB_H -#include ], - have_djvu=yes, - have_djvu=no) +#include ]])],[have_djvu=yes],[have_djvu=no]) AC_MSG_RESULT($have_djvu) if test x"$have_djvu" = xyes; then LIBDJVU="-ldjvulibre $LIBDJVU_STATIC_EXTRA" @@ -784,7 +785,7 @@ dnl dnl By default, we disable poppler : its API is still immature. dnl fim_handle_pdf=no -AC_ARG_ENABLE(poppler, AC_HELP_STRING([--enable-poppler], [Enable poppler (PDF rendering) support. This will add LIBPOPPLER_CXXFLAGS="-I/usr/include/poppler/" to the compilation flags. You can override this by passing configure a suitable LIBPOPPLER_CXXFLAGS variable.]), +AC_ARG_ENABLE(poppler, AS_HELP_STRING([--enable-poppler],[Enable poppler (PDF rendering) support. This will add LIBPOPPLER_CXXFLAGS="-I/usr/include/poppler/" to the compilation flags. You can override this by passing configure a suitable LIBPOPPLER_CXXFLAGS variable.]), [ if test x$enableval = xyes ; then fim_handle_pdf=yes fi @@ -801,8 +802,7 @@ dnl FIXME : the following is a dirty hack AC_MSG_WARN([*** POPPLER loader will not be built (POPPLER library not found) ***]) ) if test x"$have_poppler" = xyes; then AC_MSG_CHECKING([for poppler/poppler-config.h]) - AC_TRY_CPP( - [#include + AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include #undef PACKAGE #undef VERSION #undef HAVE_STDLIB_H @@ -815,9 +815,7 @@ dnl FIXME : the following is a dirty hack #include #include #include /* globalParams lives here */ - ], - have_poppler=yes, - have_poppler=no) + ]])],[have_poppler=yes],[have_poppler=no]) have_poppler=yes AC_MSG_RESULT($have_poppler) if test x"$have_poppler" = xyes; then @@ -858,7 +856,7 @@ AM_CONDITIONAL(ENABLE_POPPLER, test x$have_poppler = xyes) dnl FIXME : we have two libpoppler checks ... : dnl ================== pdf checks =================================================== AC_ARG_ENABLE(pdf, - [AC_HELP_STRING([--enable-pdf], [Compile with pdf support])],enable_pdf="$enableval",enable_pdf=yes) + [AS_HELP_STRING([--enable-pdf],[Compile with pdf support])],enable_pdf="$enableval",enable_pdf=yes) if test "x$enable_pdf" = "xyes"; then POPPLER_REQUIRED=0.8.7 @@ -884,7 +882,7 @@ dnl ================== end of pdf checks ======================================= dnl ================================================================================ fim_handle_bmp=yes -AC_ARG_ENABLE(bmp, AC_HELP_STRING([--disable-bmp], [Disable BMP file support (enabled by default).]), +AC_ARG_ENABLE(bmp, AS_HELP_STRING([--disable-bmp],[Disable BMP file support (enabled by default).]), [ if test x$enableval = xno ; then fim_handle_bmp=no fi @@ -899,7 +897,7 @@ else fi dnl ================================================================================ fim_handle_pcx=yes -AC_ARG_ENABLE(pcx, AC_HELP_STRING([--disable-pcx], [Disable PCX file support (enabled by default).]), +AC_ARG_ENABLE(pcx, AS_HELP_STRING([--disable-pcx],[Disable PCX file support (enabled by default).]), [ if test x$enableval = xno ; then fim_handle_pcx=no fi @@ -916,12 +914,12 @@ dnl ============================================================================ ## png file handling -AC_ARG_WITH(png-prefix, AC_HELP_STRING([--with-png-prefix=PFX], [prefix where libpng is installed (optional)]), +AC_ARG_WITH(png-prefix, AS_HELP_STRING([--with-png-prefix=PFX],[prefix where libpng is installed (optional)]), libpng_config_prefix="$withval", libpng_config_prefix="") fim_handle_png=yes -AC_ARG_ENABLE(png, AC_HELP_STRING([--disable-png], [Disable png support.]), +AC_ARG_ENABLE(png, AS_HELP_STRING([--disable-png],[Disable png support.]), [ if test x$enableval = xno ; then fim_handle_png=no fi @@ -957,7 +955,7 @@ dnl ============================================================================ fim_handle_xyz=no -AC_ARG_ENABLE(xyz, AC_HELP_STRING([--enable-xyz], [Enable the sample bogus 'xyz' file loading support. This makes only sense in order to learn how to include a new file format and wish to play with src/FbiStuffXyz.cpp in the while.]), +AC_ARG_ENABLE(xyz, AS_HELP_STRING([--enable-xyz],[Enable the sample bogus 'xyz' file loading support. This makes only sense in order to learn how to include a new file format and wish to play with src/FbiStuffXyz.cpp in the while.]), [ if test x$enableval = xyes ; then fim_handle_xyz=yes fi @@ -976,7 +974,7 @@ dnl ============================================================================ fim_handle_ufraw=no -AC_ARG_ENABLE(ufraw, AC_HELP_STRING([--enable-ufraw], [Enable UFRaw support (EXPERIMENTAL).]), +AC_ARG_ENABLE(ufraw, AS_HELP_STRING([--enable-ufraw],[Enable UFRaw support (EXPERIMENTAL).]), [ if test x$enableval = xno ; then fim_handle_ufraw=no else @@ -999,7 +997,7 @@ dnl ============================================================================ fim_handle_archive=no -AC_ARG_ENABLE(archive, AC_HELP_STRING([--enable-archive], [Enable libarchive support (please provide ARCHIVE_LIBS, ARCHIVE_CXXFLAGS) (EXPERIMENTAL, UNFINISHED).]), +AC_ARG_ENABLE(archive, AS_HELP_STRING([--enable-archive],[Enable libarchive support (please provide ARCHIVE_LIBS, ARCHIVE_CXXFLAGS) (EXPERIMENTAL, UNFINISHED).]), [ if test x$enableval = xno ; then fim_handle_archive=no else @@ -1018,7 +1016,7 @@ fi dnl ================================================================================ AC_CHECK_LIB(exif, exif_data_new_from_data,have_libexif=yes,have_libexif=no) -AC_ARG_ENABLE(exif, AC_HELP_STRING([--disable-exif], [JPEG EXIF tags support with libexif.]), [if test x$enableval != xno; then fim_cv_libexif=yes; fi],[fim_cv_libexif=yes;]) +AC_ARG_ENABLE(exif, AS_HELP_STRING([--disable-exif],[JPEG EXIF tags support with libexif.]), [if test x$enableval != xno; then fim_cv_libexif=yes; fi],[fim_cv_libexif=yes;]) if test x$fim_cv_libexif = xyes; then if test x$have_libexif = xyes; then @@ -1036,7 +1034,7 @@ fi dnl ================================================================================ -AC_ARG_ENABLE(jasper, AC_HELP_STRING([--enable-jasper], [Turns on JPEG-2000 files support using JasPer (EXPERIMENTAL)]), +AC_ARG_ENABLE(jasper, AS_HELP_STRING([--enable-jasper],[Turns on JPEG-2000 files support using JasPer (EXPERIMENTAL)]), [if test x$enableval = xyes; then fim_cv_libjasper=yes; CXXFLAGS="$CXXFLAGS"; @@ -1056,7 +1054,7 @@ AC_ARG_ENABLE(jasper, AC_HELP_STRING([--enable-jasper], [Turns on JPEG-2000 file dnl ================================================================================ AC_CHECK_LIB(aa, aa_getfirst,fim_cv_libaa=yes,fim_cv_libaa=no) -AC_ARG_ENABLE(aa, AC_HELP_STRING([--disable-aa], [Ascii Art (-o aa) support (via aalib)]), [if test x$enableval != xno; then fim_cv_libaa=yes; else fim_cv_libaa=no; fi],[fim_cv_libaa=yes;]) +AC_ARG_ENABLE(aa, AS_HELP_STRING([--disable-aa],[Ascii Art (-o aa) support (via aalib)]), [if test x$enableval != xno; then fim_cv_libaa=yes; else fim_cv_libaa=no; fi],[fim_cv_libaa=yes;]) if test x$fim_cv_libaa != xno; then if test x$ac_cv_lib_aa_aa_getfirst = xyes; then AC_MSG_NOTICE([Enabling aalib driver.]) @@ -1091,18 +1089,18 @@ dnl ============================================================================ ## sdl driver -AC_ARG_WITH(sdl-prefix, AC_HELP_STRING([--with-sdl-prefix=PFX], [prefix where libsdl is installed (optional)]), +AC_ARG_WITH(sdl-prefix, AS_HELP_STRING([--with-sdl-prefix=PFX],[prefix where libsdl is installed (optional)]), libsdl_config_prefix="$withval", libsdl_config_prefix="") fim_handle_sdl='auto' -dnl AC_ARG_ENABLE(sdl, AC_HELP_STRING([--disable-sdl], [Disable libsdl support.]), +dnl AC_ARG_ENABLE(sdl, AS_HELP_STRING([--disable-sdl],[Disable libsdl support.]), dnl [ if test x$enableval = xno ; then dnl fim_handle_sdl=no dnl fi dnl ]) -AC_ARG_ENABLE(sdl, AC_HELP_STRING([--disable-sdl], [Disable libsdl support.]), +AC_ARG_ENABLE(sdl, AS_HELP_STRING([--disable-sdl],[Disable libsdl support.]), [ if test x$enableval = xyes ; then fim_handle_sdl=yes ; fi ] [ if test x$enableval = xno ; then fim_handle_sdl=no ; fi ]) @@ -1141,7 +1139,7 @@ dnl ============================================================================ AH_TEMPLATE([FIM_WANT_EXIFTOOL]) fim_cv_exiftool=no -AC_ARG_ENABLE(exiftool, AC_HELP_STRING([--enable-exiftool], [Turns on exiftool support (EXPERIMENTAL, shall provide the EXIFTOOLLINK variable with library or object files and EXIFTOOLCXXFLAGS)]), +AC_ARG_ENABLE(exiftool, AS_HELP_STRING([--enable-exiftool],[Turns on exiftool support (EXPERIMENTAL, shall provide the EXIFTOOLLINK variable with library or object files and EXIFTOOLCXXFLAGS)]), [if test x$enableval = xyes; then fim_cv_exiftool=yes CXXFLAGS="$CXXFLAGS $EXIFTOOLCXXFLAGS" @@ -1162,7 +1160,7 @@ dnl ================== fim_cv_autocommands=yes -AC_ARG_ENABLE(autocommands, AC_HELP_STRING([--disable-autocommands], [Fim will by default use autocommands.]), +AC_ARG_ENABLE(autocommands, AS_HELP_STRING([--disable-autocommands],[Fim will by default use autocommands.]), [if test x$enableval = xno; then fim_cv_autocommands=no fi]) @@ -1178,7 +1176,7 @@ fi dnl ================== -AC_ARG_ENABLE(hardcoded-font, AC_HELP_STRING([--enable-hardcoded-font], [Enable a hardcoded font in the executable (good as a fallback (FBFONT=fim://) when no PSF format consolefonts files are available).]), +AC_ARG_ENABLE(hardcoded-font, AS_HELP_STRING([--enable-hardcoded-font],[Enable a hardcoded font in the executable (good as a fallback (FBFONT=fim://) when no PSF format consolefonts files are available).]), [if test x$enableval = xyes; then fim_cv_hardcoded_font=yes; else @@ -1197,7 +1195,7 @@ AM_CONDITIONAL(FIM_WANT_HARDCODED_CONSOLEFONT, test x$have_hardcoded_font = xyes dnl ================== -AC_ARG_ENABLE(long-int-vars, AC_HELP_STRING([--enable-long-int-vars], [Internals shall use 64 bit integers (EXPERIMENTAL].), +AC_ARG_ENABLE(long-int-vars, AS_HELP_STRING([--enable-long-int-vars],[Internals shall use 64 bit integers (EXPERIMENTAL.]), [if test x$enableval = xyes; then fim_cv_want_int64_int=yes; else @@ -1214,7 +1212,7 @@ dnl ================== fim_cv_windows=yes -AC_ARG_ENABLE(windows, AC_HELP_STRING([--disable-windows], [Disable windowing system in Fim. (deprecated)]), +AC_ARG_ENABLE(windows, AS_HELP_STRING([--disable-windows],[Disable windowing system in Fim. (deprecated)]), [if test x$enableval = xno; then fim_cv_windows=no fi]) @@ -1231,7 +1229,7 @@ fi dnl ================== fim_cv_fimrc=yes -AC_ARG_ENABLE(fimrc, AC_HELP_STRING([--disable-fimrc], [Fim will by default load the ~/.fimrc file.]), +AC_ARG_ENABLE(fimrc, AS_HELP_STRING([--disable-fimrc],[Fim will by default load the ~/.fimrc file.]), [if test x$enableval = xno; then fim_cv_fimrc=no fi]) @@ -1247,7 +1245,7 @@ dnl ================== AH_TEMPLATE([FIM_NOHISTORY]) fim_cv_history=yes -AC_ARG_ENABLE(history, AC_HELP_STRING([--disable-history], [Fim will by default load/save a ~/.fim_history file.]), +AC_ARG_ENABLE(history, AS_HELP_STRING([--disable-history],[Fim will by default load/save a ~/.fim_history file.]), [if test x$enableval = xno; then fim_cv_history=no fi]) @@ -1262,7 +1260,7 @@ fi dnl ================== fim_cv_warnings=no -AC_ARG_ENABLE(screen, AC_HELP_STRING([--disable-screen], [Fim will try to work under screen by default (please read BUGS)]), +AC_ARG_ENABLE(screen, AS_HELP_STRING([--disable-screen],[Fim will try to work under screen by default (please read BUGS)]), [ if test x$enableval = xno; then fim_cv_screen=no else @@ -1274,7 +1272,7 @@ AC_ARG_ENABLE(screen, AC_HELP_STRING([--disable-screen], [Fim will try to work u dnl ================== fim_cv_resize_optimizations=yes -AC_ARG_ENABLE(resize-optimizations, AC_HELP_STRING([--disable-resize-optimizations], [Some old (fbi) code is optimized for speedup in fim.]), +AC_ARG_ENABLE(resize-optimizations, AS_HELP_STRING([--disable-resize-optimizations],[Some old (fbi) code is optimized for speedup in fim.]), [ if test x$enableval = xno; then fim_cv_resize_optimizations=no else @@ -1286,7 +1284,7 @@ AC_ARG_ENABLE(resize-optimizations, AC_HELP_STRING([--disable-resize-optimizatio dnl ================== fim_cv_read_stdin_image=yes -AC_ARG_ENABLE(stdin-image-reading, AC_HELP_STRING([--disable-stdin-image-reading], [Fim will read an image from stdin with the -i switch. (experimental)]), +AC_ARG_ENABLE(stdin-image-reading, AS_HELP_STRING([--disable-stdin-image-reading],[Fim will read an image from stdin with the -i switch. (experimental)]), [ if test x$enableval = xno; then fim_cv_read_stdin_image=no else @@ -1297,7 +1295,7 @@ AC_ARG_ENABLE(stdin-image-reading, AC_HELP_STRING([--disable-stdin-image-reading dnl ================== fim_cv_scan_consolefonts=yes -AC_ARG_ENABLE(scan-consolefonts, AC_HELP_STRING([--enable-scan-consolefonts], [Fim will scan some predefined directory in look for console fonts as a fallback. (experimental)]), +AC_ARG_ENABLE(scan-consolefonts, AS_HELP_STRING([--enable-scan-consolefonts],[Fim will scan some predefined directory in look for console fonts as a fallback. (experimental)]), [ if test x$enableval = xyes; then fim_cv_scan_consolefonts=yes else @@ -1307,7 +1305,7 @@ AC_ARG_ENABLE(scan-consolefonts, AC_HELP_STRING([--enable-scan-consolefonts], [F ) dnl ================== fim_cv_seek_magic=yes -AC_ARG_ENABLE(seek-magic, AC_HELP_STRING([--enable-seek-magic], [Fim will be capable to seek on a specified magic string. (experimental)]), +AC_ARG_ENABLE(seek-magic, AS_HELP_STRING([--enable-seek-magic],[Fim will be capable to seek on a specified magic string. (experimental)]), [ if test x$enableval = xyes; then fim_cv_seek_magic=yes else @@ -1316,7 +1314,7 @@ AC_ARG_ENABLE(seek-magic, AC_HELP_STRING([--enable-seek-magic], [Fim will be cap ],[ fim_cv_seek_magic=no ] ) dnl ================== -AC_ARG_ENABLE(pushdir, AC_HELP_STRING([--enable-pushdir], [Fim will scan directories for files.]), +AC_ARG_ENABLE(pushdir, AS_HELP_STRING([--enable-pushdir],[Fim will scan directories for files.]), [ if test x$enableval = xno; then fim_cv_read_dirs=no else @@ -1325,7 +1323,7 @@ AC_ARG_ENABLE(pushdir, AC_HELP_STRING([--enable-pushdir], [Fim will scan directo ],[ fim_cv_read_dirs=yes ] ) dnl ================== -AC_ARG_ENABLE(recursive-pushdir, AC_HELP_STRING([--disable-recursive-pushdir], [Fim will be able to push directories recursively (implies --enable-push-dirs )]), +AC_ARG_ENABLE(recursive-pushdir, AS_HELP_STRING([--disable-recursive-pushdir],[Fim will be able to push directories recursively (implies --enable-push-dirs )]), [ if test x$enableval = xyes; then fim_cv_recursive_dirs=yes; fim_cv_read_dirs=yes; @@ -1387,7 +1385,7 @@ fi dnl ================== fim_cv_warnings=no -AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [Turns on debug options (recommended for debugging)]), +AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug],[Turns on debug options (recommended for debugging)]), [if test x$enableval = xyes; then fim_cv_debug=yes fi]) @@ -1395,7 +1393,7 @@ fi]) dnl ================== fim_cv_warnings=no -AC_ARG_ENABLE(warnings, AC_HELP_STRING([--enable-warnings], [Turns on compiler warnings (recommended, for debugging)]), +AC_ARG_ENABLE(warnings, AS_HELP_STRING([--enable-warnings],[Turns on compiler warnings (recommended, for debugging)]), [if test x$enableval = xyes; then fim_cv_warnings=yes fi]) @@ -1419,7 +1417,7 @@ dnl ================== fim_cv_cacalib=no -AC_ARG_ENABLE(cacalib, AC_HELP_STRING([--enable-cacalib], [Turns on cacalib support (STILL INCOMPLETE)]), +AC_ARG_ENABLE(cacalib, AS_HELP_STRING([--enable-cacalib],[Turns on cacalib support (STILL INCOMPLETE)]), [if test x$enableval = xyes; then if test x$have_cacalib = xyes; then fim_cv_cacalib=yes @@ -1433,8 +1431,7 @@ AC_ARG_ENABLE(cacalib, AC_HELP_STRING([--enable-cacalib], [Turns on cacalib supp dnl ================== # This code still awaits for integration ... -AC_ARG_WITH(cflags, AC_HELP_STRING([--with-cflags=CXXFLAGS], - [Specify a custom CXXFLAGS append value. e.g.: -pg +AC_ARG_WITH(cflags, AS_HELP_STRING([--with-cflags=CXXFLAGS],[Specify a custom CXXFLAGS append value. e.g.: -pg You cannot call this argument multiple times. In case you want completely reset CXXFLAGS use : CXXFLAGS='' ./configure .. @@ -1456,7 +1453,7 @@ AC_ARG_WITH(cflags, AC_HELP_STRING([--with-cflags=CXXFLAGS], dnl ================== # This code still awaits for integration ... -AC_ARG_WITH(exec-shell, AC_HELP_STRING([--with-exec-shell=SHELL], [Specify alternate shell (ONLY if /bin/sh is broken)]), +AC_ARG_WITH(exec-shell, AS_HELP_STRING([--with-exec-shell=SHELL],[Specify alternate shell (ONLY if /bin/sh is broken)]), [if test x$withval != xyes; then AC_DEFINE_UNQUOTED(EXECSHELL, "$withval", [program to use for shell commands]) @@ -1466,7 +1463,7 @@ AC_ARG_WITH(exec-shell, AC_HELP_STRING([--with-exec-shell=SHELL], [Specify alter [AC_DEFINE_UNQUOTED(EXECSHELL, "/bin/sh")]) dnl ================== -AC_ARG_ENABLE(convert, AC_HELP_STRING([--disable-smartautocompletion], [Fim will treat as a proper, unescaped string, nonquoted and nonevaluated strings which happen to match an existing filename.]), +AC_ARG_ENABLE(convert, AS_HELP_STRING([--disable-smartautocompletion],[Fim will treat as a proper, unescaped string, nonquoted and nonevaluated strings which happen to match an existing filename.]), [ if test x$enableval = xno; then fim_cv_smartautcompletion=no else @@ -1484,7 +1481,7 @@ if test x$fim_cv_scan_consolefonts = xyes; then fi dnl ================== -AC_ARG_ENABLE(convert, AC_HELP_STRING([--disable-convert], [Fim will try to use convert (ImageMagick) as a last resort for opening unknown format files.]), +AC_ARG_ENABLE(convert, AS_HELP_STRING([--disable-convert],[Fim will try to use convert (ImageMagick) as a last resort for opening unknown format files.]), [ if test x$enableval = xno; then fim_cv_convert=no else @@ -1497,7 +1494,7 @@ AC_ARG_ENABLE(convert, AC_HELP_STRING([--disable-convert], [Fim will try to use dnl ================== -AC_ARG_ENABLE(xcftopnm, AC_HELP_STRING([--disable-xcftopnm], [Fim will try to use xcftopnm (Gimp) for opening XCF format files.]), +AC_ARG_ENABLE(xcftopnm, AS_HELP_STRING([--disable-xcftopnm],[Fim will try to use xcftopnm (Gimp) for opening XCF format files.]), [ if test x$enableval = xno; then fim_cv_xcftopnm=no else @@ -1509,7 +1506,7 @@ AC_ARG_ENABLE(xcftopnm, AC_HELP_STRING([--disable-xcftopnm], [Fim will try to us dnl ================== fim_cv_inkscape=yes -AC_ARG_ENABLE(inkscape, AC_HELP_STRING([--disable-inkscape], [Fim will try to use Inkscape for opening SVG format files.]), +AC_ARG_ENABLE(inkscape, AS_HELP_STRING([--disable-inkscape],[Fim will try to use Inkscape for opening SVG format files.]), [ if test x$enableval = xno; then fim_cv_inkscape=no else @@ -1520,7 +1517,7 @@ AC_ARG_ENABLE(inkscape, AC_HELP_STRING([--disable-inkscape], [Fim will try to us dnl ================== -AC_ARG_ENABLE(xfig, AC_HELP_STRING([--disable-xfig], [Fim will try to use xfig (fig2dev) for opening FIG format files.]), +AC_ARG_ENABLE(xfig, AS_HELP_STRING([--disable-xfig],[Fim will try to use xfig (fig2dev) for opening FIG format files.]), [ if test x$enableval = xno; then fim_cv_xfig=no else @@ -1531,7 +1528,7 @@ AC_ARG_ENABLE(xfig, AC_HELP_STRING([--disable-xfig], [Fim will try to use xfig ( dnl ================== -AC_ARG_ENABLE(dia, AC_HELP_STRING([--disable-dia], [Fim will try to use dia for opening DIA format files.]), +AC_ARG_ENABLE(dia, AS_HELP_STRING([--disable-dia],[Fim will try to use dia for opening DIA format files.]), [ if test x$enableval = xno; then fim_cv_dia=no else @@ -1542,19 +1539,19 @@ AC_ARG_ENABLE(dia, AC_HELP_STRING([--disable-dia], [Fim will try to use dia for dnl ================== AH_TEMPLATE([FIM_DEFAULT_CONSOLEFONT]) -AC_ARG_WITH(default-consolefont, AC_HELP_STRING([--with-default-consolefont=FILE], [Specify a default consolefont (psf or psf.gz format) file.]), [ AC_DEFINE_UNQUOTED(FIM_DEFAULT_CONSOLEFONT, "$withval") ], [fim_cv_defaultconsolefont=""]) +AC_ARG_WITH(default-consolefont, AS_HELP_STRING([--with-default-consolefont=FILE],[Specify a default consolefont (psf or psf.gz format) file.]), [ AC_DEFINE_UNQUOTED(FIM_DEFAULT_CONSOLEFONT, "$withval") ], [fim_cv_defaultconsolefont=""]) dnl ================== -AC_ARG_WITH(custom-hardcoded-consolefont, AC_HELP_STRING([--with-custom-hardcoded-consolefont=FILE], [Specify a custom consolefont to be hardcoded (uncompressed psf format, absolute path) at build time (requires --enable-hardcoded-font).]), [ +AC_ARG_WITH(custom-hardcoded-consolefont, AS_HELP_STRING([--with-custom-hardcoded-consolefont=FILE],[Specify a custom consolefont to be hardcoded (uncompressed psf format, absolute path) at build time (requires --enable-hardcoded-font).]), [ fim_cv_want_custom_hardcoded_consolefont=true; AC_SUBST(FIM_CUSTOM_HARDCODED_CONSOLEFONT, "$withval") ], []) AM_CONDITIONAL(FIM_WANT_CUSTOM_HARDCODED_CONSOLEFONT, test x$fim_cv_want_custom_hardcoded_consolefont = xtrue ) dnl ================== -AC_ARG_WITH(tmpfile, AC_HELP_STRING([--with-tmpfile=FILE], [Specify where to put temporary files created when interacting with external conversion programs (default is "/tmp/__FIM_TEMPORARY_FILE").]), +AC_ARG_WITH(tmpfile, AS_HELP_STRING([--with-tmpfile=FILE],[Specify where to put temporary files created when interacting with external conversion programs (default is "/tmp/__FIM_TEMPORARY_FILE").]), [fim_cv_tmpfile=$withval], [fim_cv_tmpfile="/tmp/__FIM_TEMPORARY_FILE"]) dnl ================== -AC_ARG_ENABLE(custom-status-bar, AC_HELP_STRING([--disable-custom-status-bar], [Customization of status bar via a printf-like string.]), +AC_ARG_ENABLE(custom-status-bar, AS_HELP_STRING([--disable-custom-status-bar],[Customization of status bar via a printf-like string.]), [ if test x$enableval = xno; then fim_cv_custom_status_bar=no; else @@ -1564,7 +1561,7 @@ AC_ARG_ENABLE(custom-status-bar, AC_HELP_STRING([--disable-custom-status-bar], [ ) dnl ================== -AC_ARG_ENABLE(optimizations, AC_HELP_STRING([--enable-optimizations], [Will try to enhance compilation flags (EXPERIMENTAL)]), +AC_ARG_ENABLE(optimizations, AS_HELP_STRING([--enable-optimizations],[Will try to enhance compilation flags (EXPERIMENTAL)]), [ if test x$enableval = xno; then fim_cv_optimizations=no else @@ -1722,23 +1719,23 @@ dnl ================== dnl ================== AH_TEMPLATE([FIM_WANT_FILENAME_MARK_AND_DUMP]) -AC_ARG_ENABLE(mark-and-dump, AC_HELP_STRING([--enable-mark-and-dump], [Fim will be capable of marking files while viewing and outputting their names on exit. (enabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_mark_and_dump=1 ; else fim_cv_want_mark_and_dump=0 ; fi ],[ fim_cv_want_mark_and_dump=1 ]) +AC_ARG_ENABLE(mark-and-dump, AS_HELP_STRING([--enable-mark-and-dump],[Fim will be capable of marking files while viewing and outputting their names on exit. (enabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_mark_and_dump=1 ; else fim_cv_want_mark_and_dump=0 ; fi ],[ fim_cv_want_mark_and_dump=1 ]) AC_DEFINE_UNQUOTED([FIM_WANT_FILENAME_MARK_AND_DUMP], $fim_cv_want_mark_and_dump, [Fim will be capable of marking files while viewing and outputting their names on exit.]) dnl ================== AH_TEMPLATE([FIM_WANT_NOSCRIPTING]) -AC_ARG_ENABLE(scripting, AC_HELP_STRING([--enable-scripting], [Scripting. (enabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_noscripting=0 ; else fim_cv_want_noscripting=1 ; fi ],[ fim_cv_want_noscripting=0 ]) +AC_ARG_ENABLE(scripting, AS_HELP_STRING([--enable-scripting],[Scripting. (enabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_noscripting=0 ; else fim_cv_want_noscripting=1 ; fi ],[ fim_cv_want_noscripting=0 ]) if test x$fim_cv_want_noscripting == x1 ; then AC_DEFINE_UNQUOTED([FIM_WANT_NOSCRIPTING], $fim_cv_want_noscripting, [Scripting. (enabled by default)]) fi dnl ================== AH_TEMPLATE([FIM_WANT_NO_OUTPUT_CONSOLE]) -AC_ARG_ENABLE(output-console, AC_HELP_STRING([--enable-output-console], [Output console. (enabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_no_output_console=0 ; else fim_cv_want_no_output_console=1 ; fi ],[ fim_cv_want_no_output_console=0 ]) +AC_ARG_ENABLE(output-console, AS_HELP_STRING([--enable-output-console],[Output console. (enabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_no_output_console=0 ; else fim_cv_want_no_output_console=1 ; fi ],[ fim_cv_want_no_output_console=0 ]) if test x$fim_cv_want_no_output_console == x1 ; then AC_DEFINE_UNQUOTED([FIM_WANT_NO_OUTPUT_CONSOLE], $fim_cv_want_no_output_console, [Output console. (enabled by default)]) fi dnl ================== AH_TEMPLATE([FIM_WANT_UNICODE]) -AC_ARG_ENABLE(unicode, AC_HELP_STRING([--enable-unicode], [Unicode. (disabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_unicode=1 ; else fim_cv_want_unicode=0 ; fi ],[ fim_cv_want_unicode=0 ]) +AC_ARG_ENABLE(unicode, AS_HELP_STRING([--enable-unicode],[Unicode. (disabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_unicode=1 ; else fim_cv_want_unicode=0 ; fi ],[ fim_cv_want_unicode=0 ]) if test x$fim_cv_want_unicode == x1 ; then # CXXFLAGS="$CXXFLAGS `freetype-config --cflags`" # LIBS="$LIBS `freetype-config --libs`" @@ -1747,7 +1744,7 @@ fi dnl ================== AH_TEMPLATE([FIM_WANT_TEXT_RENDERING]) fim_want_astext=yes -AC_ARG_ENABLE(as-text-rendering, AC_HELP_STRING([--disable-as-text-rendering], [Disable as-text rendering (viewing of any file as character bytes -- not to be confused with the ASCII art output).]), +AC_ARG_ENABLE(as-text-rendering, AS_HELP_STRING([--disable-as-text-rendering],[Disable as-text rendering (viewing of any file as character bytes -- not to be confused with the ASCII art output).]), [ if test x$enableval = xno ; then fim_want_astext=no fi @@ -1758,7 +1755,7 @@ fi dnl ================== AH_TEMPLATE([FIM_WANT_RAW_BITS_RENDERING]) fim_want_rbr=yes -AC_ARG_ENABLE(raw-bits-rendering, AC_HELP_STRING([--disable-raw-bits-rendering], [Disable raw bits rendering (viewing of any file as either a 1 or 24 bpp bitmap).]), +AC_ARG_ENABLE(raw-bits-rendering, AS_HELP_STRING([--disable-raw-bits-rendering],[Disable raw bits rendering (viewing of any file as either a 1 or 24 bpp bitmap).]), [ if test x$enableval = xno ; then fim_want_rbr=no fi @@ -1769,7 +1766,7 @@ fi dnl ================== AH_TEMPLATE([FIM_ALLOW_LOADER_STRING_SPECIFICATION]) fim_want_lss=yes -AC_ARG_ENABLE(loader-string-specification, AC_HELP_STRING([--disable-loader-string-specification], [Disables the chance to specify a file loader.]), +AC_ARG_ENABLE(loader-string-specification, AS_HELP_STRING([--disable-loader-string-specification],[Disables the chance to specify a file loader.]), [ if test x$enableval = xno ; then fim_want_lss=no fi @@ -1851,7 +1848,7 @@ AC_DEFINE([FBI_AUTHOR],["Gerd Hoffmann "]) dnl ############################################################################### dnl this is experimental stuff dnl ############################################################################### -AC_ARG_ENABLE(matrices-rendering, AC_HELP_STRING([--enable-matrices-rendering], [Uses librsb for rendering of Matrix Market files (must have librsb-config in the PATH).]), +AC_ARG_ENABLE(matrices-rendering, AS_HELP_STRING([--enable-matrices-rendering],[Uses librsb for rendering of Matrix Market files (must have librsb-config in the PATH).]), [ if test x$enableval = xyes; then if test x$ac_cv_func_rsb_lib_init = xyes; then AH_TEMPLATE([HAVE_MATRIX_MARKET_DECODER]) @@ -1881,12 +1878,13 @@ AC_SUBST(CXXFLAGS) #AC_CONFIG_FILES([Makefile],[src/Makefile]) -AC_OUTPUT(Makefile src/Makefile doc/Makefile distros/Makefile scripts/Makefile +AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile distros/Makefile scripts/Makefile scripts/maintenance/cron-build.sh scripts/maintenance/remote-build.sh scripts/maintenance/cron-svndump.pl scripts/maintenance/cron-rsync.sh - ) + ]) +AC_OUTPUT #AC_OUTPUT AC_MSG_NOTICE([ -- cgit v1.2.3 From 4d1b72d6331444c7aceedf2d8a4d5f02f6ef48fa Mon Sep 17 00:00:00 2001 From: Rafael Laboissiere Date: Sun, 14 Nov 2021 03:02:05 -0300 Subject: Adjust code for compilation against GCC 9 Forwarded: https://savannah.nongnu.org/bugs/index.php?58792 Last-Update: 2019-07-13 Gbp-Pq: Name compile-with-gcc-9.patch --- src/Var.h | 2 +- src/fim_types.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Var.h b/src/Var.h index 1339ac1..1c06c47 100644 --- a/src/Var.h +++ b/src/Var.h @@ -175,7 +175,7 @@ class Var if(sizeof(fim_int)==sizeof(int)) sprintf(buf,"%d",(int)i); else - sprintf(buf,"%lld",(int64_t)i); + sprintf(buf,"%ld",(int64_t)i); } else if(type=='f') diff --git a/src/fim_types.h b/src/fim_types.h index 3c66422..711366b 100644 --- a/src/fim_types.h +++ b/src/fim_types.h @@ -64,7 +64,7 @@ typedef int fim_var_t; /* a type for fim's variable types */ typedef int fim_str_t; /* a type for stdin/stdout streams */ typedef int fim_sys_int; /* always int */ - typedef int fim_color_t; /* >= 4 bytes */ + typedef unsigned int fim_color_t; /* >= 4 bytes */ typedef int fim_ts_t; /* a type for time, in seconds */ typedef int fim_tms_t; /* a type for time, in milliseconds */ -- cgit v1.2.3 From 6812c54f34fa5081fe94975af363aef726ad0a25 Mon Sep 17 00:00:00 2001 From: Chris Lamb Date: Sun, 14 Nov 2021 03:02:05 -0300 Subject: Make the build reproducible MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Forwarded: https://savannah.nongnu.org/bugs/index.php?58793 Reviewed-by: Rafael Laboissière Last-Update: 2019-04-29 Gbp-Pq: Name reproducible-build.patch --- src/Makefile.am | 1 - src/fim.cpp | 7 ------- 2 files changed, 8 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 7a4fdfb..f82e4f8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -51,7 +51,6 @@ version.h: ../config.h $(ECHO) "\"\n\"" >> $@ $(GREP) define $< | $(GREP) FIM.*'"' | LC_ALL=C $(SORT) | $(SED) 's/^#//g;s/define //g;s/^\([A-Za-z0-9_]*\) "\(.*\)"$$/"\1 = \\"\2\\"\\n"/g' >> $@ $(GREP) undef $< | $(GREP) FIM | LC_ALL=C $(SORT) | $(SED) 's/^#//g;s/.*undef //g;s/^\([A-Za-z0-9_]*\).\+$$/-\1 /g;s/^/\"/g;s/$$/\"/g' >> $@ - $(ECHO) '"\n'CXXFLAGS=$(CXXFLAGS)'\n"' >> $@ help.cpp: fim.h $(ECHO) -e "#ifdef FIM_WANT_INLINE_HELP\n" > $@ diff --git a/src/fim.cpp b/src/fim.cpp index c6ba3fd..a2257af 100644 --- a/src/fim.cpp +++ b/src/fim.cpp @@ -1603,13 +1603,6 @@ fim_perr_t main(int argc,char *argv[]) #ifdef FIM_CONFIGURATION "Configuration invocation: " FIM_CONFIGURATION "\n" #endif /* FIM_CONFIGURATION */ - #ifdef CXXFLAGS - "Compile flags: CXXFLAGS=" CXXFLAGS - #ifdef CFLAGS - " CFLAGS=" CFLAGS - #endif /* CFLAGS */ - "\n" - #endif /* CXXFLAGS */ "Fim options (features included (+) or not (-)):\n" #include "version.h" /* i think some flags are missing .. */ -- cgit v1.2.3 From 701f340e77b1398847143709d14ee1d02ad85a41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Laboissi=C3=A8re?= Date: Sun, 14 Nov 2021 03:02:05 -0300 Subject: Compile with GCC 10 Bug-Debian: https://bugs.debian.org/957202 Forwarded: https://savannah.nongnu.org/bugs/index.php?58399#comment1 Last-Update: 2020-07-20 This patch remove a non-active code (inside "#if 0") in file src/fim.cpp which, according to the upstream author, contains "leftovers from the old man file". This removal seems harmless and allows the package to be built with GCC 10. Gbp-Pq: Name compile-with-gcc-10.patch --- src/fim.cpp | 56 -------------------------------------------------------- 1 file changed, 56 deletions(-) diff --git a/src/fim.cpp b/src/fim.cpp index a2257af..e777d24 100644 --- a/src/fim.cpp +++ b/src/fim.cpp @@ -302,62 +302,6 @@ FIM_NULL {0,0,0,0,0,0} }; -#if 0 -// leftovers from the old man file; shall adapt these using .\" - .TP - .B -f font - Set font. This can be either a pcf console font file or a X11 font - spec. Using X11 fonts requires a font server (The one specified in - the environment variable FONTSERVER or on localhost). The FBFONT - environment variable is used as default. If unset, fim will - fallback to 10x20 (X11) / lat1u-16.psf (console). - .TP - .B --autoup - Like autozoom, but scale up only. - .TP - .B --autodown - Like autozoom, but scale down only. - .TP - .B -u - Randomize the order of the filenames. - .TP - .B -e - Enable editing commands. - .TP - .B -b - create backup files (when editing images). - .TP - .B -p - preserve timestamps (when editing images). - .TP - .B --comments - Display comment tags (if present) instead of the filename. Probaby - only useful if you added reasonable comments yourself (using wrjpgcom - for example), otherwise you likely just find texts pointing to the - software which created the image. - P pause the slideshow (if started with -t, toggle) - {number}g jump to image {number} - .SH EDIT IMAGE - fim also provides some very basic image editing facilities. You have - to start fim with the -e switch to use them. - .P - .nf - Shift+D delete image - R rotate 90° clockwise - L rotate 90° counter-clock wise - .fi - .P - The delete function actually wants a capital letter 'D', thus you have - to type Shift+D. This is done to avoid deleting images by mistake - because there are no safety bells: If you ask fim to delete the image, - it will be deleted without questions asked. - .P - The rotate function actually works for JPEG images only because it - calls the jpegtran command to perform a lossless rotation if the image. - It is especially useful if you review the images of your digital - camera. -#endif - const int fim_options_count=sizeof(fim_options)/sizeof(fim_options_t); struct option options[fim_options_count]; -- cgit v1.2.3 From d39c4b6b5139c4c8e721961b02fa77c33e3baf21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Laboissi=C3=A8re?= Date: Sun, 14 Nov 2021 03:02:05 -0300 Subject: Update configure.ac Forwarded: https://savannah.nongnu.org/bugs/?60900 Last-Update: 2021-07-09 This patch is the result of running autoupdate Gbp-Pq: Name update-configure-ac.patch --- configure.ac | 236 +++++++++++++++++++++++++++++------------------------------ 1 file changed, 117 insertions(+), 119 deletions(-) diff --git a/configure.ac b/configure.ac index b600f50..64ecc07 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,10 @@ dnl Process this file with autoconf to produce a configure script. dnl $LastChangedDate: 2017-07-19 15:46:18 +0200 (Wed, 19 Jul 2017) $ -AC_PREREQ([2.54]) +AC_PREREQ([2.71]) # we'll move forward, one day or another -#AC_PREREQ([2.61]) +#AC_PREREQ([2.71]) # for future use, too #AC_PROG_CC(cc gcc) @@ -46,7 +46,7 @@ AC_MSG_NOTICE([ # #AM_INIT_AUTOMAKE($PACKAGE_NAME, $PACKAGE_VERSION) -AC_GNU_SOURCE +AC_USE_SYSTEM_EXTENSIONS #AC_MANTAINER_MODE #AC_CANONICAL_HOST @@ -97,7 +97,7 @@ else fi AC_MSG_RESULT($fim_cv_prefix) -AC_ISC_POSIX +AC_SEARCH_LIBS([strerror],[cposix]) #AM_C_PROTOTYPES if test "x$U" != "x"; then AC_MSG_ERROR(Compiler not ANSI compliant) @@ -122,7 +122,7 @@ AC_CHECK_FUNC([rsb_lib_init]) AC_CHECK_LIB([m],[pow]) AC_CHECK_LIB([fl],[yylex]) -AC_ARG_ENABLE(graphicsmagick, AC_HELP_STRING([--enable-graphicsmagick], [Enable GraphicsMagick library support (EXPERIMENTAL).]), [ if test x$enableval != xno ; then fim_handle_graphicsmagick=yes ; fi ] ) +AC_ARG_ENABLE(graphicsmagick, AS_HELP_STRING([--enable-graphicsmagick],[Enable GraphicsMagick library support (EXPERIMENTAL).]), [ if test x$enableval != xno ; then fim_handle_graphicsmagick=yes ; fi ] ) AC_CHECK_LIB([GraphicsMagick],[GetMagickVersion], [ if test x"$fim_handle_graphicsmagick" = x"yes" ; then @@ -133,7 +133,7 @@ if test x"$fim_handle_graphicsmagick" = x"yes" ; then fi ], []) -AC_ARG_ENABLE(imlib2, AC_HELP_STRING([--enable-imlib2], [Enable Imlib2 library support (EXPERIMENTAL,INCOMPLETE).]), [ if test x$enableval != xno ; then fim_handle_imlib2=yes ; fi ] ) +AC_ARG_ENABLE(imlib2, AS_HELP_STRING([--enable-imlib2],[Enable Imlib2 library support (EXPERIMENTAL,INCOMPLETE).]), [ if test x$enableval != xno ; then fim_handle_imlib2=yes ; fi ] ) AC_CHECK_LIB([Imlib2],[imlib_create_image], [ if test x"$fim_handle_imlib2" = x"yes" ; then @@ -187,7 +187,7 @@ have_default_bindings=yes have_default_mapping=yes have_default_config=yes -AC_ARG_ENABLE(default_bindings, AC_HELP_STRING([--disable-default-bindings], [Builtin default minimal key binding]), +AC_ARG_ENABLE(default_bindings, AS_HELP_STRING([--disable-default-bindings],[Builtin default minimal key binding]), [ if test x$enableval = xyes; then have_default_bindings=yes else @@ -195,7 +195,7 @@ AC_ARG_ENABLE(default_bindings, AC_HELP_STRING([--disable-default-bindings], [Bu fi ]) -AC_ARG_ENABLE(default_mapping, AC_HELP_STRING([--disable-default-mapping], [Builtin default minimal key mapping]), +AC_ARG_ENABLE(default_mapping, AS_HELP_STRING([--disable-default-mapping],[Builtin default minimal key mapping]), [ if test x$enableval = xyes; then have_default_mapping=yes else @@ -203,7 +203,7 @@ AC_ARG_ENABLE(default_mapping, AC_HELP_STRING([--disable-default-mapping], [Buil fi ]) -AC_ARG_ENABLE(default_config, AC_HELP_STRING([--disable-default-config], [Builtin default minimal configuration]), +AC_ARG_ENABLE(default_config, AS_HELP_STRING([--disable-default-config],[Builtin default minimal configuration]), [ if test x$enableval = xyes; then have_default_config=yes else @@ -234,14 +234,14 @@ AC_ARG_ENABLE(default_config, AC_HELP_STRING([--disable-default-config], [Builti #AC_SUBST(LIBPNG_CXXFLAGS) #AC_SUBST(LIBPNG_LIBS) -AC_ARG_ENABLE(system, AC_HELP_STRING([--disable-system], [Disable system() and pipe() calls.]), +AC_ARG_ENABLE(system, AS_HELP_STRING([--disable-system],[Disable system() and pipe() calls.]), [ if test x$enableval = xno ; then fim_system_calls=no fi ]) dnl new: -AC_ARG_ENABLE(framebuffer, AC_HELP_STRING([--disable-framebuffer], [Disable the framebuffer device driver.]), +AC_ARG_ENABLE(framebuffer, AS_HELP_STRING([--disable-framebuffer],[Disable the framebuffer device driver.]), [ if test x$enableval = xno ; then fim_handle_framebuffer=no fi @@ -263,7 +263,15 @@ if test x$fim_handle_framebuffer = xno ; then AC_DEFINE(FIM_WITH_NO_FRAMEBUFFER, 1, [Defined when framebuffer device support is turned off.]) fi -AC_HEADER_STDC +m4_warn([obsolete], +[The preprocessor macro `STDC_HEADERS' is obsolete. + Except in unusual embedded environments, you can safely include all + ISO C90 headers unconditionally.])dnl +# Autoupdate added the next two lines to ensure that your configure +# script's behavior did not change. They are probably safe to remove. +AC_CHECK_INCLUDES_DEFAULT +AC_PROG_EGREP + AC_FUNC_MMAP AC_CHECK_FUNCS([bzero memset memcmp strncmp strcpy]) @@ -320,11 +328,23 @@ dnl fi dnl AC_CHECK_FUNCS(setrlimit getsid) -AC_TYPE_SIGNAL +m4_warn([obsolete], +[your code may safely assume C89 semantics that RETSIGTYPE is void. +Remove this warning and the `AC_CACHE_CHECK' when you adjust the code.])dnl +AC_CACHE_CHECK([return type of signal handlers],[ac_cv_type_signal],[AC_COMPILE_IFELSE( +[AC_LANG_PROGRAM([#include +#include +], + [return *(signal (0, 0)) (0) == 1;])], + [ac_cv_type_signal=int], + [ac_cv_type_signal=void])]) +AC_DEFINE_UNQUOTED([RETSIGTYPE],[$ac_cv_type_signal],[Define as the return type of signal handlers + (`int' or `void').]) + dnl ================== AH_TEMPLATE([FIM_WANT_STATIC_BINARY]) -AC_ARG_ENABLE(static, AC_HELP_STRING([--enable-static], [Want a static binary. (disabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_static=1 ; else fim_cv_want_static=0 ; fi ],[ fim_cv_want_static=0 ]) +AC_ARG_ENABLE(static, AS_HELP_STRING([--enable-static],[Want a static binary. (disabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_static=1 ; else fim_cv_want_static=0 ; fi ],[ fim_cv_want_static=0 ]) if test x$fim_cv_want_static == x1 ; then LIBS="$LIBS --static" LIBDJVU_STATIC_EXTRA="-lpthread" @@ -339,20 +359,19 @@ fi dnl ================== -AC_ARG_WITH(regex, AC_HELP_STRING([--with-regex], [Use the GNU regex library instead of the POSIX one]), +AC_ARG_WITH(regex, AS_HELP_STRING([--with-regex],[Use the GNU regex library instead of the POSIX one]), [fim_cv_regex=yes], [AC_CHECK_FUNCS(regcomp, fim_cv_regex=no, fim_cv_regex=yes)]) if test X$fim_cv_regex = Xno ; then AC_CACHE_CHECK([whether your system regexp library is completely broken], [fim_cv_regex_broken], - AC_TRY_RUN([ + AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include #include -int main() { regex_t blah ; regmatch_t p; p.rm_eo = p.rm_eo; return regcomp(&blah, "foo.*bar", REG_NOSUB) || regexec (&blah, "foobar", 0, NULL, 0); }], - fim_cv_regex_broken=no, fim_cv_regex_broken=yes, fim_cv_regex_broken=yes)) +int main() { regex_t blah ; regmatch_t p; p.rm_eo = p.rm_eo; return regcomp(&blah, "foo.*bar", REG_NOSUB) || regexec (&blah, "foobar", 0, NULL, 0); }]])],[fim_cv_regex_broken=no],[fim_cv_regex_broken=yes],[fim_cv_regex_broken=yes])) if test X$fim_cv_regex_broken = Xyes ; then - echo "Using the included GNU regex instead." >&AC_FD_MSG + echo "Using the included GNU regex instead." >&AS_MESSAGE_FD fim_cv_regex=yes fi fi @@ -365,7 +384,7 @@ fi AC_MSG_CHECKING(where to put the documentation...) -dnl AC_ARG_WITH(docdir, AC_HELP_STRING([--with-docdir=PATH], [Specify where to put the documentation]), +dnl AC_ARG_WITH(docdir, AS_HELP_STRING([--with-docdir=PATH],[Specify where to put the documentation]), dnl [fim_cv_docdir=$withval], dnl [fim_cv_docdir='${prefix}/doc/fim-${fim_cv_version}']) # FIXME : the above line seems troublesome, BUT IT IS NOT (see the muttrc for this trick). @@ -378,7 +397,7 @@ AC_SUBST(fim_cv_version) dnl ============= gif file handling -AC_ARG_ENABLE(gif, AC_HELP_STRING([--disable-gif], [Disable gif support.]), +AC_ARG_ENABLE(gif, AS_HELP_STRING([--disable-gif],[Disable gif support.]), [ if test x$enableval = xno ; then fim_handle_gif=no fi @@ -393,14 +412,11 @@ if test x$fim_handle_gif != xno ; then AC_MSG_WARN([*** GIF loader will not be built (GIF library not found) ***])) if test x"$have_gif" = xyes; then AC_MSG_CHECKING([for gif.h]) - AC_TRY_CPP( -[#include + AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include #undef PACKAGE #undef VERSION #undef HAVE_STDLIB_H -#include ], - have_gif=yes, - have_gif=no) +#include ]])],[have_gif=yes],[have_gif=no]) AC_MSG_RESULT($have_gif) if test x"$have_gif" = xyes; then LIBGIF='-lgif' @@ -432,7 +448,7 @@ AM_CONDITIONAL(ENABLE_GIF, test x$have_gif = xyes) dnl ============= tiff file handling -AC_ARG_ENABLE(tiff, AC_HELP_STRING([--disable-tiff], [Disable tiff support.]), +AC_ARG_ENABLE(tiff, AS_HELP_STRING([--disable-tiff],[Disable tiff support.]), [ if test x$enableval = xno ; then fim_handle_tiff=no fi @@ -447,14 +463,11 @@ if test x$fim_handle_tiff != xno ; then AC_MSG_WARN([*** TIFF loader will not be built (TIFF library not found) ***]) , [$LIBTIFF_STATIC_EXTRA]) if test x"$have_tiff" = xyes; then AC_MSG_CHECKING([for tiff.h]) - AC_TRY_CPP( -[#include + AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include #undef PACKAGE #undef VERSION #undef HAVE_STDLIB_H -#include ], - have_tiff=yes, - have_tiff=no) +#include ]])],[have_tiff=yes],[have_tiff=no]) AC_MSG_RESULT($have_tiff) if test x"$have_tiff" = xyes; then LIBTIFF="-ltiff $LIBTIFF_STATIC_EXTRA" @@ -501,7 +514,7 @@ dnl ============= GNU gpm, unofficial yet dnl ============= no readline case handling fim_want_cxx11=no -AC_ARG_ENABLE(cxx11, AC_HELP_STRING([--enable-cxx11], [Enable C++11 standard constructs (requires appropriate CXXFLAGS, e.g. -std=c++11) (EXPERIMENTAL).]), +AC_ARG_ENABLE(cxx11, AS_HELP_STRING([--enable-cxx11],[Enable C++11 standard constructs (requires appropriate CXXFLAGS, e.g. -std=c++11) (EXPERIMENTAL).]), [ if test x$enableval = xno ; then fim_want_cxx11=no else @@ -512,7 +525,7 @@ AC_ARG_ENABLE(cxx11, AC_HELP_STRING([--enable-cxx11], [Enable C++11 standard con dnl ============= no readline case handling fim_want_readline=yes -AC_ARG_ENABLE(readline, AC_HELP_STRING([--disable-readline], [Disable readline support (EXPERIMENTAL).]), +AC_ARG_ENABLE(readline, AS_HELP_STRING([--disable-readline],[Disable readline support (EXPERIMENTAL).]), [ if test x$enableval = xno ; then fim_want_readline=no else @@ -561,7 +574,7 @@ fi dnl ============= jpeg file handling #AC_ARG_WITH(jpeg, [ --disable-jpeg ], [ disable jpeg file support]) -AC_ARG_ENABLE(jpeg, AC_HELP_STRING([--disable-jpeg], [Disable jpeg support.]), +AC_ARG_ENABLE(jpeg, AS_HELP_STRING([--disable-jpeg],[Disable jpeg support.]), [ if test x$enableval = xno ; then fim_handle_jpeg=no fi @@ -576,14 +589,11 @@ if test x$fim_handle_jpeg != xno ; then AC_MSG_WARN([*** JPEG loader will not be built (JPEG library not found) ***])) if test x"$have_jpeg" = xyes; then AC_MSG_CHECKING([for jpeglib.h]) - AC_TRY_CPP( -[#include + AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include #undef PACKAGE #undef VERSION #undef HAVE_STDLIB_H -#include ], - have_jpeg=yes, - have_jpeg=no) +#include ]])],[have_jpeg=yes],[have_jpeg=no]) AC_MSG_RESULT($have_jpeg) if test x"$have_jpeg" = xyes; then LIBJPEG='-ljpeg' @@ -616,7 +626,7 @@ AM_CONDITIONAL(ENABLE_JPEG, test x$have_jpeg = xyes) dnl ============= dvi file handling (via TeX-Guy) dnl -dnl AC_ARG_ENABLE(dvi, AC_HELP_STRING([--disable-dvi], [Disable dvi support.]), +dnl AC_ARG_ENABLE(dvi, AS_HELP_STRING([--disable-dvi],[Disable dvi support.]), dnl [ if test x$enableval = xno ; then dnl fim_handle_dvi=no dnl fi @@ -631,14 +641,11 @@ dnl have_dvi=no dnl AC_MSG_WARN([*** DVI loader will not be built (libdvi29 library not found) ***])) dnl if test x"$have_dvi" = xyes; then dnl AC_MSG_CHECKING([for libdvi29.h]) -dnl AC_TRY_CPP( -dnl [#include +dnl AC_PREPROC_IFELSE([AC_LANG_SOURCE([[dnl #include dnl #undef PACKAGE dnl #undef VERSION dnl #undef HAVE_STDLIB_H -dnl #include ], -dnl have_dvi=yes, -dnl have_dvi=no) +dnl #include ]])],[dnl have_dvi=yes],[dnl have_dvi=no]) dnl AC_MSG_RESULT($have_dvi) dnl if test x"$have_dvi" = xyes; then dnl LIBDVI='-ldvilib2' @@ -670,7 +677,7 @@ dnl AM_CONDITIONAL(ENABLE_DVI, test x$have_dvi = xyes) dnl ============= ps file handling -AC_ARG_ENABLE(ps, AC_HELP_STRING([--disable-ps], [Disable ps support.]), +AC_ARG_ENABLE(ps, AS_HELP_STRING([--disable-ps],[Disable ps support.]), [ if test x$enableval = xno ; then fim_handle_ps=no fi @@ -685,14 +692,11 @@ if test x$fim_handle_ps != xno ; then AC_MSG_WARN([*** PS loader will not be built (spectre library not found) ***]) , [$LIBSPECTRE_STATIC_EXTRA]) if test x"$have_ps" = xyes; then AC_MSG_CHECKING([for libspectre/spectre.h]) - AC_TRY_CPP( -[#include + AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include #undef PACKAGE #undef VERSION #undef HAVE_STDLIB_H -#include ], - have_ps=yes, - have_ps=no) +#include ]])],[have_ps=yes],[have_ps=no]) AC_MSG_RESULT($have_ps) if test x"$have_ps" = xyes; then LIBPS="-lspectre $LIBSPECTRE_STATIC_EXTRA" @@ -726,7 +730,7 @@ AM_CONDITIONAL(ENABLE_PS, test x$have_ps = xyes) dnl ============= djvu file handling -AC_ARG_ENABLE(djvu, AC_HELP_STRING([--disable-djvu], [Disable djvu support.]), +AC_ARG_ENABLE(djvu, AS_HELP_STRING([--disable-djvu],[Disable djvu support.]), [ if test x$enableval = xno ; then fim_handle_djvu=no fi @@ -741,14 +745,11 @@ if test x$fim_handle_djvu != xno ; then AC_MSG_WARN([*** DJVU loader will not be built (DJVU library not found) ***]), [$LIBDJVU_STATIC_EXTRA]) if test x"$have_djvu" = xyes; then AC_MSG_CHECKING([for libdjvu/ddjvuapi.h]) - AC_TRY_CPP( -[#include + AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include #undef PACKAGE #undef VERSION #undef HAVE_STDLIB_H -#include ], - have_djvu=yes, - have_djvu=no) +#include ]])],[have_djvu=yes],[have_djvu=no]) AC_MSG_RESULT($have_djvu) if test x"$have_djvu" = xyes; then LIBDJVU="-ldjvulibre $LIBDJVU_STATIC_EXTRA" @@ -784,7 +785,7 @@ dnl dnl By default, we disable poppler : its API is still immature. dnl fim_handle_pdf=no -AC_ARG_ENABLE(poppler, AC_HELP_STRING([--enable-poppler], [Enable poppler (PDF rendering) support. This will add LIBPOPPLER_CXXFLAGS="-I/usr/include/poppler/" to the compilation flags. You can override this by passing configure a suitable LIBPOPPLER_CXXFLAGS variable.]), +AC_ARG_ENABLE(poppler, AS_HELP_STRING([--enable-poppler],[Enable poppler (PDF rendering) support. This will add LIBPOPPLER_CXXFLAGS="-I/usr/include/poppler/" to the compilation flags. You can override this by passing configure a suitable LIBPOPPLER_CXXFLAGS variable.]), [ if test x$enableval = xyes ; then fim_handle_pdf=yes fi @@ -801,8 +802,7 @@ dnl FIXME : the following is a dirty hack AC_MSG_WARN([*** POPPLER loader will not be built (POPPLER library not found) ***]) ) if test x"$have_poppler" = xyes; then AC_MSG_CHECKING([for poppler/poppler-config.h]) - AC_TRY_CPP( - [#include + AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include #undef PACKAGE #undef VERSION #undef HAVE_STDLIB_H @@ -815,9 +815,7 @@ dnl FIXME : the following is a dirty hack #include #include #include /* globalParams lives here */ - ], - have_poppler=yes, - have_poppler=no) + ]])],[have_poppler=yes],[have_poppler=no]) have_poppler=yes AC_MSG_RESULT($have_poppler) if test x"$have_poppler" = xyes; then @@ -858,7 +856,7 @@ AM_CONDITIONAL(ENABLE_POPPLER, test x$have_poppler = xyes) dnl FIXME : we have two libpoppler checks ... : dnl ================== pdf checks =================================================== AC_ARG_ENABLE(pdf, - [AC_HELP_STRING([--enable-pdf], [Compile with pdf support])],enable_pdf="$enableval",enable_pdf=yes) + [AS_HELP_STRING([--enable-pdf],[Compile with pdf support])],enable_pdf="$enableval",enable_pdf=yes) if test "x$enable_pdf" = "xyes"; then POPPLER_REQUIRED=0.8.7 @@ -884,7 +882,7 @@ dnl ================== end of pdf checks ======================================= dnl ================================================================================ fim_handle_bmp=yes -AC_ARG_ENABLE(bmp, AC_HELP_STRING([--disable-bmp], [Disable BMP file support (enabled by default).]), +AC_ARG_ENABLE(bmp, AS_HELP_STRING([--disable-bmp],[Disable BMP file support (enabled by default).]), [ if test x$enableval = xno ; then fim_handle_bmp=no fi @@ -899,7 +897,7 @@ else fi dnl ================================================================================ fim_handle_pcx=yes -AC_ARG_ENABLE(pcx, AC_HELP_STRING([--disable-pcx], [Disable PCX file support (enabled by default).]), +AC_ARG_ENABLE(pcx, AS_HELP_STRING([--disable-pcx],[Disable PCX file support (enabled by default).]), [ if test x$enableval = xno ; then fim_handle_pcx=no fi @@ -916,12 +914,12 @@ dnl ============================================================================ ## png file handling -AC_ARG_WITH(png-prefix, AC_HELP_STRING([--with-png-prefix=PFX], [prefix where libpng is installed (optional)]), +AC_ARG_WITH(png-prefix, AS_HELP_STRING([--with-png-prefix=PFX],[prefix where libpng is installed (optional)]), libpng_config_prefix="$withval", libpng_config_prefix="") fim_handle_png=yes -AC_ARG_ENABLE(png, AC_HELP_STRING([--disable-png], [Disable png support.]), +AC_ARG_ENABLE(png, AS_HELP_STRING([--disable-png],[Disable png support.]), [ if test x$enableval = xno ; then fim_handle_png=no fi @@ -957,7 +955,7 @@ dnl ============================================================================ fim_handle_xyz=no -AC_ARG_ENABLE(xyz, AC_HELP_STRING([--enable-xyz], [Enable the sample bogus 'xyz' file loading support. This makes only sense in order to learn how to include a new file format and wish to play with src/FbiStuffXyz.cpp in the while.]), +AC_ARG_ENABLE(xyz, AS_HELP_STRING([--enable-xyz],[Enable the sample bogus 'xyz' file loading support. This makes only sense in order to learn how to include a new file format and wish to play with src/FbiStuffXyz.cpp in the while.]), [ if test x$enableval = xyes ; then fim_handle_xyz=yes fi @@ -976,7 +974,7 @@ dnl ============================================================================ fim_handle_ufraw=no -AC_ARG_ENABLE(ufraw, AC_HELP_STRING([--enable-ufraw], [Enable UFRaw support (EXPERIMENTAL).]), +AC_ARG_ENABLE(ufraw, AS_HELP_STRING([--enable-ufraw],[Enable UFRaw support (EXPERIMENTAL).]), [ if test x$enableval = xno ; then fim_handle_ufraw=no else @@ -999,7 +997,7 @@ dnl ============================================================================ fim_handle_archive=no -AC_ARG_ENABLE(archive, AC_HELP_STRING([--enable-archive], [Enable libarchive support (please provide ARCHIVE_LIBS, ARCHIVE_CXXFLAGS) (EXPERIMENTAL, UNFINISHED).]), +AC_ARG_ENABLE(archive, AS_HELP_STRING([--enable-archive],[Enable libarchive support (please provide ARCHIVE_LIBS, ARCHIVE_CXXFLAGS) (EXPERIMENTAL, UNFINISHED).]), [ if test x$enableval = xno ; then fim_handle_archive=no else @@ -1018,7 +1016,7 @@ fi dnl ================================================================================ AC_CHECK_LIB(exif, exif_data_new_from_data,have_libexif=yes,have_libexif=no) -AC_ARG_ENABLE(exif, AC_HELP_STRING([--disable-exif], [JPEG EXIF tags support with libexif.]), [if test x$enableval != xno; then fim_cv_libexif=yes; fi],[fim_cv_libexif=yes;]) +AC_ARG_ENABLE(exif, AS_HELP_STRING([--disable-exif],[JPEG EXIF tags support with libexif.]), [if test x$enableval != xno; then fim_cv_libexif=yes; fi],[fim_cv_libexif=yes;]) if test x$fim_cv_libexif = xyes; then if test x$have_libexif = xyes; then @@ -1036,7 +1034,7 @@ fi dnl ================================================================================ -AC_ARG_ENABLE(jasper, AC_HELP_STRING([--enable-jasper], [Turns on JPEG-2000 files support using JasPer (EXPERIMENTAL)]), +AC_ARG_ENABLE(jasper, AS_HELP_STRING([--enable-jasper],[Turns on JPEG-2000 files support using JasPer (EXPERIMENTAL)]), [if test x$enableval = xyes; then fim_cv_libjasper=yes; CXXFLAGS="$CXXFLAGS"; @@ -1056,7 +1054,7 @@ AC_ARG_ENABLE(jasper, AC_HELP_STRING([--enable-jasper], [Turns on JPEG-2000 file dnl ================================================================================ AC_CHECK_LIB(aa, aa_getfirst,fim_cv_libaa=yes,fim_cv_libaa=no) -AC_ARG_ENABLE(aa, AC_HELP_STRING([--disable-aa], [Ascii Art (-o aa) support (via aalib)]), [if test x$enableval != xno; then fim_cv_libaa=yes; else fim_cv_libaa=no; fi],[fim_cv_libaa=yes;]) +AC_ARG_ENABLE(aa, AS_HELP_STRING([--disable-aa],[Ascii Art (-o aa) support (via aalib)]), [if test x$enableval != xno; then fim_cv_libaa=yes; else fim_cv_libaa=no; fi],[fim_cv_libaa=yes;]) if test x$fim_cv_libaa != xno; then if test x$ac_cv_lib_aa_aa_getfirst = xyes; then AC_MSG_NOTICE([Enabling aalib driver.]) @@ -1091,18 +1089,18 @@ dnl ============================================================================ ## sdl driver -AC_ARG_WITH(sdl-prefix, AC_HELP_STRING([--with-sdl-prefix=PFX], [prefix where libsdl is installed (optional)]), +AC_ARG_WITH(sdl-prefix, AS_HELP_STRING([--with-sdl-prefix=PFX],[prefix where libsdl is installed (optional)]), libsdl_config_prefix="$withval", libsdl_config_prefix="") fim_handle_sdl='auto' -dnl AC_ARG_ENABLE(sdl, AC_HELP_STRING([--disable-sdl], [Disable libsdl support.]), +dnl AC_ARG_ENABLE(sdl, AS_HELP_STRING([--disable-sdl],[Disable libsdl support.]), dnl [ if test x$enableval = xno ; then dnl fim_handle_sdl=no dnl fi dnl ]) -AC_ARG_ENABLE(sdl, AC_HELP_STRING([--disable-sdl], [Disable libsdl support.]), +AC_ARG_ENABLE(sdl, AS_HELP_STRING([--disable-sdl],[Disable libsdl support.]), [ if test x$enableval = xyes ; then fim_handle_sdl=yes ; fi ] [ if test x$enableval = xno ; then fim_handle_sdl=no ; fi ]) @@ -1141,7 +1139,7 @@ dnl ============================================================================ AH_TEMPLATE([FIM_WANT_EXIFTOOL]) fim_cv_exiftool=no -AC_ARG_ENABLE(exiftool, AC_HELP_STRING([--enable-exiftool], [Turns on exiftool support (EXPERIMENTAL, shall provide the EXIFTOOLLINK variable with library or object files and EXIFTOOLCXXFLAGS)]), +AC_ARG_ENABLE(exiftool, AS_HELP_STRING([--enable-exiftool],[Turns on exiftool support (EXPERIMENTAL, shall provide the EXIFTOOLLINK variable with library or object files and EXIFTOOLCXXFLAGS)]), [if test x$enableval = xyes; then fim_cv_exiftool=yes CXXFLAGS="$CXXFLAGS $EXIFTOOLCXXFLAGS" @@ -1162,7 +1160,7 @@ dnl ================== fim_cv_autocommands=yes -AC_ARG_ENABLE(autocommands, AC_HELP_STRING([--disable-autocommands], [Fim will by default use autocommands.]), +AC_ARG_ENABLE(autocommands, AS_HELP_STRING([--disable-autocommands],[Fim will by default use autocommands.]), [if test x$enableval = xno; then fim_cv_autocommands=no fi]) @@ -1178,7 +1176,7 @@ fi dnl ================== -AC_ARG_ENABLE(hardcoded-font, AC_HELP_STRING([--enable-hardcoded-font], [Enable a hardcoded font in the executable (good as a fallback (FBFONT=fim://) when no PSF format consolefonts files are available).]), +AC_ARG_ENABLE(hardcoded-font, AS_HELP_STRING([--enable-hardcoded-font],[Enable a hardcoded font in the executable (good as a fallback (FBFONT=fim://) when no PSF format consolefonts files are available).]), [if test x$enableval = xyes; then fim_cv_hardcoded_font=yes; else @@ -1197,7 +1195,7 @@ AM_CONDITIONAL(FIM_WANT_HARDCODED_CONSOLEFONT, test x$have_hardcoded_font = xyes dnl ================== -AC_ARG_ENABLE(long-int-vars, AC_HELP_STRING([--enable-long-int-vars], [Internals shall use 64 bit integers (EXPERIMENTAL].), +AC_ARG_ENABLE(long-int-vars, AS_HELP_STRING([--enable-long-int-vars],[Internals shall use 64 bit integers (EXPERIMENTAL.]), [if test x$enableval = xyes; then fim_cv_want_int64_int=yes; else @@ -1214,7 +1212,7 @@ dnl ================== fim_cv_windows=yes -AC_ARG_ENABLE(windows, AC_HELP_STRING([--disable-windows], [Disable windowing system in Fim. (deprecated)]), +AC_ARG_ENABLE(windows, AS_HELP_STRING([--disable-windows],[Disable windowing system in Fim. (deprecated)]), [if test x$enableval = xno; then fim_cv_windows=no fi]) @@ -1231,7 +1229,7 @@ fi dnl ================== fim_cv_fimrc=yes -AC_ARG_ENABLE(fimrc, AC_HELP_STRING([--disable-fimrc], [Fim will by default load the ~/.fimrc file.]), +AC_ARG_ENABLE(fimrc, AS_HELP_STRING([--disable-fimrc],[Fim will by default load the ~/.fimrc file.]), [if test x$enableval = xno; then fim_cv_fimrc=no fi]) @@ -1247,7 +1245,7 @@ dnl ================== AH_TEMPLATE([FIM_NOHISTORY]) fim_cv_history=yes -AC_ARG_ENABLE(history, AC_HELP_STRING([--disable-history], [Fim will by default load/save a ~/.fim_history file.]), +AC_ARG_ENABLE(history, AS_HELP_STRING([--disable-history],[Fim will by default load/save a ~/.fim_history file.]), [if test x$enableval = xno; then fim_cv_history=no fi]) @@ -1262,7 +1260,7 @@ fi dnl ================== fim_cv_warnings=no -AC_ARG_ENABLE(screen, AC_HELP_STRING([--disable-screen], [Fim will try to work under screen by default (please read BUGS)]), +AC_ARG_ENABLE(screen, AS_HELP_STRING([--disable-screen],[Fim will try to work under screen by default (please read BUGS)]), [ if test x$enableval = xno; then fim_cv_screen=no else @@ -1274,7 +1272,7 @@ AC_ARG_ENABLE(screen, AC_HELP_STRING([--disable-screen], [Fim will try to work u dnl ================== fim_cv_resize_optimizations=yes -AC_ARG_ENABLE(resize-optimizations, AC_HELP_STRING([--disable-resize-optimizations], [Some old (fbi) code is optimized for speedup in fim.]), +AC_ARG_ENABLE(resize-optimizations, AS_HELP_STRING([--disable-resize-optimizations],[Some old (fbi) code is optimized for speedup in fim.]), [ if test x$enableval = xno; then fim_cv_resize_optimizations=no else @@ -1286,7 +1284,7 @@ AC_ARG_ENABLE(resize-optimizations, AC_HELP_STRING([--disable-resize-optimizatio dnl ================== fim_cv_read_stdin_image=yes -AC_ARG_ENABLE(stdin-image-reading, AC_HELP_STRING([--disable-stdin-image-reading], [Fim will read an image from stdin with the -i switch. (experimental)]), +AC_ARG_ENABLE(stdin-image-reading, AS_HELP_STRING([--disable-stdin-image-reading],[Fim will read an image from stdin with the -i switch. (experimental)]), [ if test x$enableval = xno; then fim_cv_read_stdin_image=no else @@ -1297,7 +1295,7 @@ AC_ARG_ENABLE(stdin-image-reading, AC_HELP_STRING([--disable-stdin-image-reading dnl ================== fim_cv_scan_consolefonts=yes -AC_ARG_ENABLE(scan-consolefonts, AC_HELP_STRING([--enable-scan-consolefonts], [Fim will scan some predefined directory in look for console fonts as a fallback. (experimental)]), +AC_ARG_ENABLE(scan-consolefonts, AS_HELP_STRING([--enable-scan-consolefonts],[Fim will scan some predefined directory in look for console fonts as a fallback. (experimental)]), [ if test x$enableval = xyes; then fim_cv_scan_consolefonts=yes else @@ -1307,7 +1305,7 @@ AC_ARG_ENABLE(scan-consolefonts, AC_HELP_STRING([--enable-scan-consolefonts], [F ) dnl ================== fim_cv_seek_magic=yes -AC_ARG_ENABLE(seek-magic, AC_HELP_STRING([--enable-seek-magic], [Fim will be capable to seek on a specified magic string. (experimental)]), +AC_ARG_ENABLE(seek-magic, AS_HELP_STRING([--enable-seek-magic],[Fim will be capable to seek on a specified magic string. (experimental)]), [ if test x$enableval = xyes; then fim_cv_seek_magic=yes else @@ -1316,7 +1314,7 @@ AC_ARG_ENABLE(seek-magic, AC_HELP_STRING([--enable-seek-magic], [Fim will be cap ],[ fim_cv_seek_magic=no ] ) dnl ================== -AC_ARG_ENABLE(pushdir, AC_HELP_STRING([--enable-pushdir], [Fim will scan directories for files.]), +AC_ARG_ENABLE(pushdir, AS_HELP_STRING([--enable-pushdir],[Fim will scan directories for files.]), [ if test x$enableval = xno; then fim_cv_read_dirs=no else @@ -1325,7 +1323,7 @@ AC_ARG_ENABLE(pushdir, AC_HELP_STRING([--enable-pushdir], [Fim will scan directo ],[ fim_cv_read_dirs=yes ] ) dnl ================== -AC_ARG_ENABLE(recursive-pushdir, AC_HELP_STRING([--disable-recursive-pushdir], [Fim will be able to push directories recursively (implies --enable-push-dirs )]), +AC_ARG_ENABLE(recursive-pushdir, AS_HELP_STRING([--disable-recursive-pushdir],[Fim will be able to push directories recursively (implies --enable-push-dirs )]), [ if test x$enableval = xyes; then fim_cv_recursive_dirs=yes; fim_cv_read_dirs=yes; @@ -1387,7 +1385,7 @@ fi dnl ================== fim_cv_warnings=no -AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [Turns on debug options (recommended for debugging)]), +AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug],[Turns on debug options (recommended for debugging)]), [if test x$enableval = xyes; then fim_cv_debug=yes fi]) @@ -1395,7 +1393,7 @@ fi]) dnl ================== fim_cv_warnings=no -AC_ARG_ENABLE(warnings, AC_HELP_STRING([--enable-warnings], [Turns on compiler warnings (recommended, for debugging)]), +AC_ARG_ENABLE(warnings, AS_HELP_STRING([--enable-warnings],[Turns on compiler warnings (recommended, for debugging)]), [if test x$enableval = xyes; then fim_cv_warnings=yes fi]) @@ -1419,7 +1417,7 @@ dnl ================== fim_cv_cacalib=no -AC_ARG_ENABLE(cacalib, AC_HELP_STRING([--enable-cacalib], [Turns on cacalib support (STILL INCOMPLETE)]), +AC_ARG_ENABLE(cacalib, AS_HELP_STRING([--enable-cacalib],[Turns on cacalib support (STILL INCOMPLETE)]), [if test x$enableval = xyes; then if test x$have_cacalib = xyes; then fim_cv_cacalib=yes @@ -1433,8 +1431,7 @@ AC_ARG_ENABLE(cacalib, AC_HELP_STRING([--enable-cacalib], [Turns on cacalib supp dnl ================== # This code still awaits for integration ... -AC_ARG_WITH(cflags, AC_HELP_STRING([--with-cflags=CXXFLAGS], - [Specify a custom CXXFLAGS append value. e.g.: -pg +AC_ARG_WITH(cflags, AS_HELP_STRING([--with-cflags=CXXFLAGS],[Specify a custom CXXFLAGS append value. e.g.: -pg You cannot call this argument multiple times. In case you want completely reset CXXFLAGS use : CXXFLAGS='' ./configure .. @@ -1456,7 +1453,7 @@ AC_ARG_WITH(cflags, AC_HELP_STRING([--with-cflags=CXXFLAGS], dnl ================== # This code still awaits for integration ... -AC_ARG_WITH(exec-shell, AC_HELP_STRING([--with-exec-shell=SHELL], [Specify alternate shell (ONLY if /bin/sh is broken)]), +AC_ARG_WITH(exec-shell, AS_HELP_STRING([--with-exec-shell=SHELL],[Specify alternate shell (ONLY if /bin/sh is broken)]), [if test x$withval != xyes; then AC_DEFINE_UNQUOTED(EXECSHELL, "$withval", [program to use for shell commands]) @@ -1466,7 +1463,7 @@ AC_ARG_WITH(exec-shell, AC_HELP_STRING([--with-exec-shell=SHELL], [Specify alter [AC_DEFINE_UNQUOTED(EXECSHELL, "/bin/sh")]) dnl ================== -AC_ARG_ENABLE(convert, AC_HELP_STRING([--disable-smartautocompletion], [Fim will treat as a proper, unescaped string, nonquoted and nonevaluated strings which happen to match an existing filename.]), +AC_ARG_ENABLE(convert, AS_HELP_STRING([--disable-smartautocompletion],[Fim will treat as a proper, unescaped string, nonquoted and nonevaluated strings which happen to match an existing filename.]), [ if test x$enableval = xno; then fim_cv_smartautcompletion=no else @@ -1484,7 +1481,7 @@ if test x$fim_cv_scan_consolefonts = xyes; then fi dnl ================== -AC_ARG_ENABLE(convert, AC_HELP_STRING([--disable-convert], [Fim will try to use convert (ImageMagick) as a last resort for opening unknown format files.]), +AC_ARG_ENABLE(convert, AS_HELP_STRING([--disable-convert],[Fim will try to use convert (ImageMagick) as a last resort for opening unknown format files.]), [ if test x$enableval = xno; then fim_cv_convert=no else @@ -1497,7 +1494,7 @@ AC_ARG_ENABLE(convert, AC_HELP_STRING([--disable-convert], [Fim will try to use dnl ================== -AC_ARG_ENABLE(xcftopnm, AC_HELP_STRING([--disable-xcftopnm], [Fim will try to use xcftopnm (Gimp) for opening XCF format files.]), +AC_ARG_ENABLE(xcftopnm, AS_HELP_STRING([--disable-xcftopnm],[Fim will try to use xcftopnm (Gimp) for opening XCF format files.]), [ if test x$enableval = xno; then fim_cv_xcftopnm=no else @@ -1509,7 +1506,7 @@ AC_ARG_ENABLE(xcftopnm, AC_HELP_STRING([--disable-xcftopnm], [Fim will try to us dnl ================== fim_cv_inkscape=yes -AC_ARG_ENABLE(inkscape, AC_HELP_STRING([--disable-inkscape], [Fim will try to use Inkscape for opening SVG format files.]), +AC_ARG_ENABLE(inkscape, AS_HELP_STRING([--disable-inkscape],[Fim will try to use Inkscape for opening SVG format files.]), [ if test x$enableval = xno; then fim_cv_inkscape=no else @@ -1520,7 +1517,7 @@ AC_ARG_ENABLE(inkscape, AC_HELP_STRING([--disable-inkscape], [Fim will try to us dnl ================== -AC_ARG_ENABLE(xfig, AC_HELP_STRING([--disable-xfig], [Fim will try to use xfig (fig2dev) for opening FIG format files.]), +AC_ARG_ENABLE(xfig, AS_HELP_STRING([--disable-xfig],[Fim will try to use xfig (fig2dev) for opening FIG format files.]), [ if test x$enableval = xno; then fim_cv_xfig=no else @@ -1531,7 +1528,7 @@ AC_ARG_ENABLE(xfig, AC_HELP_STRING([--disable-xfig], [Fim will try to use xfig ( dnl ================== -AC_ARG_ENABLE(dia, AC_HELP_STRING([--disable-dia], [Fim will try to use dia for opening DIA format files.]), +AC_ARG_ENABLE(dia, AS_HELP_STRING([--disable-dia],[Fim will try to use dia for opening DIA format files.]), [ if test x$enableval = xno; then fim_cv_dia=no else @@ -1542,19 +1539,19 @@ AC_ARG_ENABLE(dia, AC_HELP_STRING([--disable-dia], [Fim will try to use dia for dnl ================== AH_TEMPLATE([FIM_DEFAULT_CONSOLEFONT]) -AC_ARG_WITH(default-consolefont, AC_HELP_STRING([--with-default-consolefont=FILE], [Specify a default consolefont (psf or psf.gz format) file.]), [ AC_DEFINE_UNQUOTED(FIM_DEFAULT_CONSOLEFONT, "$withval") ], [fim_cv_defaultconsolefont=""]) +AC_ARG_WITH(default-consolefont, AS_HELP_STRING([--with-default-consolefont=FILE],[Specify a default consolefont (psf or psf.gz format) file.]), [ AC_DEFINE_UNQUOTED(FIM_DEFAULT_CONSOLEFONT, "$withval") ], [fim_cv_defaultconsolefont=""]) dnl ================== -AC_ARG_WITH(custom-hardcoded-consolefont, AC_HELP_STRING([--with-custom-hardcoded-consolefont=FILE], [Specify a custom consolefont to be hardcoded (uncompressed psf format, absolute path) at build time (requires --enable-hardcoded-font).]), [ +AC_ARG_WITH(custom-hardcoded-consolefont, AS_HELP_STRING([--with-custom-hardcoded-consolefont=FILE],[Specify a custom consolefont to be hardcoded (uncompressed psf format, absolute path) at build time (requires --enable-hardcoded-font).]), [ fim_cv_want_custom_hardcoded_consolefont=true; AC_SUBST(FIM_CUSTOM_HARDCODED_CONSOLEFONT, "$withval") ], []) AM_CONDITIONAL(FIM_WANT_CUSTOM_HARDCODED_CONSOLEFONT, test x$fim_cv_want_custom_hardcoded_consolefont = xtrue ) dnl ================== -AC_ARG_WITH(tmpfile, AC_HELP_STRING([--with-tmpfile=FILE], [Specify where to put temporary files created when interacting with external conversion programs (default is "/tmp/__FIM_TEMPORARY_FILE").]), +AC_ARG_WITH(tmpfile, AS_HELP_STRING([--with-tmpfile=FILE],[Specify where to put temporary files created when interacting with external conversion programs (default is "/tmp/__FIM_TEMPORARY_FILE").]), [fim_cv_tmpfile=$withval], [fim_cv_tmpfile="/tmp/__FIM_TEMPORARY_FILE"]) dnl ================== -AC_ARG_ENABLE(custom-status-bar, AC_HELP_STRING([--disable-custom-status-bar], [Customization of status bar via a printf-like string.]), +AC_ARG_ENABLE(custom-status-bar, AS_HELP_STRING([--disable-custom-status-bar],[Customization of status bar via a printf-like string.]), [ if test x$enableval = xno; then fim_cv_custom_status_bar=no; else @@ -1564,7 +1561,7 @@ AC_ARG_ENABLE(custom-status-bar, AC_HELP_STRING([--disable-custom-status-bar], [ ) dnl ================== -AC_ARG_ENABLE(optimizations, AC_HELP_STRING([--enable-optimizations], [Will try to enhance compilation flags (EXPERIMENTAL)]), +AC_ARG_ENABLE(optimizations, AS_HELP_STRING([--enable-optimizations],[Will try to enhance compilation flags (EXPERIMENTAL)]), [ if test x$enableval = xno; then fim_cv_optimizations=no else @@ -1722,23 +1719,23 @@ dnl ================== dnl ================== AH_TEMPLATE([FIM_WANT_FILENAME_MARK_AND_DUMP]) -AC_ARG_ENABLE(mark-and-dump, AC_HELP_STRING([--enable-mark-and-dump], [Fim will be capable of marking files while viewing and outputting their names on exit. (enabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_mark_and_dump=1 ; else fim_cv_want_mark_and_dump=0 ; fi ],[ fim_cv_want_mark_and_dump=1 ]) +AC_ARG_ENABLE(mark-and-dump, AS_HELP_STRING([--enable-mark-and-dump],[Fim will be capable of marking files while viewing and outputting their names on exit. (enabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_mark_and_dump=1 ; else fim_cv_want_mark_and_dump=0 ; fi ],[ fim_cv_want_mark_and_dump=1 ]) AC_DEFINE_UNQUOTED([FIM_WANT_FILENAME_MARK_AND_DUMP], $fim_cv_want_mark_and_dump, [Fim will be capable of marking files while viewing and outputting their names on exit.]) dnl ================== AH_TEMPLATE([FIM_WANT_NOSCRIPTING]) -AC_ARG_ENABLE(scripting, AC_HELP_STRING([--enable-scripting], [Scripting. (enabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_noscripting=0 ; else fim_cv_want_noscripting=1 ; fi ],[ fim_cv_want_noscripting=0 ]) +AC_ARG_ENABLE(scripting, AS_HELP_STRING([--enable-scripting],[Scripting. (enabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_noscripting=0 ; else fim_cv_want_noscripting=1 ; fi ],[ fim_cv_want_noscripting=0 ]) if test x$fim_cv_want_noscripting == x1 ; then AC_DEFINE_UNQUOTED([FIM_WANT_NOSCRIPTING], $fim_cv_want_noscripting, [Scripting. (enabled by default)]) fi dnl ================== AH_TEMPLATE([FIM_WANT_NO_OUTPUT_CONSOLE]) -AC_ARG_ENABLE(output-console, AC_HELP_STRING([--enable-output-console], [Output console. (enabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_no_output_console=0 ; else fim_cv_want_no_output_console=1 ; fi ],[ fim_cv_want_no_output_console=0 ]) +AC_ARG_ENABLE(output-console, AS_HELP_STRING([--enable-output-console],[Output console. (enabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_no_output_console=0 ; else fim_cv_want_no_output_console=1 ; fi ],[ fim_cv_want_no_output_console=0 ]) if test x$fim_cv_want_no_output_console == x1 ; then AC_DEFINE_UNQUOTED([FIM_WANT_NO_OUTPUT_CONSOLE], $fim_cv_want_no_output_console, [Output console. (enabled by default)]) fi dnl ================== AH_TEMPLATE([FIM_WANT_UNICODE]) -AC_ARG_ENABLE(unicode, AC_HELP_STRING([--enable-unicode], [Unicode. (disabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_unicode=1 ; else fim_cv_want_unicode=0 ; fi ],[ fim_cv_want_unicode=0 ]) +AC_ARG_ENABLE(unicode, AS_HELP_STRING([--enable-unicode],[Unicode. (disabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_unicode=1 ; else fim_cv_want_unicode=0 ; fi ],[ fim_cv_want_unicode=0 ]) if test x$fim_cv_want_unicode == x1 ; then # CXXFLAGS="$CXXFLAGS `freetype-config --cflags`" # LIBS="$LIBS `freetype-config --libs`" @@ -1747,7 +1744,7 @@ fi dnl ================== AH_TEMPLATE([FIM_WANT_TEXT_RENDERING]) fim_want_astext=yes -AC_ARG_ENABLE(as-text-rendering, AC_HELP_STRING([--disable-as-text-rendering], [Disable as-text rendering (viewing of any file as character bytes -- not to be confused with the ASCII art output).]), +AC_ARG_ENABLE(as-text-rendering, AS_HELP_STRING([--disable-as-text-rendering],[Disable as-text rendering (viewing of any file as character bytes -- not to be confused with the ASCII art output).]), [ if test x$enableval = xno ; then fim_want_astext=no fi @@ -1758,7 +1755,7 @@ fi dnl ================== AH_TEMPLATE([FIM_WANT_RAW_BITS_RENDERING]) fim_want_rbr=yes -AC_ARG_ENABLE(raw-bits-rendering, AC_HELP_STRING([--disable-raw-bits-rendering], [Disable raw bits rendering (viewing of any file as either a 1 or 24 bpp bitmap).]), +AC_ARG_ENABLE(raw-bits-rendering, AS_HELP_STRING([--disable-raw-bits-rendering],[Disable raw bits rendering (viewing of any file as either a 1 or 24 bpp bitmap).]), [ if test x$enableval = xno ; then fim_want_rbr=no fi @@ -1769,7 +1766,7 @@ fi dnl ================== AH_TEMPLATE([FIM_ALLOW_LOADER_STRING_SPECIFICATION]) fim_want_lss=yes -AC_ARG_ENABLE(loader-string-specification, AC_HELP_STRING([--disable-loader-string-specification], [Disables the chance to specify a file loader.]), +AC_ARG_ENABLE(loader-string-specification, AS_HELP_STRING([--disable-loader-string-specification],[Disables the chance to specify a file loader.]), [ if test x$enableval = xno ; then fim_want_lss=no fi @@ -1851,7 +1848,7 @@ AC_DEFINE([FBI_AUTHOR],["Gerd Hoffmann "]) dnl ############################################################################### dnl this is experimental stuff dnl ############################################################################### -AC_ARG_ENABLE(matrices-rendering, AC_HELP_STRING([--enable-matrices-rendering], [Uses librsb for rendering of Matrix Market files (must have librsb-config in the PATH).]), +AC_ARG_ENABLE(matrices-rendering, AS_HELP_STRING([--enable-matrices-rendering],[Uses librsb for rendering of Matrix Market files (must have librsb-config in the PATH).]), [ if test x$enableval = xyes; then if test x$ac_cv_func_rsb_lib_init = xyes; then AH_TEMPLATE([HAVE_MATRIX_MARKET_DECODER]) @@ -1881,12 +1878,13 @@ AC_SUBST(CXXFLAGS) #AC_CONFIG_FILES([Makefile],[src/Makefile]) -AC_OUTPUT(Makefile src/Makefile doc/Makefile distros/Makefile scripts/Makefile +AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile distros/Makefile scripts/Makefile scripts/maintenance/cron-build.sh scripts/maintenance/remote-build.sh scripts/maintenance/cron-svndump.pl scripts/maintenance/cron-rsync.sh - ) + ]) +AC_OUTPUT #AC_OUTPUT AC_MSG_NOTICE([ -- cgit v1.2.3 From 0257dc6619291f14d10d9f45e5bcd313fb3d90ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Laboissi=C3=A8re?= Date: Sun, 14 Nov 2021 03:02:05 -0300 Subject: Honor the CPPFLAGS environment variable Forwarded: https://savannah.nongnu.org/bugs/index.php?61478 Last-Update: 2021-11-14 This is required in Debian, such that hardening flags like -D_FORTIFY_SOURCE=2 are used in the compilation of C++ files. Gbp-Pq: Name honor-cppflags.patch --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 64ecc07..11c624c 100644 --- a/configure.ac +++ b/configure.ac @@ -79,7 +79,7 @@ AM_INIT_AUTOMAKE #AM_INIT_AUTOMAKE(fim, $fim_cv_version) #AM_INIT_AUTOMAKE(fim, 1.0) AC_SUBST([CONFIG_STATUS_DEPENDENCIES], ['$(top_srcdir)/VERSION']) -CPPFLAGS='' +#CPPFLAGS='' AC_SUBST(FIM_LIBS) -- cgit v1.2.3 From 9f43d019cf2085c31d7103321bbc292e7a629857 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Laboissi=C3=A8re?= Date: Sun, 14 Nov 2021 03:02:05 -0300 Subject: Commit patch to update .gitignore [dgit (9.14) update-gitignore-quilt-fixup] --- debian/patches/auto-gitignore | 52 +++++++++++++++++++++++++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 53 insertions(+) create mode 100644 debian/patches/auto-gitignore diff --git a/debian/patches/auto-gitignore b/debian/patches/auto-gitignore new file mode 100644 index 0000000..8a79671 --- /dev/null +++ b/debian/patches/auto-gitignore @@ -0,0 +1,52 @@ +Subject: Update .gitignore from Debian packaging branch + +The Debian packaging git branch contains these updates to the upstream +.gitignore file(s). This patch is autogenerated, to provide these +updates to users of the official Debian archive view of the package. + +[dgit (9.14) update-gitignore] +--- +diff --git a/.gitignore b/.gitignore +new file mode 100644 +index 0000000..73185d7 +--- /dev/null ++++ b/.gitignore +@@ -0,0 +1,38 @@ ++/.pc/ ++/Makefile ++/autom4te.cache/ ++/compile ++/config.h ++/config.h.in~ ++/config.log ++/config.status ++/debian/.debhelper/ ++/debian/autoreconf.* ++/debian/debhelper-build-stamp ++/debian/files ++/debian/fim.debhelper.log ++/debian/fim.substvars ++/debian/fim/ ++/distros/Makefile ++/doc/Makefile ++/doc/doctags ++/doc/tags ++/scripts/Makefile ++/scripts/maintenance/cron-build.sh ++/scripts/maintenance/cron-rsync.sh ++/scripts/maintenance/cron-svndump.pl ++/scripts/maintenance/remote-build.sh ++/src/*.o ++/src/b2ba ++/src/conf.h ++/src/config.h.in ++/src/fim ++/src/Makefile ++/src/lex.yy.cc ++/src/yacc.output ++/src/yacc.tab.cpp ++/src/yacc.tab.hpp ++/src/yacc.tab.o ++/stamp-h1 ++/src/testdir/*.out ++/src/testdir/test.log diff --git a/debian/patches/series b/debian/patches/series index 97797f6..4bf0196 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -3,3 +3,4 @@ reproducible-build.patch compile-with-gcc-10.patch update-configure-ac.patch honor-cppflags.patch +auto-gitignore -- cgit v1.2.3 From b7ebfa8823983f90e70aa27d4e1adf2dd0c2804a Mon Sep 17 00:00:00 2001 From: Rafael Laboissiere Date: Sun, 21 Nov 2021 04:56:05 -0300 Subject: Adjust code for compilation against GCC 9 Forwarded: https://savannah.nongnu.org/bugs/index.php?58792 Last-Update: 2019-07-13 Gbp-Pq: Name compile-with-gcc-9.patch --- src/Var.h | 2 +- src/fim_types.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Var.h b/src/Var.h index 1339ac1..1c06c47 100644 --- a/src/Var.h +++ b/src/Var.h @@ -175,7 +175,7 @@ class Var if(sizeof(fim_int)==sizeof(int)) sprintf(buf,"%d",(int)i); else - sprintf(buf,"%lld",(int64_t)i); + sprintf(buf,"%ld",(int64_t)i); } else if(type=='f') diff --git a/src/fim_types.h b/src/fim_types.h index 3c66422..711366b 100644 --- a/src/fim_types.h +++ b/src/fim_types.h @@ -64,7 +64,7 @@ typedef int fim_var_t; /* a type for fim's variable types */ typedef int fim_str_t; /* a type for stdin/stdout streams */ typedef int fim_sys_int; /* always int */ - typedef int fim_color_t; /* >= 4 bytes */ + typedef unsigned int fim_color_t; /* >= 4 bytes */ typedef int fim_ts_t; /* a type for time, in seconds */ typedef int fim_tms_t; /* a type for time, in milliseconds */ -- cgit v1.2.3 From d7630781f8f7b6dae4527be30abb34d323b78eaa Mon Sep 17 00:00:00 2001 From: Chris Lamb Date: Sun, 21 Nov 2021 04:56:05 -0300 Subject: Make the build reproducible MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Forwarded: https://savannah.nongnu.org/bugs/index.php?58793 Reviewed-by: Rafael Laboissière Last-Update: 2019-04-29 Gbp-Pq: Name reproducible-build.patch --- src/Makefile.am | 1 - src/fim.cpp | 7 ------- 2 files changed, 8 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 7a4fdfb..f82e4f8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -51,7 +51,6 @@ version.h: ../config.h $(ECHO) "\"\n\"" >> $@ $(GREP) define $< | $(GREP) FIM.*'"' | LC_ALL=C $(SORT) | $(SED) 's/^#//g;s/define //g;s/^\([A-Za-z0-9_]*\) "\(.*\)"$$/"\1 = \\"\2\\"\\n"/g' >> $@ $(GREP) undef $< | $(GREP) FIM | LC_ALL=C $(SORT) | $(SED) 's/^#//g;s/.*undef //g;s/^\([A-Za-z0-9_]*\).\+$$/-\1 /g;s/^/\"/g;s/$$/\"/g' >> $@ - $(ECHO) '"\n'CXXFLAGS=$(CXXFLAGS)'\n"' >> $@ help.cpp: fim.h $(ECHO) -e "#ifdef FIM_WANT_INLINE_HELP\n" > $@ diff --git a/src/fim.cpp b/src/fim.cpp index c6ba3fd..a2257af 100644 --- a/src/fim.cpp +++ b/src/fim.cpp @@ -1603,13 +1603,6 @@ fim_perr_t main(int argc,char *argv[]) #ifdef FIM_CONFIGURATION "Configuration invocation: " FIM_CONFIGURATION "\n" #endif /* FIM_CONFIGURATION */ - #ifdef CXXFLAGS - "Compile flags: CXXFLAGS=" CXXFLAGS - #ifdef CFLAGS - " CFLAGS=" CFLAGS - #endif /* CFLAGS */ - "\n" - #endif /* CXXFLAGS */ "Fim options (features included (+) or not (-)):\n" #include "version.h" /* i think some flags are missing .. */ -- cgit v1.2.3 From cb229879ea4eab455670047e2f5c02a710e57cee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Laboissi=C3=A8re?= Date: Sun, 21 Nov 2021 04:56:05 -0300 Subject: Compile with GCC 10 Bug-Debian: https://bugs.debian.org/957202 Forwarded: https://savannah.nongnu.org/bugs/index.php?58399#comment1 Last-Update: 2020-07-20 This patch remove a non-active code (inside "#if 0") in file src/fim.cpp which, according to the upstream author, contains "leftovers from the old man file". This removal seems harmless and allows the package to be built with GCC 10. Gbp-Pq: Name compile-with-gcc-10.patch --- src/fim.cpp | 56 -------------------------------------------------------- 1 file changed, 56 deletions(-) diff --git a/src/fim.cpp b/src/fim.cpp index a2257af..e777d24 100644 --- a/src/fim.cpp +++ b/src/fim.cpp @@ -302,62 +302,6 @@ FIM_NULL {0,0,0,0,0,0} }; -#if 0 -// leftovers from the old man file; shall adapt these using .\" - .TP - .B -f font - Set font. This can be either a pcf console font file or a X11 font - spec. Using X11 fonts requires a font server (The one specified in - the environment variable FONTSERVER or on localhost). The FBFONT - environment variable is used as default. If unset, fim will - fallback to 10x20 (X11) / lat1u-16.psf (console). - .TP - .B --autoup - Like autozoom, but scale up only. - .TP - .B --autodown - Like autozoom, but scale down only. - .TP - .B -u - Randomize the order of the filenames. - .TP - .B -e - Enable editing commands. - .TP - .B -b - create backup files (when editing images). - .TP - .B -p - preserve timestamps (when editing images). - .TP - .B --comments - Display comment tags (if present) instead of the filename. Probaby - only useful if you added reasonable comments yourself (using wrjpgcom - for example), otherwise you likely just find texts pointing to the - software which created the image. - P pause the slideshow (if started with -t, toggle) - {number}g jump to image {number} - .SH EDIT IMAGE - fim also provides some very basic image editing facilities. You have - to start fim with the -e switch to use them. - .P - .nf - Shift+D delete image - R rotate 90° clockwise - L rotate 90° counter-clock wise - .fi - .P - The delete function actually wants a capital letter 'D', thus you have - to type Shift+D. This is done to avoid deleting images by mistake - because there are no safety bells: If you ask fim to delete the image, - it will be deleted without questions asked. - .P - The rotate function actually works for JPEG images only because it - calls the jpegtran command to perform a lossless rotation if the image. - It is especially useful if you review the images of your digital - camera. -#endif - const int fim_options_count=sizeof(fim_options)/sizeof(fim_options_t); struct option options[fim_options_count]; -- cgit v1.2.3 From e0d890ae7a29484666f71af2bfa9602d22247925 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Laboissi=C3=A8re?= Date: Sun, 21 Nov 2021 04:56:05 -0300 Subject: Update configure.ac Forwarded: https://savannah.nongnu.org/bugs/?60900 Last-Update: 2021-07-09 This patch is the result of running autoupdate Gbp-Pq: Name update-configure-ac.patch --- configure.ac | 236 +++++++++++++++++++++++++++++------------------------------ 1 file changed, 117 insertions(+), 119 deletions(-) diff --git a/configure.ac b/configure.ac index b600f50..64ecc07 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,10 @@ dnl Process this file with autoconf to produce a configure script. dnl $LastChangedDate: 2017-07-19 15:46:18 +0200 (Wed, 19 Jul 2017) $ -AC_PREREQ([2.54]) +AC_PREREQ([2.71]) # we'll move forward, one day or another -#AC_PREREQ([2.61]) +#AC_PREREQ([2.71]) # for future use, too #AC_PROG_CC(cc gcc) @@ -46,7 +46,7 @@ AC_MSG_NOTICE([ # #AM_INIT_AUTOMAKE($PACKAGE_NAME, $PACKAGE_VERSION) -AC_GNU_SOURCE +AC_USE_SYSTEM_EXTENSIONS #AC_MANTAINER_MODE #AC_CANONICAL_HOST @@ -97,7 +97,7 @@ else fi AC_MSG_RESULT($fim_cv_prefix) -AC_ISC_POSIX +AC_SEARCH_LIBS([strerror],[cposix]) #AM_C_PROTOTYPES if test "x$U" != "x"; then AC_MSG_ERROR(Compiler not ANSI compliant) @@ -122,7 +122,7 @@ AC_CHECK_FUNC([rsb_lib_init]) AC_CHECK_LIB([m],[pow]) AC_CHECK_LIB([fl],[yylex]) -AC_ARG_ENABLE(graphicsmagick, AC_HELP_STRING([--enable-graphicsmagick], [Enable GraphicsMagick library support (EXPERIMENTAL).]), [ if test x$enableval != xno ; then fim_handle_graphicsmagick=yes ; fi ] ) +AC_ARG_ENABLE(graphicsmagick, AS_HELP_STRING([--enable-graphicsmagick],[Enable GraphicsMagick library support (EXPERIMENTAL).]), [ if test x$enableval != xno ; then fim_handle_graphicsmagick=yes ; fi ] ) AC_CHECK_LIB([GraphicsMagick],[GetMagickVersion], [ if test x"$fim_handle_graphicsmagick" = x"yes" ; then @@ -133,7 +133,7 @@ if test x"$fim_handle_graphicsmagick" = x"yes" ; then fi ], []) -AC_ARG_ENABLE(imlib2, AC_HELP_STRING([--enable-imlib2], [Enable Imlib2 library support (EXPERIMENTAL,INCOMPLETE).]), [ if test x$enableval != xno ; then fim_handle_imlib2=yes ; fi ] ) +AC_ARG_ENABLE(imlib2, AS_HELP_STRING([--enable-imlib2],[Enable Imlib2 library support (EXPERIMENTAL,INCOMPLETE).]), [ if test x$enableval != xno ; then fim_handle_imlib2=yes ; fi ] ) AC_CHECK_LIB([Imlib2],[imlib_create_image], [ if test x"$fim_handle_imlib2" = x"yes" ; then @@ -187,7 +187,7 @@ have_default_bindings=yes have_default_mapping=yes have_default_config=yes -AC_ARG_ENABLE(default_bindings, AC_HELP_STRING([--disable-default-bindings], [Builtin default minimal key binding]), +AC_ARG_ENABLE(default_bindings, AS_HELP_STRING([--disable-default-bindings],[Builtin default minimal key binding]), [ if test x$enableval = xyes; then have_default_bindings=yes else @@ -195,7 +195,7 @@ AC_ARG_ENABLE(default_bindings, AC_HELP_STRING([--disable-default-bindings], [Bu fi ]) -AC_ARG_ENABLE(default_mapping, AC_HELP_STRING([--disable-default-mapping], [Builtin default minimal key mapping]), +AC_ARG_ENABLE(default_mapping, AS_HELP_STRING([--disable-default-mapping],[Builtin default minimal key mapping]), [ if test x$enableval = xyes; then have_default_mapping=yes else @@ -203,7 +203,7 @@ AC_ARG_ENABLE(default_mapping, AC_HELP_STRING([--disable-default-mapping], [Buil fi ]) -AC_ARG_ENABLE(default_config, AC_HELP_STRING([--disable-default-config], [Builtin default minimal configuration]), +AC_ARG_ENABLE(default_config, AS_HELP_STRING([--disable-default-config],[Builtin default minimal configuration]), [ if test x$enableval = xyes; then have_default_config=yes else @@ -234,14 +234,14 @@ AC_ARG_ENABLE(default_config, AC_HELP_STRING([--disable-default-config], [Builti #AC_SUBST(LIBPNG_CXXFLAGS) #AC_SUBST(LIBPNG_LIBS) -AC_ARG_ENABLE(system, AC_HELP_STRING([--disable-system], [Disable system() and pipe() calls.]), +AC_ARG_ENABLE(system, AS_HELP_STRING([--disable-system],[Disable system() and pipe() calls.]), [ if test x$enableval = xno ; then fim_system_calls=no fi ]) dnl new: -AC_ARG_ENABLE(framebuffer, AC_HELP_STRING([--disable-framebuffer], [Disable the framebuffer device driver.]), +AC_ARG_ENABLE(framebuffer, AS_HELP_STRING([--disable-framebuffer],[Disable the framebuffer device driver.]), [ if test x$enableval = xno ; then fim_handle_framebuffer=no fi @@ -263,7 +263,15 @@ if test x$fim_handle_framebuffer = xno ; then AC_DEFINE(FIM_WITH_NO_FRAMEBUFFER, 1, [Defined when framebuffer device support is turned off.]) fi -AC_HEADER_STDC +m4_warn([obsolete], +[The preprocessor macro `STDC_HEADERS' is obsolete. + Except in unusual embedded environments, you can safely include all + ISO C90 headers unconditionally.])dnl +# Autoupdate added the next two lines to ensure that your configure +# script's behavior did not change. They are probably safe to remove. +AC_CHECK_INCLUDES_DEFAULT +AC_PROG_EGREP + AC_FUNC_MMAP AC_CHECK_FUNCS([bzero memset memcmp strncmp strcpy]) @@ -320,11 +328,23 @@ dnl fi dnl AC_CHECK_FUNCS(setrlimit getsid) -AC_TYPE_SIGNAL +m4_warn([obsolete], +[your code may safely assume C89 semantics that RETSIGTYPE is void. +Remove this warning and the `AC_CACHE_CHECK' when you adjust the code.])dnl +AC_CACHE_CHECK([return type of signal handlers],[ac_cv_type_signal],[AC_COMPILE_IFELSE( +[AC_LANG_PROGRAM([#include +#include +], + [return *(signal (0, 0)) (0) == 1;])], + [ac_cv_type_signal=int], + [ac_cv_type_signal=void])]) +AC_DEFINE_UNQUOTED([RETSIGTYPE],[$ac_cv_type_signal],[Define as the return type of signal handlers + (`int' or `void').]) + dnl ================== AH_TEMPLATE([FIM_WANT_STATIC_BINARY]) -AC_ARG_ENABLE(static, AC_HELP_STRING([--enable-static], [Want a static binary. (disabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_static=1 ; else fim_cv_want_static=0 ; fi ],[ fim_cv_want_static=0 ]) +AC_ARG_ENABLE(static, AS_HELP_STRING([--enable-static],[Want a static binary. (disabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_static=1 ; else fim_cv_want_static=0 ; fi ],[ fim_cv_want_static=0 ]) if test x$fim_cv_want_static == x1 ; then LIBS="$LIBS --static" LIBDJVU_STATIC_EXTRA="-lpthread" @@ -339,20 +359,19 @@ fi dnl ================== -AC_ARG_WITH(regex, AC_HELP_STRING([--with-regex], [Use the GNU regex library instead of the POSIX one]), +AC_ARG_WITH(regex, AS_HELP_STRING([--with-regex],[Use the GNU regex library instead of the POSIX one]), [fim_cv_regex=yes], [AC_CHECK_FUNCS(regcomp, fim_cv_regex=no, fim_cv_regex=yes)]) if test X$fim_cv_regex = Xno ; then AC_CACHE_CHECK([whether your system regexp library is completely broken], [fim_cv_regex_broken], - AC_TRY_RUN([ + AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include #include -int main() { regex_t blah ; regmatch_t p; p.rm_eo = p.rm_eo; return regcomp(&blah, "foo.*bar", REG_NOSUB) || regexec (&blah, "foobar", 0, NULL, 0); }], - fim_cv_regex_broken=no, fim_cv_regex_broken=yes, fim_cv_regex_broken=yes)) +int main() { regex_t blah ; regmatch_t p; p.rm_eo = p.rm_eo; return regcomp(&blah, "foo.*bar", REG_NOSUB) || regexec (&blah, "foobar", 0, NULL, 0); }]])],[fim_cv_regex_broken=no],[fim_cv_regex_broken=yes],[fim_cv_regex_broken=yes])) if test X$fim_cv_regex_broken = Xyes ; then - echo "Using the included GNU regex instead." >&AC_FD_MSG + echo "Using the included GNU regex instead." >&AS_MESSAGE_FD fim_cv_regex=yes fi fi @@ -365,7 +384,7 @@ fi AC_MSG_CHECKING(where to put the documentation...) -dnl AC_ARG_WITH(docdir, AC_HELP_STRING([--with-docdir=PATH], [Specify where to put the documentation]), +dnl AC_ARG_WITH(docdir, AS_HELP_STRING([--with-docdir=PATH],[Specify where to put the documentation]), dnl [fim_cv_docdir=$withval], dnl [fim_cv_docdir='${prefix}/doc/fim-${fim_cv_version}']) # FIXME : the above line seems troublesome, BUT IT IS NOT (see the muttrc for this trick). @@ -378,7 +397,7 @@ AC_SUBST(fim_cv_version) dnl ============= gif file handling -AC_ARG_ENABLE(gif, AC_HELP_STRING([--disable-gif], [Disable gif support.]), +AC_ARG_ENABLE(gif, AS_HELP_STRING([--disable-gif],[Disable gif support.]), [ if test x$enableval = xno ; then fim_handle_gif=no fi @@ -393,14 +412,11 @@ if test x$fim_handle_gif != xno ; then AC_MSG_WARN([*** GIF loader will not be built (GIF library not found) ***])) if test x"$have_gif" = xyes; then AC_MSG_CHECKING([for gif.h]) - AC_TRY_CPP( -[#include + AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include #undef PACKAGE #undef VERSION #undef HAVE_STDLIB_H -#include ], - have_gif=yes, - have_gif=no) +#include ]])],[have_gif=yes],[have_gif=no]) AC_MSG_RESULT($have_gif) if test x"$have_gif" = xyes; then LIBGIF='-lgif' @@ -432,7 +448,7 @@ AM_CONDITIONAL(ENABLE_GIF, test x$have_gif = xyes) dnl ============= tiff file handling -AC_ARG_ENABLE(tiff, AC_HELP_STRING([--disable-tiff], [Disable tiff support.]), +AC_ARG_ENABLE(tiff, AS_HELP_STRING([--disable-tiff],[Disable tiff support.]), [ if test x$enableval = xno ; then fim_handle_tiff=no fi @@ -447,14 +463,11 @@ if test x$fim_handle_tiff != xno ; then AC_MSG_WARN([*** TIFF loader will not be built (TIFF library not found) ***]) , [$LIBTIFF_STATIC_EXTRA]) if test x"$have_tiff" = xyes; then AC_MSG_CHECKING([for tiff.h]) - AC_TRY_CPP( -[#include + AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include #undef PACKAGE #undef VERSION #undef HAVE_STDLIB_H -#include ], - have_tiff=yes, - have_tiff=no) +#include ]])],[have_tiff=yes],[have_tiff=no]) AC_MSG_RESULT($have_tiff) if test x"$have_tiff" = xyes; then LIBTIFF="-ltiff $LIBTIFF_STATIC_EXTRA" @@ -501,7 +514,7 @@ dnl ============= GNU gpm, unofficial yet dnl ============= no readline case handling fim_want_cxx11=no -AC_ARG_ENABLE(cxx11, AC_HELP_STRING([--enable-cxx11], [Enable C++11 standard constructs (requires appropriate CXXFLAGS, e.g. -std=c++11) (EXPERIMENTAL).]), +AC_ARG_ENABLE(cxx11, AS_HELP_STRING([--enable-cxx11],[Enable C++11 standard constructs (requires appropriate CXXFLAGS, e.g. -std=c++11) (EXPERIMENTAL).]), [ if test x$enableval = xno ; then fim_want_cxx11=no else @@ -512,7 +525,7 @@ AC_ARG_ENABLE(cxx11, AC_HELP_STRING([--enable-cxx11], [Enable C++11 standard con dnl ============= no readline case handling fim_want_readline=yes -AC_ARG_ENABLE(readline, AC_HELP_STRING([--disable-readline], [Disable readline support (EXPERIMENTAL).]), +AC_ARG_ENABLE(readline, AS_HELP_STRING([--disable-readline],[Disable readline support (EXPERIMENTAL).]), [ if test x$enableval = xno ; then fim_want_readline=no else @@ -561,7 +574,7 @@ fi dnl ============= jpeg file handling #AC_ARG_WITH(jpeg, [ --disable-jpeg ], [ disable jpeg file support]) -AC_ARG_ENABLE(jpeg, AC_HELP_STRING([--disable-jpeg], [Disable jpeg support.]), +AC_ARG_ENABLE(jpeg, AS_HELP_STRING([--disable-jpeg],[Disable jpeg support.]), [ if test x$enableval = xno ; then fim_handle_jpeg=no fi @@ -576,14 +589,11 @@ if test x$fim_handle_jpeg != xno ; then AC_MSG_WARN([*** JPEG loader will not be built (JPEG library not found) ***])) if test x"$have_jpeg" = xyes; then AC_MSG_CHECKING([for jpeglib.h]) - AC_TRY_CPP( -[#include + AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include #undef PACKAGE #undef VERSION #undef HAVE_STDLIB_H -#include ], - have_jpeg=yes, - have_jpeg=no) +#include ]])],[have_jpeg=yes],[have_jpeg=no]) AC_MSG_RESULT($have_jpeg) if test x"$have_jpeg" = xyes; then LIBJPEG='-ljpeg' @@ -616,7 +626,7 @@ AM_CONDITIONAL(ENABLE_JPEG, test x$have_jpeg = xyes) dnl ============= dvi file handling (via TeX-Guy) dnl -dnl AC_ARG_ENABLE(dvi, AC_HELP_STRING([--disable-dvi], [Disable dvi support.]), +dnl AC_ARG_ENABLE(dvi, AS_HELP_STRING([--disable-dvi],[Disable dvi support.]), dnl [ if test x$enableval = xno ; then dnl fim_handle_dvi=no dnl fi @@ -631,14 +641,11 @@ dnl have_dvi=no dnl AC_MSG_WARN([*** DVI loader will not be built (libdvi29 library not found) ***])) dnl if test x"$have_dvi" = xyes; then dnl AC_MSG_CHECKING([for libdvi29.h]) -dnl AC_TRY_CPP( -dnl [#include +dnl AC_PREPROC_IFELSE([AC_LANG_SOURCE([[dnl #include dnl #undef PACKAGE dnl #undef VERSION dnl #undef HAVE_STDLIB_H -dnl #include ], -dnl have_dvi=yes, -dnl have_dvi=no) +dnl #include ]])],[dnl have_dvi=yes],[dnl have_dvi=no]) dnl AC_MSG_RESULT($have_dvi) dnl if test x"$have_dvi" = xyes; then dnl LIBDVI='-ldvilib2' @@ -670,7 +677,7 @@ dnl AM_CONDITIONAL(ENABLE_DVI, test x$have_dvi = xyes) dnl ============= ps file handling -AC_ARG_ENABLE(ps, AC_HELP_STRING([--disable-ps], [Disable ps support.]), +AC_ARG_ENABLE(ps, AS_HELP_STRING([--disable-ps],[Disable ps support.]), [ if test x$enableval = xno ; then fim_handle_ps=no fi @@ -685,14 +692,11 @@ if test x$fim_handle_ps != xno ; then AC_MSG_WARN([*** PS loader will not be built (spectre library not found) ***]) , [$LIBSPECTRE_STATIC_EXTRA]) if test x"$have_ps" = xyes; then AC_MSG_CHECKING([for libspectre/spectre.h]) - AC_TRY_CPP( -[#include + AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include #undef PACKAGE #undef VERSION #undef HAVE_STDLIB_H -#include ], - have_ps=yes, - have_ps=no) +#include ]])],[have_ps=yes],[have_ps=no]) AC_MSG_RESULT($have_ps) if test x"$have_ps" = xyes; then LIBPS="-lspectre $LIBSPECTRE_STATIC_EXTRA" @@ -726,7 +730,7 @@ AM_CONDITIONAL(ENABLE_PS, test x$have_ps = xyes) dnl ============= djvu file handling -AC_ARG_ENABLE(djvu, AC_HELP_STRING([--disable-djvu], [Disable djvu support.]), +AC_ARG_ENABLE(djvu, AS_HELP_STRING([--disable-djvu],[Disable djvu support.]), [ if test x$enableval = xno ; then fim_handle_djvu=no fi @@ -741,14 +745,11 @@ if test x$fim_handle_djvu != xno ; then AC_MSG_WARN([*** DJVU loader will not be built (DJVU library not found) ***]), [$LIBDJVU_STATIC_EXTRA]) if test x"$have_djvu" = xyes; then AC_MSG_CHECKING([for libdjvu/ddjvuapi.h]) - AC_TRY_CPP( -[#include + AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include #undef PACKAGE #undef VERSION #undef HAVE_STDLIB_H -#include ], - have_djvu=yes, - have_djvu=no) +#include ]])],[have_djvu=yes],[have_djvu=no]) AC_MSG_RESULT($have_djvu) if test x"$have_djvu" = xyes; then LIBDJVU="-ldjvulibre $LIBDJVU_STATIC_EXTRA" @@ -784,7 +785,7 @@ dnl dnl By default, we disable poppler : its API is still immature. dnl fim_handle_pdf=no -AC_ARG_ENABLE(poppler, AC_HELP_STRING([--enable-poppler], [Enable poppler (PDF rendering) support. This will add LIBPOPPLER_CXXFLAGS="-I/usr/include/poppler/" to the compilation flags. You can override this by passing configure a suitable LIBPOPPLER_CXXFLAGS variable.]), +AC_ARG_ENABLE(poppler, AS_HELP_STRING([--enable-poppler],[Enable poppler (PDF rendering) support. This will add LIBPOPPLER_CXXFLAGS="-I/usr/include/poppler/" to the compilation flags. You can override this by passing configure a suitable LIBPOPPLER_CXXFLAGS variable.]), [ if test x$enableval = xyes ; then fim_handle_pdf=yes fi @@ -801,8 +802,7 @@ dnl FIXME : the following is a dirty hack AC_MSG_WARN([*** POPPLER loader will not be built (POPPLER library not found) ***]) ) if test x"$have_poppler" = xyes; then AC_MSG_CHECKING([for poppler/poppler-config.h]) - AC_TRY_CPP( - [#include + AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include #undef PACKAGE #undef VERSION #undef HAVE_STDLIB_H @@ -815,9 +815,7 @@ dnl FIXME : the following is a dirty hack #include #include #include /* globalParams lives here */ - ], - have_poppler=yes, - have_poppler=no) + ]])],[have_poppler=yes],[have_poppler=no]) have_poppler=yes AC_MSG_RESULT($have_poppler) if test x"$have_poppler" = xyes; then @@ -858,7 +856,7 @@ AM_CONDITIONAL(ENABLE_POPPLER, test x$have_poppler = xyes) dnl FIXME : we have two libpoppler checks ... : dnl ================== pdf checks =================================================== AC_ARG_ENABLE(pdf, - [AC_HELP_STRING([--enable-pdf], [Compile with pdf support])],enable_pdf="$enableval",enable_pdf=yes) + [AS_HELP_STRING([--enable-pdf],[Compile with pdf support])],enable_pdf="$enableval",enable_pdf=yes) if test "x$enable_pdf" = "xyes"; then POPPLER_REQUIRED=0.8.7 @@ -884,7 +882,7 @@ dnl ================== end of pdf checks ======================================= dnl ================================================================================ fim_handle_bmp=yes -AC_ARG_ENABLE(bmp, AC_HELP_STRING([--disable-bmp], [Disable BMP file support (enabled by default).]), +AC_ARG_ENABLE(bmp, AS_HELP_STRING([--disable-bmp],[Disable BMP file support (enabled by default).]), [ if test x$enableval = xno ; then fim_handle_bmp=no fi @@ -899,7 +897,7 @@ else fi dnl ================================================================================ fim_handle_pcx=yes -AC_ARG_ENABLE(pcx, AC_HELP_STRING([--disable-pcx], [Disable PCX file support (enabled by default).]), +AC_ARG_ENABLE(pcx, AS_HELP_STRING([--disable-pcx],[Disable PCX file support (enabled by default).]), [ if test x$enableval = xno ; then fim_handle_pcx=no fi @@ -916,12 +914,12 @@ dnl ============================================================================ ## png file handling -AC_ARG_WITH(png-prefix, AC_HELP_STRING([--with-png-prefix=PFX], [prefix where libpng is installed (optional)]), +AC_ARG_WITH(png-prefix, AS_HELP_STRING([--with-png-prefix=PFX],[prefix where libpng is installed (optional)]), libpng_config_prefix="$withval", libpng_config_prefix="") fim_handle_png=yes -AC_ARG_ENABLE(png, AC_HELP_STRING([--disable-png], [Disable png support.]), +AC_ARG_ENABLE(png, AS_HELP_STRING([--disable-png],[Disable png support.]), [ if test x$enableval = xno ; then fim_handle_png=no fi @@ -957,7 +955,7 @@ dnl ============================================================================ fim_handle_xyz=no -AC_ARG_ENABLE(xyz, AC_HELP_STRING([--enable-xyz], [Enable the sample bogus 'xyz' file loading support. This makes only sense in order to learn how to include a new file format and wish to play with src/FbiStuffXyz.cpp in the while.]), +AC_ARG_ENABLE(xyz, AS_HELP_STRING([--enable-xyz],[Enable the sample bogus 'xyz' file loading support. This makes only sense in order to learn how to include a new file format and wish to play with src/FbiStuffXyz.cpp in the while.]), [ if test x$enableval = xyes ; then fim_handle_xyz=yes fi @@ -976,7 +974,7 @@ dnl ============================================================================ fim_handle_ufraw=no -AC_ARG_ENABLE(ufraw, AC_HELP_STRING([--enable-ufraw], [Enable UFRaw support (EXPERIMENTAL).]), +AC_ARG_ENABLE(ufraw, AS_HELP_STRING([--enable-ufraw],[Enable UFRaw support (EXPERIMENTAL).]), [ if test x$enableval = xno ; then fim_handle_ufraw=no else @@ -999,7 +997,7 @@ dnl ============================================================================ fim_handle_archive=no -AC_ARG_ENABLE(archive, AC_HELP_STRING([--enable-archive], [Enable libarchive support (please provide ARCHIVE_LIBS, ARCHIVE_CXXFLAGS) (EXPERIMENTAL, UNFINISHED).]), +AC_ARG_ENABLE(archive, AS_HELP_STRING([--enable-archive],[Enable libarchive support (please provide ARCHIVE_LIBS, ARCHIVE_CXXFLAGS) (EXPERIMENTAL, UNFINISHED).]), [ if test x$enableval = xno ; then fim_handle_archive=no else @@ -1018,7 +1016,7 @@ fi dnl ================================================================================ AC_CHECK_LIB(exif, exif_data_new_from_data,have_libexif=yes,have_libexif=no) -AC_ARG_ENABLE(exif, AC_HELP_STRING([--disable-exif], [JPEG EXIF tags support with libexif.]), [if test x$enableval != xno; then fim_cv_libexif=yes; fi],[fim_cv_libexif=yes;]) +AC_ARG_ENABLE(exif, AS_HELP_STRING([--disable-exif],[JPEG EXIF tags support with libexif.]), [if test x$enableval != xno; then fim_cv_libexif=yes; fi],[fim_cv_libexif=yes;]) if test x$fim_cv_libexif = xyes; then if test x$have_libexif = xyes; then @@ -1036,7 +1034,7 @@ fi dnl ================================================================================ -AC_ARG_ENABLE(jasper, AC_HELP_STRING([--enable-jasper], [Turns on JPEG-2000 files support using JasPer (EXPERIMENTAL)]), +AC_ARG_ENABLE(jasper, AS_HELP_STRING([--enable-jasper],[Turns on JPEG-2000 files support using JasPer (EXPERIMENTAL)]), [if test x$enableval = xyes; then fim_cv_libjasper=yes; CXXFLAGS="$CXXFLAGS"; @@ -1056,7 +1054,7 @@ AC_ARG_ENABLE(jasper, AC_HELP_STRING([--enable-jasper], [Turns on JPEG-2000 file dnl ================================================================================ AC_CHECK_LIB(aa, aa_getfirst,fim_cv_libaa=yes,fim_cv_libaa=no) -AC_ARG_ENABLE(aa, AC_HELP_STRING([--disable-aa], [Ascii Art (-o aa) support (via aalib)]), [if test x$enableval != xno; then fim_cv_libaa=yes; else fim_cv_libaa=no; fi],[fim_cv_libaa=yes;]) +AC_ARG_ENABLE(aa, AS_HELP_STRING([--disable-aa],[Ascii Art (-o aa) support (via aalib)]), [if test x$enableval != xno; then fim_cv_libaa=yes; else fim_cv_libaa=no; fi],[fim_cv_libaa=yes;]) if test x$fim_cv_libaa != xno; then if test x$ac_cv_lib_aa_aa_getfirst = xyes; then AC_MSG_NOTICE([Enabling aalib driver.]) @@ -1091,18 +1089,18 @@ dnl ============================================================================ ## sdl driver -AC_ARG_WITH(sdl-prefix, AC_HELP_STRING([--with-sdl-prefix=PFX], [prefix where libsdl is installed (optional)]), +AC_ARG_WITH(sdl-prefix, AS_HELP_STRING([--with-sdl-prefix=PFX],[prefix where libsdl is installed (optional)]), libsdl_config_prefix="$withval", libsdl_config_prefix="") fim_handle_sdl='auto' -dnl AC_ARG_ENABLE(sdl, AC_HELP_STRING([--disable-sdl], [Disable libsdl support.]), +dnl AC_ARG_ENABLE(sdl, AS_HELP_STRING([--disable-sdl],[Disable libsdl support.]), dnl [ if test x$enableval = xno ; then dnl fim_handle_sdl=no dnl fi dnl ]) -AC_ARG_ENABLE(sdl, AC_HELP_STRING([--disable-sdl], [Disable libsdl support.]), +AC_ARG_ENABLE(sdl, AS_HELP_STRING([--disable-sdl],[Disable libsdl support.]), [ if test x$enableval = xyes ; then fim_handle_sdl=yes ; fi ] [ if test x$enableval = xno ; then fim_handle_sdl=no ; fi ]) @@ -1141,7 +1139,7 @@ dnl ============================================================================ AH_TEMPLATE([FIM_WANT_EXIFTOOL]) fim_cv_exiftool=no -AC_ARG_ENABLE(exiftool, AC_HELP_STRING([--enable-exiftool], [Turns on exiftool support (EXPERIMENTAL, shall provide the EXIFTOOLLINK variable with library or object files and EXIFTOOLCXXFLAGS)]), +AC_ARG_ENABLE(exiftool, AS_HELP_STRING([--enable-exiftool],[Turns on exiftool support (EXPERIMENTAL, shall provide the EXIFTOOLLINK variable with library or object files and EXIFTOOLCXXFLAGS)]), [if test x$enableval = xyes; then fim_cv_exiftool=yes CXXFLAGS="$CXXFLAGS $EXIFTOOLCXXFLAGS" @@ -1162,7 +1160,7 @@ dnl ================== fim_cv_autocommands=yes -AC_ARG_ENABLE(autocommands, AC_HELP_STRING([--disable-autocommands], [Fim will by default use autocommands.]), +AC_ARG_ENABLE(autocommands, AS_HELP_STRING([--disable-autocommands],[Fim will by default use autocommands.]), [if test x$enableval = xno; then fim_cv_autocommands=no fi]) @@ -1178,7 +1176,7 @@ fi dnl ================== -AC_ARG_ENABLE(hardcoded-font, AC_HELP_STRING([--enable-hardcoded-font], [Enable a hardcoded font in the executable (good as a fallback (FBFONT=fim://) when no PSF format consolefonts files are available).]), +AC_ARG_ENABLE(hardcoded-font, AS_HELP_STRING([--enable-hardcoded-font],[Enable a hardcoded font in the executable (good as a fallback (FBFONT=fim://) when no PSF format consolefonts files are available).]), [if test x$enableval = xyes; then fim_cv_hardcoded_font=yes; else @@ -1197,7 +1195,7 @@ AM_CONDITIONAL(FIM_WANT_HARDCODED_CONSOLEFONT, test x$have_hardcoded_font = xyes dnl ================== -AC_ARG_ENABLE(long-int-vars, AC_HELP_STRING([--enable-long-int-vars], [Internals shall use 64 bit integers (EXPERIMENTAL].), +AC_ARG_ENABLE(long-int-vars, AS_HELP_STRING([--enable-long-int-vars],[Internals shall use 64 bit integers (EXPERIMENTAL.]), [if test x$enableval = xyes; then fim_cv_want_int64_int=yes; else @@ -1214,7 +1212,7 @@ dnl ================== fim_cv_windows=yes -AC_ARG_ENABLE(windows, AC_HELP_STRING([--disable-windows], [Disable windowing system in Fim. (deprecated)]), +AC_ARG_ENABLE(windows, AS_HELP_STRING([--disable-windows],[Disable windowing system in Fim. (deprecated)]), [if test x$enableval = xno; then fim_cv_windows=no fi]) @@ -1231,7 +1229,7 @@ fi dnl ================== fim_cv_fimrc=yes -AC_ARG_ENABLE(fimrc, AC_HELP_STRING([--disable-fimrc], [Fim will by default load the ~/.fimrc file.]), +AC_ARG_ENABLE(fimrc, AS_HELP_STRING([--disable-fimrc],[Fim will by default load the ~/.fimrc file.]), [if test x$enableval = xno; then fim_cv_fimrc=no fi]) @@ -1247,7 +1245,7 @@ dnl ================== AH_TEMPLATE([FIM_NOHISTORY]) fim_cv_history=yes -AC_ARG_ENABLE(history, AC_HELP_STRING([--disable-history], [Fim will by default load/save a ~/.fim_history file.]), +AC_ARG_ENABLE(history, AS_HELP_STRING([--disable-history],[Fim will by default load/save a ~/.fim_history file.]), [if test x$enableval = xno; then fim_cv_history=no fi]) @@ -1262,7 +1260,7 @@ fi dnl ================== fim_cv_warnings=no -AC_ARG_ENABLE(screen, AC_HELP_STRING([--disable-screen], [Fim will try to work under screen by default (please read BUGS)]), +AC_ARG_ENABLE(screen, AS_HELP_STRING([--disable-screen],[Fim will try to work under screen by default (please read BUGS)]), [ if test x$enableval = xno; then fim_cv_screen=no else @@ -1274,7 +1272,7 @@ AC_ARG_ENABLE(screen, AC_HELP_STRING([--disable-screen], [Fim will try to work u dnl ================== fim_cv_resize_optimizations=yes -AC_ARG_ENABLE(resize-optimizations, AC_HELP_STRING([--disable-resize-optimizations], [Some old (fbi) code is optimized for speedup in fim.]), +AC_ARG_ENABLE(resize-optimizations, AS_HELP_STRING([--disable-resize-optimizations],[Some old (fbi) code is optimized for speedup in fim.]), [ if test x$enableval = xno; then fim_cv_resize_optimizations=no else @@ -1286,7 +1284,7 @@ AC_ARG_ENABLE(resize-optimizations, AC_HELP_STRING([--disable-resize-optimizatio dnl ================== fim_cv_read_stdin_image=yes -AC_ARG_ENABLE(stdin-image-reading, AC_HELP_STRING([--disable-stdin-image-reading], [Fim will read an image from stdin with the -i switch. (experimental)]), +AC_ARG_ENABLE(stdin-image-reading, AS_HELP_STRING([--disable-stdin-image-reading],[Fim will read an image from stdin with the -i switch. (experimental)]), [ if test x$enableval = xno; then fim_cv_read_stdin_image=no else @@ -1297,7 +1295,7 @@ AC_ARG_ENABLE(stdin-image-reading, AC_HELP_STRING([--disable-stdin-image-reading dnl ================== fim_cv_scan_consolefonts=yes -AC_ARG_ENABLE(scan-consolefonts, AC_HELP_STRING([--enable-scan-consolefonts], [Fim will scan some predefined directory in look for console fonts as a fallback. (experimental)]), +AC_ARG_ENABLE(scan-consolefonts, AS_HELP_STRING([--enable-scan-consolefonts],[Fim will scan some predefined directory in look for console fonts as a fallback. (experimental)]), [ if test x$enableval = xyes; then fim_cv_scan_consolefonts=yes else @@ -1307,7 +1305,7 @@ AC_ARG_ENABLE(scan-consolefonts, AC_HELP_STRING([--enable-scan-consolefonts], [F ) dnl ================== fim_cv_seek_magic=yes -AC_ARG_ENABLE(seek-magic, AC_HELP_STRING([--enable-seek-magic], [Fim will be capable to seek on a specified magic string. (experimental)]), +AC_ARG_ENABLE(seek-magic, AS_HELP_STRING([--enable-seek-magic],[Fim will be capable to seek on a specified magic string. (experimental)]), [ if test x$enableval = xyes; then fim_cv_seek_magic=yes else @@ -1316,7 +1314,7 @@ AC_ARG_ENABLE(seek-magic, AC_HELP_STRING([--enable-seek-magic], [Fim will be cap ],[ fim_cv_seek_magic=no ] ) dnl ================== -AC_ARG_ENABLE(pushdir, AC_HELP_STRING([--enable-pushdir], [Fim will scan directories for files.]), +AC_ARG_ENABLE(pushdir, AS_HELP_STRING([--enable-pushdir],[Fim will scan directories for files.]), [ if test x$enableval = xno; then fim_cv_read_dirs=no else @@ -1325,7 +1323,7 @@ AC_ARG_ENABLE(pushdir, AC_HELP_STRING([--enable-pushdir], [Fim will scan directo ],[ fim_cv_read_dirs=yes ] ) dnl ================== -AC_ARG_ENABLE(recursive-pushdir, AC_HELP_STRING([--disable-recursive-pushdir], [Fim will be able to push directories recursively (implies --enable-push-dirs )]), +AC_ARG_ENABLE(recursive-pushdir, AS_HELP_STRING([--disable-recursive-pushdir],[Fim will be able to push directories recursively (implies --enable-push-dirs )]), [ if test x$enableval = xyes; then fim_cv_recursive_dirs=yes; fim_cv_read_dirs=yes; @@ -1387,7 +1385,7 @@ fi dnl ================== fim_cv_warnings=no -AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [Turns on debug options (recommended for debugging)]), +AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug],[Turns on debug options (recommended for debugging)]), [if test x$enableval = xyes; then fim_cv_debug=yes fi]) @@ -1395,7 +1393,7 @@ fi]) dnl ================== fim_cv_warnings=no -AC_ARG_ENABLE(warnings, AC_HELP_STRING([--enable-warnings], [Turns on compiler warnings (recommended, for debugging)]), +AC_ARG_ENABLE(warnings, AS_HELP_STRING([--enable-warnings],[Turns on compiler warnings (recommended, for debugging)]), [if test x$enableval = xyes; then fim_cv_warnings=yes fi]) @@ -1419,7 +1417,7 @@ dnl ================== fim_cv_cacalib=no -AC_ARG_ENABLE(cacalib, AC_HELP_STRING([--enable-cacalib], [Turns on cacalib support (STILL INCOMPLETE)]), +AC_ARG_ENABLE(cacalib, AS_HELP_STRING([--enable-cacalib],[Turns on cacalib support (STILL INCOMPLETE)]), [if test x$enableval = xyes; then if test x$have_cacalib = xyes; then fim_cv_cacalib=yes @@ -1433,8 +1431,7 @@ AC_ARG_ENABLE(cacalib, AC_HELP_STRING([--enable-cacalib], [Turns on cacalib supp dnl ================== # This code still awaits for integration ... -AC_ARG_WITH(cflags, AC_HELP_STRING([--with-cflags=CXXFLAGS], - [Specify a custom CXXFLAGS append value. e.g.: -pg +AC_ARG_WITH(cflags, AS_HELP_STRING([--with-cflags=CXXFLAGS],[Specify a custom CXXFLAGS append value. e.g.: -pg You cannot call this argument multiple times. In case you want completely reset CXXFLAGS use : CXXFLAGS='' ./configure .. @@ -1456,7 +1453,7 @@ AC_ARG_WITH(cflags, AC_HELP_STRING([--with-cflags=CXXFLAGS], dnl ================== # This code still awaits for integration ... -AC_ARG_WITH(exec-shell, AC_HELP_STRING([--with-exec-shell=SHELL], [Specify alternate shell (ONLY if /bin/sh is broken)]), +AC_ARG_WITH(exec-shell, AS_HELP_STRING([--with-exec-shell=SHELL],[Specify alternate shell (ONLY if /bin/sh is broken)]), [if test x$withval != xyes; then AC_DEFINE_UNQUOTED(EXECSHELL, "$withval", [program to use for shell commands]) @@ -1466,7 +1463,7 @@ AC_ARG_WITH(exec-shell, AC_HELP_STRING([--with-exec-shell=SHELL], [Specify alter [AC_DEFINE_UNQUOTED(EXECSHELL, "/bin/sh")]) dnl ================== -AC_ARG_ENABLE(convert, AC_HELP_STRING([--disable-smartautocompletion], [Fim will treat as a proper, unescaped string, nonquoted and nonevaluated strings which happen to match an existing filename.]), +AC_ARG_ENABLE(convert, AS_HELP_STRING([--disable-smartautocompletion],[Fim will treat as a proper, unescaped string, nonquoted and nonevaluated strings which happen to match an existing filename.]), [ if test x$enableval = xno; then fim_cv_smartautcompletion=no else @@ -1484,7 +1481,7 @@ if test x$fim_cv_scan_consolefonts = xyes; then fi dnl ================== -AC_ARG_ENABLE(convert, AC_HELP_STRING([--disable-convert], [Fim will try to use convert (ImageMagick) as a last resort for opening unknown format files.]), +AC_ARG_ENABLE(convert, AS_HELP_STRING([--disable-convert],[Fim will try to use convert (ImageMagick) as a last resort for opening unknown format files.]), [ if test x$enableval = xno; then fim_cv_convert=no else @@ -1497,7 +1494,7 @@ AC_ARG_ENABLE(convert, AC_HELP_STRING([--disable-convert], [Fim will try to use dnl ================== -AC_ARG_ENABLE(xcftopnm, AC_HELP_STRING([--disable-xcftopnm], [Fim will try to use xcftopnm (Gimp) for opening XCF format files.]), +AC_ARG_ENABLE(xcftopnm, AS_HELP_STRING([--disable-xcftopnm],[Fim will try to use xcftopnm (Gimp) for opening XCF format files.]), [ if test x$enableval = xno; then fim_cv_xcftopnm=no else @@ -1509,7 +1506,7 @@ AC_ARG_ENABLE(xcftopnm, AC_HELP_STRING([--disable-xcftopnm], [Fim will try to us dnl ================== fim_cv_inkscape=yes -AC_ARG_ENABLE(inkscape, AC_HELP_STRING([--disable-inkscape], [Fim will try to use Inkscape for opening SVG format files.]), +AC_ARG_ENABLE(inkscape, AS_HELP_STRING([--disable-inkscape],[Fim will try to use Inkscape for opening SVG format files.]), [ if test x$enableval = xno; then fim_cv_inkscape=no else @@ -1520,7 +1517,7 @@ AC_ARG_ENABLE(inkscape, AC_HELP_STRING([--disable-inkscape], [Fim will try to us dnl ================== -AC_ARG_ENABLE(xfig, AC_HELP_STRING([--disable-xfig], [Fim will try to use xfig (fig2dev) for opening FIG format files.]), +AC_ARG_ENABLE(xfig, AS_HELP_STRING([--disable-xfig],[Fim will try to use xfig (fig2dev) for opening FIG format files.]), [ if test x$enableval = xno; then fim_cv_xfig=no else @@ -1531,7 +1528,7 @@ AC_ARG_ENABLE(xfig, AC_HELP_STRING([--disable-xfig], [Fim will try to use xfig ( dnl ================== -AC_ARG_ENABLE(dia, AC_HELP_STRING([--disable-dia], [Fim will try to use dia for opening DIA format files.]), +AC_ARG_ENABLE(dia, AS_HELP_STRING([--disable-dia],[Fim will try to use dia for opening DIA format files.]), [ if test x$enableval = xno; then fim_cv_dia=no else @@ -1542,19 +1539,19 @@ AC_ARG_ENABLE(dia, AC_HELP_STRING([--disable-dia], [Fim will try to use dia for dnl ================== AH_TEMPLATE([FIM_DEFAULT_CONSOLEFONT]) -AC_ARG_WITH(default-consolefont, AC_HELP_STRING([--with-default-consolefont=FILE], [Specify a default consolefont (psf or psf.gz format) file.]), [ AC_DEFINE_UNQUOTED(FIM_DEFAULT_CONSOLEFONT, "$withval") ], [fim_cv_defaultconsolefont=""]) +AC_ARG_WITH(default-consolefont, AS_HELP_STRING([--with-default-consolefont=FILE],[Specify a default consolefont (psf or psf.gz format) file.]), [ AC_DEFINE_UNQUOTED(FIM_DEFAULT_CONSOLEFONT, "$withval") ], [fim_cv_defaultconsolefont=""]) dnl ================== -AC_ARG_WITH(custom-hardcoded-consolefont, AC_HELP_STRING([--with-custom-hardcoded-consolefont=FILE], [Specify a custom consolefont to be hardcoded (uncompressed psf format, absolute path) at build time (requires --enable-hardcoded-font).]), [ +AC_ARG_WITH(custom-hardcoded-consolefont, AS_HELP_STRING([--with-custom-hardcoded-consolefont=FILE],[Specify a custom consolefont to be hardcoded (uncompressed psf format, absolute path) at build time (requires --enable-hardcoded-font).]), [ fim_cv_want_custom_hardcoded_consolefont=true; AC_SUBST(FIM_CUSTOM_HARDCODED_CONSOLEFONT, "$withval") ], []) AM_CONDITIONAL(FIM_WANT_CUSTOM_HARDCODED_CONSOLEFONT, test x$fim_cv_want_custom_hardcoded_consolefont = xtrue ) dnl ================== -AC_ARG_WITH(tmpfile, AC_HELP_STRING([--with-tmpfile=FILE], [Specify where to put temporary files created when interacting with external conversion programs (default is "/tmp/__FIM_TEMPORARY_FILE").]), +AC_ARG_WITH(tmpfile, AS_HELP_STRING([--with-tmpfile=FILE],[Specify where to put temporary files created when interacting with external conversion programs (default is "/tmp/__FIM_TEMPORARY_FILE").]), [fim_cv_tmpfile=$withval], [fim_cv_tmpfile="/tmp/__FIM_TEMPORARY_FILE"]) dnl ================== -AC_ARG_ENABLE(custom-status-bar, AC_HELP_STRING([--disable-custom-status-bar], [Customization of status bar via a printf-like string.]), +AC_ARG_ENABLE(custom-status-bar, AS_HELP_STRING([--disable-custom-status-bar],[Customization of status bar via a printf-like string.]), [ if test x$enableval = xno; then fim_cv_custom_status_bar=no; else @@ -1564,7 +1561,7 @@ AC_ARG_ENABLE(custom-status-bar, AC_HELP_STRING([--disable-custom-status-bar], [ ) dnl ================== -AC_ARG_ENABLE(optimizations, AC_HELP_STRING([--enable-optimizations], [Will try to enhance compilation flags (EXPERIMENTAL)]), +AC_ARG_ENABLE(optimizations, AS_HELP_STRING([--enable-optimizations],[Will try to enhance compilation flags (EXPERIMENTAL)]), [ if test x$enableval = xno; then fim_cv_optimizations=no else @@ -1722,23 +1719,23 @@ dnl ================== dnl ================== AH_TEMPLATE([FIM_WANT_FILENAME_MARK_AND_DUMP]) -AC_ARG_ENABLE(mark-and-dump, AC_HELP_STRING([--enable-mark-and-dump], [Fim will be capable of marking files while viewing and outputting their names on exit. (enabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_mark_and_dump=1 ; else fim_cv_want_mark_and_dump=0 ; fi ],[ fim_cv_want_mark_and_dump=1 ]) +AC_ARG_ENABLE(mark-and-dump, AS_HELP_STRING([--enable-mark-and-dump],[Fim will be capable of marking files while viewing and outputting their names on exit. (enabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_mark_and_dump=1 ; else fim_cv_want_mark_and_dump=0 ; fi ],[ fim_cv_want_mark_and_dump=1 ]) AC_DEFINE_UNQUOTED([FIM_WANT_FILENAME_MARK_AND_DUMP], $fim_cv_want_mark_and_dump, [Fim will be capable of marking files while viewing and outputting their names on exit.]) dnl ================== AH_TEMPLATE([FIM_WANT_NOSCRIPTING]) -AC_ARG_ENABLE(scripting, AC_HELP_STRING([--enable-scripting], [Scripting. (enabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_noscripting=0 ; else fim_cv_want_noscripting=1 ; fi ],[ fim_cv_want_noscripting=0 ]) +AC_ARG_ENABLE(scripting, AS_HELP_STRING([--enable-scripting],[Scripting. (enabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_noscripting=0 ; else fim_cv_want_noscripting=1 ; fi ],[ fim_cv_want_noscripting=0 ]) if test x$fim_cv_want_noscripting == x1 ; then AC_DEFINE_UNQUOTED([FIM_WANT_NOSCRIPTING], $fim_cv_want_noscripting, [Scripting. (enabled by default)]) fi dnl ================== AH_TEMPLATE([FIM_WANT_NO_OUTPUT_CONSOLE]) -AC_ARG_ENABLE(output-console, AC_HELP_STRING([--enable-output-console], [Output console. (enabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_no_output_console=0 ; else fim_cv_want_no_output_console=1 ; fi ],[ fim_cv_want_no_output_console=0 ]) +AC_ARG_ENABLE(output-console, AS_HELP_STRING([--enable-output-console],[Output console. (enabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_no_output_console=0 ; else fim_cv_want_no_output_console=1 ; fi ],[ fim_cv_want_no_output_console=0 ]) if test x$fim_cv_want_no_output_console == x1 ; then AC_DEFINE_UNQUOTED([FIM_WANT_NO_OUTPUT_CONSOLE], $fim_cv_want_no_output_console, [Output console. (enabled by default)]) fi dnl ================== AH_TEMPLATE([FIM_WANT_UNICODE]) -AC_ARG_ENABLE(unicode, AC_HELP_STRING([--enable-unicode], [Unicode. (disabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_unicode=1 ; else fim_cv_want_unicode=0 ; fi ],[ fim_cv_want_unicode=0 ]) +AC_ARG_ENABLE(unicode, AS_HELP_STRING([--enable-unicode],[Unicode. (disabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_unicode=1 ; else fim_cv_want_unicode=0 ; fi ],[ fim_cv_want_unicode=0 ]) if test x$fim_cv_want_unicode == x1 ; then # CXXFLAGS="$CXXFLAGS `freetype-config --cflags`" # LIBS="$LIBS `freetype-config --libs`" @@ -1747,7 +1744,7 @@ fi dnl ================== AH_TEMPLATE([FIM_WANT_TEXT_RENDERING]) fim_want_astext=yes -AC_ARG_ENABLE(as-text-rendering, AC_HELP_STRING([--disable-as-text-rendering], [Disable as-text rendering (viewing of any file as character bytes -- not to be confused with the ASCII art output).]), +AC_ARG_ENABLE(as-text-rendering, AS_HELP_STRING([--disable-as-text-rendering],[Disable as-text rendering (viewing of any file as character bytes -- not to be confused with the ASCII art output).]), [ if test x$enableval = xno ; then fim_want_astext=no fi @@ -1758,7 +1755,7 @@ fi dnl ================== AH_TEMPLATE([FIM_WANT_RAW_BITS_RENDERING]) fim_want_rbr=yes -AC_ARG_ENABLE(raw-bits-rendering, AC_HELP_STRING([--disable-raw-bits-rendering], [Disable raw bits rendering (viewing of any file as either a 1 or 24 bpp bitmap).]), +AC_ARG_ENABLE(raw-bits-rendering, AS_HELP_STRING([--disable-raw-bits-rendering],[Disable raw bits rendering (viewing of any file as either a 1 or 24 bpp bitmap).]), [ if test x$enableval = xno ; then fim_want_rbr=no fi @@ -1769,7 +1766,7 @@ fi dnl ================== AH_TEMPLATE([FIM_ALLOW_LOADER_STRING_SPECIFICATION]) fim_want_lss=yes -AC_ARG_ENABLE(loader-string-specification, AC_HELP_STRING([--disable-loader-string-specification], [Disables the chance to specify a file loader.]), +AC_ARG_ENABLE(loader-string-specification, AS_HELP_STRING([--disable-loader-string-specification],[Disables the chance to specify a file loader.]), [ if test x$enableval = xno ; then fim_want_lss=no fi @@ -1851,7 +1848,7 @@ AC_DEFINE([FBI_AUTHOR],["Gerd Hoffmann "]) dnl ############################################################################### dnl this is experimental stuff dnl ############################################################################### -AC_ARG_ENABLE(matrices-rendering, AC_HELP_STRING([--enable-matrices-rendering], [Uses librsb for rendering of Matrix Market files (must have librsb-config in the PATH).]), +AC_ARG_ENABLE(matrices-rendering, AS_HELP_STRING([--enable-matrices-rendering],[Uses librsb for rendering of Matrix Market files (must have librsb-config in the PATH).]), [ if test x$enableval = xyes; then if test x$ac_cv_func_rsb_lib_init = xyes; then AH_TEMPLATE([HAVE_MATRIX_MARKET_DECODER]) @@ -1881,12 +1878,13 @@ AC_SUBST(CXXFLAGS) #AC_CONFIG_FILES([Makefile],[src/Makefile]) -AC_OUTPUT(Makefile src/Makefile doc/Makefile distros/Makefile scripts/Makefile +AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile distros/Makefile scripts/Makefile scripts/maintenance/cron-build.sh scripts/maintenance/remote-build.sh scripts/maintenance/cron-svndump.pl scripts/maintenance/cron-rsync.sh - ) + ]) +AC_OUTPUT #AC_OUTPUT AC_MSG_NOTICE([ -- cgit v1.2.3 From 786fedf7389239107658186c8e6da10c0c0e776c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Laboissi=C3=A8re?= Date: Sun, 21 Nov 2021 04:56:05 -0300 Subject: Honor the CPPFLAGS environment variable Forwarded: https://savannah.nongnu.org/bugs/index.php?61478 Last-Update: 2021-11-14 This is required in Debian, such that hardening flags like -D_FORTIFY_SOURCE=2 are used in the compilation of C++ files. Gbp-Pq: Name honor-cppflags.patch --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 64ecc07..11c624c 100644 --- a/configure.ac +++ b/configure.ac @@ -79,7 +79,7 @@ AM_INIT_AUTOMAKE #AM_INIT_AUTOMAKE(fim, $fim_cv_version) #AM_INIT_AUTOMAKE(fim, 1.0) AC_SUBST([CONFIG_STATUS_DEPENDENCIES], ['$(top_srcdir)/VERSION']) -CPPFLAGS='' +#CPPFLAGS='' AC_SUBST(FIM_LIBS) -- cgit v1.2.3 From 875d223670b6a11469907a9027185af5d67ae217 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Laboissi=C3=A8re?= Date: Sun, 21 Nov 2021 04:56:05 -0300 Subject: Commit patch to update .gitignore [dgit (9.14) update-gitignore-quilt-fixup] --- debian/patches/auto-gitignore | 52 +++++++++++++++++++++++++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 53 insertions(+) create mode 100644 debian/patches/auto-gitignore diff --git a/debian/patches/auto-gitignore b/debian/patches/auto-gitignore new file mode 100644 index 0000000..8a79671 --- /dev/null +++ b/debian/patches/auto-gitignore @@ -0,0 +1,52 @@ +Subject: Update .gitignore from Debian packaging branch + +The Debian packaging git branch contains these updates to the upstream +.gitignore file(s). This patch is autogenerated, to provide these +updates to users of the official Debian archive view of the package. + +[dgit (9.14) update-gitignore] +--- +diff --git a/.gitignore b/.gitignore +new file mode 100644 +index 0000000..73185d7 +--- /dev/null ++++ b/.gitignore +@@ -0,0 +1,38 @@ ++/.pc/ ++/Makefile ++/autom4te.cache/ ++/compile ++/config.h ++/config.h.in~ ++/config.log ++/config.status ++/debian/.debhelper/ ++/debian/autoreconf.* ++/debian/debhelper-build-stamp ++/debian/files ++/debian/fim.debhelper.log ++/debian/fim.substvars ++/debian/fim/ ++/distros/Makefile ++/doc/Makefile ++/doc/doctags ++/doc/tags ++/scripts/Makefile ++/scripts/maintenance/cron-build.sh ++/scripts/maintenance/cron-rsync.sh ++/scripts/maintenance/cron-svndump.pl ++/scripts/maintenance/remote-build.sh ++/src/*.o ++/src/b2ba ++/src/conf.h ++/src/config.h.in ++/src/fim ++/src/Makefile ++/src/lex.yy.cc ++/src/yacc.output ++/src/yacc.tab.cpp ++/src/yacc.tab.hpp ++/src/yacc.tab.o ++/stamp-h1 ++/src/testdir/*.out ++/src/testdir/test.log diff --git a/debian/patches/series b/debian/patches/series index 97797f6..4bf0196 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -3,3 +3,4 @@ reproducible-build.patch compile-with-gcc-10.patch update-configure-ac.patch honor-cppflags.patch +auto-gitignore -- cgit v1.2.3 From 0349b17e10c3c1aba6115e6ab34e8fef70678f38 Mon Sep 17 00:00:00 2001 From: Rafael Laboissiere Date: Sun, 4 Dec 2022 12:38:59 -0300 Subject: Adjust code for compilation against GCC 9 Forwarded: https://savannah.nongnu.org/bugs/index.php?58792 Last-Update: 2019-07-13 Gbp-Pq: Name compile-with-gcc-9.patch --- src/Var.h | 2 +- src/fim_types.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Var.h b/src/Var.h index 1339ac1..1c06c47 100644 --- a/src/Var.h +++ b/src/Var.h @@ -175,7 +175,7 @@ class Var if(sizeof(fim_int)==sizeof(int)) sprintf(buf,"%d",(int)i); else - sprintf(buf,"%lld",(int64_t)i); + sprintf(buf,"%ld",(int64_t)i); } else if(type=='f') diff --git a/src/fim_types.h b/src/fim_types.h index 3c66422..711366b 100644 --- a/src/fim_types.h +++ b/src/fim_types.h @@ -64,7 +64,7 @@ typedef int fim_var_t; /* a type for fim's variable types */ typedef int fim_str_t; /* a type for stdin/stdout streams */ typedef int fim_sys_int; /* always int */ - typedef int fim_color_t; /* >= 4 bytes */ + typedef unsigned int fim_color_t; /* >= 4 bytes */ typedef int fim_ts_t; /* a type for time, in seconds */ typedef int fim_tms_t; /* a type for time, in milliseconds */ -- cgit v1.2.3 From 1736f5d6c1bff8bc4d2fe117a75b2309467c6433 Mon Sep 17 00:00:00 2001 From: Chris Lamb Date: Sun, 4 Dec 2022 12:38:59 -0300 Subject: Make the build reproducible MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Forwarded: https://savannah.nongnu.org/bugs/index.php?58793 Reviewed-by: Rafael Laboissière Last-Update: 2019-04-29 Gbp-Pq: Name reproducible-build.patch --- src/Makefile.am | 1 - src/fim.cpp | 7 ------- 2 files changed, 8 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 7a4fdfb..f82e4f8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -51,7 +51,6 @@ version.h: ../config.h $(ECHO) "\"\n\"" >> $@ $(GREP) define $< | $(GREP) FIM.*'"' | LC_ALL=C $(SORT) | $(SED) 's/^#//g;s/define //g;s/^\([A-Za-z0-9_]*\) "\(.*\)"$$/"\1 = \\"\2\\"\\n"/g' >> $@ $(GREP) undef $< | $(GREP) FIM | LC_ALL=C $(SORT) | $(SED) 's/^#//g;s/.*undef //g;s/^\([A-Za-z0-9_]*\).\+$$/-\1 /g;s/^/\"/g;s/$$/\"/g' >> $@ - $(ECHO) '"\n'CXXFLAGS=$(CXXFLAGS)'\n"' >> $@ help.cpp: fim.h $(ECHO) -e "#ifdef FIM_WANT_INLINE_HELP\n" > $@ diff --git a/src/fim.cpp b/src/fim.cpp index c6ba3fd..a2257af 100644 --- a/src/fim.cpp +++ b/src/fim.cpp @@ -1603,13 +1603,6 @@ fim_perr_t main(int argc,char *argv[]) #ifdef FIM_CONFIGURATION "Configuration invocation: " FIM_CONFIGURATION "\n" #endif /* FIM_CONFIGURATION */ - #ifdef CXXFLAGS - "Compile flags: CXXFLAGS=" CXXFLAGS - #ifdef CFLAGS - " CFLAGS=" CFLAGS - #endif /* CFLAGS */ - "\n" - #endif /* CXXFLAGS */ "Fim options (features included (+) or not (-)):\n" #include "version.h" /* i think some flags are missing .. */ -- cgit v1.2.3 From 601a9b12ccdc39f4617af9c6c274330f389ad444 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Laboissi=C3=A8re?= Date: Sun, 4 Dec 2022 12:38:59 -0300 Subject: Compile with GCC 10 Bug-Debian: https://bugs.debian.org/957202 Forwarded: https://savannah.nongnu.org/bugs/index.php?58399#comment1 Last-Update: 2020-07-20 This patch remove a non-active code (inside "#if 0") in file src/fim.cpp which, according to the upstream author, contains "leftovers from the old man file". This removal seems harmless and allows the package to be built with GCC 10. Gbp-Pq: Name compile-with-gcc-10.patch --- src/fim.cpp | 56 -------------------------------------------------------- 1 file changed, 56 deletions(-) diff --git a/src/fim.cpp b/src/fim.cpp index a2257af..e777d24 100644 --- a/src/fim.cpp +++ b/src/fim.cpp @@ -302,62 +302,6 @@ FIM_NULL {0,0,0,0,0,0} }; -#if 0 -// leftovers from the old man file; shall adapt these using .\" - .TP - .B -f font - Set font. This can be either a pcf console font file or a X11 font - spec. Using X11 fonts requires a font server (The one specified in - the environment variable FONTSERVER or on localhost). The FBFONT - environment variable is used as default. If unset, fim will - fallback to 10x20 (X11) / lat1u-16.psf (console). - .TP - .B --autoup - Like autozoom, but scale up only. - .TP - .B --autodown - Like autozoom, but scale down only. - .TP - .B -u - Randomize the order of the filenames. - .TP - .B -e - Enable editing commands. - .TP - .B -b - create backup files (when editing images). - .TP - .B -p - preserve timestamps (when editing images). - .TP - .B --comments - Display comment tags (if present) instead of the filename. Probaby - only useful if you added reasonable comments yourself (using wrjpgcom - for example), otherwise you likely just find texts pointing to the - software which created the image. - P pause the slideshow (if started with -t, toggle) - {number}g jump to image {number} - .SH EDIT IMAGE - fim also provides some very basic image editing facilities. You have - to start fim with the -e switch to use them. - .P - .nf - Shift+D delete image - R rotate 90° clockwise - L rotate 90° counter-clock wise - .fi - .P - The delete function actually wants a capital letter 'D', thus you have - to type Shift+D. This is done to avoid deleting images by mistake - because there are no safety bells: If you ask fim to delete the image, - it will be deleted without questions asked. - .P - The rotate function actually works for JPEG images only because it - calls the jpegtran command to perform a lossless rotation if the image. - It is especially useful if you review the images of your digital - camera. -#endif - const int fim_options_count=sizeof(fim_options)/sizeof(fim_options_t); struct option options[fim_options_count]; -- cgit v1.2.3 From 628f9eaf75125196b231e0ee6ff6a67d59d305bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Laboissi=C3=A8re?= Date: Sun, 4 Dec 2022 12:38:59 -0300 Subject: Update configure.ac Forwarded: https://savannah.nongnu.org/bugs/?60900 Last-Update: 2021-07-09 This patch is the result of running autoupdate Gbp-Pq: Name update-configure-ac.patch --- configure.ac | 236 +++++++++++++++++++++++++++++------------------------------ 1 file changed, 117 insertions(+), 119 deletions(-) diff --git a/configure.ac b/configure.ac index b600f50..64ecc07 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,10 @@ dnl Process this file with autoconf to produce a configure script. dnl $LastChangedDate: 2017-07-19 15:46:18 +0200 (Wed, 19 Jul 2017) $ -AC_PREREQ([2.54]) +AC_PREREQ([2.71]) # we'll move forward, one day or another -#AC_PREREQ([2.61]) +#AC_PREREQ([2.71]) # for future use, too #AC_PROG_CC(cc gcc) @@ -46,7 +46,7 @@ AC_MSG_NOTICE([ # #AM_INIT_AUTOMAKE($PACKAGE_NAME, $PACKAGE_VERSION) -AC_GNU_SOURCE +AC_USE_SYSTEM_EXTENSIONS #AC_MANTAINER_MODE #AC_CANONICAL_HOST @@ -97,7 +97,7 @@ else fi AC_MSG_RESULT($fim_cv_prefix) -AC_ISC_POSIX +AC_SEARCH_LIBS([strerror],[cposix]) #AM_C_PROTOTYPES if test "x$U" != "x"; then AC_MSG_ERROR(Compiler not ANSI compliant) @@ -122,7 +122,7 @@ AC_CHECK_FUNC([rsb_lib_init]) AC_CHECK_LIB([m],[pow]) AC_CHECK_LIB([fl],[yylex]) -AC_ARG_ENABLE(graphicsmagick, AC_HELP_STRING([--enable-graphicsmagick], [Enable GraphicsMagick library support (EXPERIMENTAL).]), [ if test x$enableval != xno ; then fim_handle_graphicsmagick=yes ; fi ] ) +AC_ARG_ENABLE(graphicsmagick, AS_HELP_STRING([--enable-graphicsmagick],[Enable GraphicsMagick library support (EXPERIMENTAL).]), [ if test x$enableval != xno ; then fim_handle_graphicsmagick=yes ; fi ] ) AC_CHECK_LIB([GraphicsMagick],[GetMagickVersion], [ if test x"$fim_handle_graphicsmagick" = x"yes" ; then @@ -133,7 +133,7 @@ if test x"$fim_handle_graphicsmagick" = x"yes" ; then fi ], []) -AC_ARG_ENABLE(imlib2, AC_HELP_STRING([--enable-imlib2], [Enable Imlib2 library support (EXPERIMENTAL,INCOMPLETE).]), [ if test x$enableval != xno ; then fim_handle_imlib2=yes ; fi ] ) +AC_ARG_ENABLE(imlib2, AS_HELP_STRING([--enable-imlib2],[Enable Imlib2 library support (EXPERIMENTAL,INCOMPLETE).]), [ if test x$enableval != xno ; then fim_handle_imlib2=yes ; fi ] ) AC_CHECK_LIB([Imlib2],[imlib_create_image], [ if test x"$fim_handle_imlib2" = x"yes" ; then @@ -187,7 +187,7 @@ have_default_bindings=yes have_default_mapping=yes have_default_config=yes -AC_ARG_ENABLE(default_bindings, AC_HELP_STRING([--disable-default-bindings], [Builtin default minimal key binding]), +AC_ARG_ENABLE(default_bindings, AS_HELP_STRING([--disable-default-bindings],[Builtin default minimal key binding]), [ if test x$enableval = xyes; then have_default_bindings=yes else @@ -195,7 +195,7 @@ AC_ARG_ENABLE(default_bindings, AC_HELP_STRING([--disable-default-bindings], [Bu fi ]) -AC_ARG_ENABLE(default_mapping, AC_HELP_STRING([--disable-default-mapping], [Builtin default minimal key mapping]), +AC_ARG_ENABLE(default_mapping, AS_HELP_STRING([--disable-default-mapping],[Builtin default minimal key mapping]), [ if test x$enableval = xyes; then have_default_mapping=yes else @@ -203,7 +203,7 @@ AC_ARG_ENABLE(default_mapping, AC_HELP_STRING([--disable-default-mapping], [Buil fi ]) -AC_ARG_ENABLE(default_config, AC_HELP_STRING([--disable-default-config], [Builtin default minimal configuration]), +AC_ARG_ENABLE(default_config, AS_HELP_STRING([--disable-default-config],[Builtin default minimal configuration]), [ if test x$enableval = xyes; then have_default_config=yes else @@ -234,14 +234,14 @@ AC_ARG_ENABLE(default_config, AC_HELP_STRING([--disable-default-config], [Builti #AC_SUBST(LIBPNG_CXXFLAGS) #AC_SUBST(LIBPNG_LIBS) -AC_ARG_ENABLE(system, AC_HELP_STRING([--disable-system], [Disable system() and pipe() calls.]), +AC_ARG_ENABLE(system, AS_HELP_STRING([--disable-system],[Disable system() and pipe() calls.]), [ if test x$enableval = xno ; then fim_system_calls=no fi ]) dnl new: -AC_ARG_ENABLE(framebuffer, AC_HELP_STRING([--disable-framebuffer], [Disable the framebuffer device driver.]), +AC_ARG_ENABLE(framebuffer, AS_HELP_STRING([--disable-framebuffer],[Disable the framebuffer device driver.]), [ if test x$enableval = xno ; then fim_handle_framebuffer=no fi @@ -263,7 +263,15 @@ if test x$fim_handle_framebuffer = xno ; then AC_DEFINE(FIM_WITH_NO_FRAMEBUFFER, 1, [Defined when framebuffer device support is turned off.]) fi -AC_HEADER_STDC +m4_warn([obsolete], +[The preprocessor macro `STDC_HEADERS' is obsolete. + Except in unusual embedded environments, you can safely include all + ISO C90 headers unconditionally.])dnl +# Autoupdate added the next two lines to ensure that your configure +# script's behavior did not change. They are probably safe to remove. +AC_CHECK_INCLUDES_DEFAULT +AC_PROG_EGREP + AC_FUNC_MMAP AC_CHECK_FUNCS([bzero memset memcmp strncmp strcpy]) @@ -320,11 +328,23 @@ dnl fi dnl AC_CHECK_FUNCS(setrlimit getsid) -AC_TYPE_SIGNAL +m4_warn([obsolete], +[your code may safely assume C89 semantics that RETSIGTYPE is void. +Remove this warning and the `AC_CACHE_CHECK' when you adjust the code.])dnl +AC_CACHE_CHECK([return type of signal handlers],[ac_cv_type_signal],[AC_COMPILE_IFELSE( +[AC_LANG_PROGRAM([#include +#include +], + [return *(signal (0, 0)) (0) == 1;])], + [ac_cv_type_signal=int], + [ac_cv_type_signal=void])]) +AC_DEFINE_UNQUOTED([RETSIGTYPE],[$ac_cv_type_signal],[Define as the return type of signal handlers + (`int' or `void').]) + dnl ================== AH_TEMPLATE([FIM_WANT_STATIC_BINARY]) -AC_ARG_ENABLE(static, AC_HELP_STRING([--enable-static], [Want a static binary. (disabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_static=1 ; else fim_cv_want_static=0 ; fi ],[ fim_cv_want_static=0 ]) +AC_ARG_ENABLE(static, AS_HELP_STRING([--enable-static],[Want a static binary. (disabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_static=1 ; else fim_cv_want_static=0 ; fi ],[ fim_cv_want_static=0 ]) if test x$fim_cv_want_static == x1 ; then LIBS="$LIBS --static" LIBDJVU_STATIC_EXTRA="-lpthread" @@ -339,20 +359,19 @@ fi dnl ================== -AC_ARG_WITH(regex, AC_HELP_STRING([--with-regex], [Use the GNU regex library instead of the POSIX one]), +AC_ARG_WITH(regex, AS_HELP_STRING([--with-regex],[Use the GNU regex library instead of the POSIX one]), [fim_cv_regex=yes], [AC_CHECK_FUNCS(regcomp, fim_cv_regex=no, fim_cv_regex=yes)]) if test X$fim_cv_regex = Xno ; then AC_CACHE_CHECK([whether your system regexp library is completely broken], [fim_cv_regex_broken], - AC_TRY_RUN([ + AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include #include -int main() { regex_t blah ; regmatch_t p; p.rm_eo = p.rm_eo; return regcomp(&blah, "foo.*bar", REG_NOSUB) || regexec (&blah, "foobar", 0, NULL, 0); }], - fim_cv_regex_broken=no, fim_cv_regex_broken=yes, fim_cv_regex_broken=yes)) +int main() { regex_t blah ; regmatch_t p; p.rm_eo = p.rm_eo; return regcomp(&blah, "foo.*bar", REG_NOSUB) || regexec (&blah, "foobar", 0, NULL, 0); }]])],[fim_cv_regex_broken=no],[fim_cv_regex_broken=yes],[fim_cv_regex_broken=yes])) if test X$fim_cv_regex_broken = Xyes ; then - echo "Using the included GNU regex instead." >&AC_FD_MSG + echo "Using the included GNU regex instead." >&AS_MESSAGE_FD fim_cv_regex=yes fi fi @@ -365,7 +384,7 @@ fi AC_MSG_CHECKING(where to put the documentation...) -dnl AC_ARG_WITH(docdir, AC_HELP_STRING([--with-docdir=PATH], [Specify where to put the documentation]), +dnl AC_ARG_WITH(docdir, AS_HELP_STRING([--with-docdir=PATH],[Specify where to put the documentation]), dnl [fim_cv_docdir=$withval], dnl [fim_cv_docdir='${prefix}/doc/fim-${fim_cv_version}']) # FIXME : the above line seems troublesome, BUT IT IS NOT (see the muttrc for this trick). @@ -378,7 +397,7 @@ AC_SUBST(fim_cv_version) dnl ============= gif file handling -AC_ARG_ENABLE(gif, AC_HELP_STRING([--disable-gif], [Disable gif support.]), +AC_ARG_ENABLE(gif, AS_HELP_STRING([--disable-gif],[Disable gif support.]), [ if test x$enableval = xno ; then fim_handle_gif=no fi @@ -393,14 +412,11 @@ if test x$fim_handle_gif != xno ; then AC_MSG_WARN([*** GIF loader will not be built (GIF library not found) ***])) if test x"$have_gif" = xyes; then AC_MSG_CHECKING([for gif.h]) - AC_TRY_CPP( -[#include + AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include #undef PACKAGE #undef VERSION #undef HAVE_STDLIB_H -#include ], - have_gif=yes, - have_gif=no) +#include ]])],[have_gif=yes],[have_gif=no]) AC_MSG_RESULT($have_gif) if test x"$have_gif" = xyes; then LIBGIF='-lgif' @@ -432,7 +448,7 @@ AM_CONDITIONAL(ENABLE_GIF, test x$have_gif = xyes) dnl ============= tiff file handling -AC_ARG_ENABLE(tiff, AC_HELP_STRING([--disable-tiff], [Disable tiff support.]), +AC_ARG_ENABLE(tiff, AS_HELP_STRING([--disable-tiff],[Disable tiff support.]), [ if test x$enableval = xno ; then fim_handle_tiff=no fi @@ -447,14 +463,11 @@ if test x$fim_handle_tiff != xno ; then AC_MSG_WARN([*** TIFF loader will not be built (TIFF library not found) ***]) , [$LIBTIFF_STATIC_EXTRA]) if test x"$have_tiff" = xyes; then AC_MSG_CHECKING([for tiff.h]) - AC_TRY_CPP( -[#include + AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include #undef PACKAGE #undef VERSION #undef HAVE_STDLIB_H -#include ], - have_tiff=yes, - have_tiff=no) +#include ]])],[have_tiff=yes],[have_tiff=no]) AC_MSG_RESULT($have_tiff) if test x"$have_tiff" = xyes; then LIBTIFF="-ltiff $LIBTIFF_STATIC_EXTRA" @@ -501,7 +514,7 @@ dnl ============= GNU gpm, unofficial yet dnl ============= no readline case handling fim_want_cxx11=no -AC_ARG_ENABLE(cxx11, AC_HELP_STRING([--enable-cxx11], [Enable C++11 standard constructs (requires appropriate CXXFLAGS, e.g. -std=c++11) (EXPERIMENTAL).]), +AC_ARG_ENABLE(cxx11, AS_HELP_STRING([--enable-cxx11],[Enable C++11 standard constructs (requires appropriate CXXFLAGS, e.g. -std=c++11) (EXPERIMENTAL).]), [ if test x$enableval = xno ; then fim_want_cxx11=no else @@ -512,7 +525,7 @@ AC_ARG_ENABLE(cxx11, AC_HELP_STRING([--enable-cxx11], [Enable C++11 standard con dnl ============= no readline case handling fim_want_readline=yes -AC_ARG_ENABLE(readline, AC_HELP_STRING([--disable-readline], [Disable readline support (EXPERIMENTAL).]), +AC_ARG_ENABLE(readline, AS_HELP_STRING([--disable-readline],[Disable readline support (EXPERIMENTAL).]), [ if test x$enableval = xno ; then fim_want_readline=no else @@ -561,7 +574,7 @@ fi dnl ============= jpeg file handling #AC_ARG_WITH(jpeg, [ --disable-jpeg ], [ disable jpeg file support]) -AC_ARG_ENABLE(jpeg, AC_HELP_STRING([--disable-jpeg], [Disable jpeg support.]), +AC_ARG_ENABLE(jpeg, AS_HELP_STRING([--disable-jpeg],[Disable jpeg support.]), [ if test x$enableval = xno ; then fim_handle_jpeg=no fi @@ -576,14 +589,11 @@ if test x$fim_handle_jpeg != xno ; then AC_MSG_WARN([*** JPEG loader will not be built (JPEG library not found) ***])) if test x"$have_jpeg" = xyes; then AC_MSG_CHECKING([for jpeglib.h]) - AC_TRY_CPP( -[#include + AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include #undef PACKAGE #undef VERSION #undef HAVE_STDLIB_H -#include ], - have_jpeg=yes, - have_jpeg=no) +#include ]])],[have_jpeg=yes],[have_jpeg=no]) AC_MSG_RESULT($have_jpeg) if test x"$have_jpeg" = xyes; then LIBJPEG='-ljpeg' @@ -616,7 +626,7 @@ AM_CONDITIONAL(ENABLE_JPEG, test x$have_jpeg = xyes) dnl ============= dvi file handling (via TeX-Guy) dnl -dnl AC_ARG_ENABLE(dvi, AC_HELP_STRING([--disable-dvi], [Disable dvi support.]), +dnl AC_ARG_ENABLE(dvi, AS_HELP_STRING([--disable-dvi],[Disable dvi support.]), dnl [ if test x$enableval = xno ; then dnl fim_handle_dvi=no dnl fi @@ -631,14 +641,11 @@ dnl have_dvi=no dnl AC_MSG_WARN([*** DVI loader will not be built (libdvi29 library not found) ***])) dnl if test x"$have_dvi" = xyes; then dnl AC_MSG_CHECKING([for libdvi29.h]) -dnl AC_TRY_CPP( -dnl [#include +dnl AC_PREPROC_IFELSE([AC_LANG_SOURCE([[dnl #include dnl #undef PACKAGE dnl #undef VERSION dnl #undef HAVE_STDLIB_H -dnl #include ], -dnl have_dvi=yes, -dnl have_dvi=no) +dnl #include ]])],[dnl have_dvi=yes],[dnl have_dvi=no]) dnl AC_MSG_RESULT($have_dvi) dnl if test x"$have_dvi" = xyes; then dnl LIBDVI='-ldvilib2' @@ -670,7 +677,7 @@ dnl AM_CONDITIONAL(ENABLE_DVI, test x$have_dvi = xyes) dnl ============= ps file handling -AC_ARG_ENABLE(ps, AC_HELP_STRING([--disable-ps], [Disable ps support.]), +AC_ARG_ENABLE(ps, AS_HELP_STRING([--disable-ps],[Disable ps support.]), [ if test x$enableval = xno ; then fim_handle_ps=no fi @@ -685,14 +692,11 @@ if test x$fim_handle_ps != xno ; then AC_MSG_WARN([*** PS loader will not be built (spectre library not found) ***]) , [$LIBSPECTRE_STATIC_EXTRA]) if test x"$have_ps" = xyes; then AC_MSG_CHECKING([for libspectre/spectre.h]) - AC_TRY_CPP( -[#include + AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include #undef PACKAGE #undef VERSION #undef HAVE_STDLIB_H -#include ], - have_ps=yes, - have_ps=no) +#include ]])],[have_ps=yes],[have_ps=no]) AC_MSG_RESULT($have_ps) if test x"$have_ps" = xyes; then LIBPS="-lspectre $LIBSPECTRE_STATIC_EXTRA" @@ -726,7 +730,7 @@ AM_CONDITIONAL(ENABLE_PS, test x$have_ps = xyes) dnl ============= djvu file handling -AC_ARG_ENABLE(djvu, AC_HELP_STRING([--disable-djvu], [Disable djvu support.]), +AC_ARG_ENABLE(djvu, AS_HELP_STRING([--disable-djvu],[Disable djvu support.]), [ if test x$enableval = xno ; then fim_handle_djvu=no fi @@ -741,14 +745,11 @@ if test x$fim_handle_djvu != xno ; then AC_MSG_WARN([*** DJVU loader will not be built (DJVU library not found) ***]), [$LIBDJVU_STATIC_EXTRA]) if test x"$have_djvu" = xyes; then AC_MSG_CHECKING([for libdjvu/ddjvuapi.h]) - AC_TRY_CPP( -[#include + AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include #undef PACKAGE #undef VERSION #undef HAVE_STDLIB_H -#include ], - have_djvu=yes, - have_djvu=no) +#include ]])],[have_djvu=yes],[have_djvu=no]) AC_MSG_RESULT($have_djvu) if test x"$have_djvu" = xyes; then LIBDJVU="-ldjvulibre $LIBDJVU_STATIC_EXTRA" @@ -784,7 +785,7 @@ dnl dnl By default, we disable poppler : its API is still immature. dnl fim_handle_pdf=no -AC_ARG_ENABLE(poppler, AC_HELP_STRING([--enable-poppler], [Enable poppler (PDF rendering) support. This will add LIBPOPPLER_CXXFLAGS="-I/usr/include/poppler/" to the compilation flags. You can override this by passing configure a suitable LIBPOPPLER_CXXFLAGS variable.]), +AC_ARG_ENABLE(poppler, AS_HELP_STRING([--enable-poppler],[Enable poppler (PDF rendering) support. This will add LIBPOPPLER_CXXFLAGS="-I/usr/include/poppler/" to the compilation flags. You can override this by passing configure a suitable LIBPOPPLER_CXXFLAGS variable.]), [ if test x$enableval = xyes ; then fim_handle_pdf=yes fi @@ -801,8 +802,7 @@ dnl FIXME : the following is a dirty hack AC_MSG_WARN([*** POPPLER loader will not be built (POPPLER library not found) ***]) ) if test x"$have_poppler" = xyes; then AC_MSG_CHECKING([for poppler/poppler-config.h]) - AC_TRY_CPP( - [#include + AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include #undef PACKAGE #undef VERSION #undef HAVE_STDLIB_H @@ -815,9 +815,7 @@ dnl FIXME : the following is a dirty hack #include #include #include /* globalParams lives here */ - ], - have_poppler=yes, - have_poppler=no) + ]])],[have_poppler=yes],[have_poppler=no]) have_poppler=yes AC_MSG_RESULT($have_poppler) if test x"$have_poppler" = xyes; then @@ -858,7 +856,7 @@ AM_CONDITIONAL(ENABLE_POPPLER, test x$have_poppler = xyes) dnl FIXME : we have two libpoppler checks ... : dnl ================== pdf checks =================================================== AC_ARG_ENABLE(pdf, - [AC_HELP_STRING([--enable-pdf], [Compile with pdf support])],enable_pdf="$enableval",enable_pdf=yes) + [AS_HELP_STRING([--enable-pdf],[Compile with pdf support])],enable_pdf="$enableval",enable_pdf=yes) if test "x$enable_pdf" = "xyes"; then POPPLER_REQUIRED=0.8.7 @@ -884,7 +882,7 @@ dnl ================== end of pdf checks ======================================= dnl ================================================================================ fim_handle_bmp=yes -AC_ARG_ENABLE(bmp, AC_HELP_STRING([--disable-bmp], [Disable BMP file support (enabled by default).]), +AC_ARG_ENABLE(bmp, AS_HELP_STRING([--disable-bmp],[Disable BMP file support (enabled by default).]), [ if test x$enableval = xno ; then fim_handle_bmp=no fi @@ -899,7 +897,7 @@ else fi dnl ================================================================================ fim_handle_pcx=yes -AC_ARG_ENABLE(pcx, AC_HELP_STRING([--disable-pcx], [Disable PCX file support (enabled by default).]), +AC_ARG_ENABLE(pcx, AS_HELP_STRING([--disable-pcx],[Disable PCX file support (enabled by default).]), [ if test x$enableval = xno ; then fim_handle_pcx=no fi @@ -916,12 +914,12 @@ dnl ============================================================================ ## png file handling -AC_ARG_WITH(png-prefix, AC_HELP_STRING([--with-png-prefix=PFX], [prefix where libpng is installed (optional)]), +AC_ARG_WITH(png-prefix, AS_HELP_STRING([--with-png-prefix=PFX],[prefix where libpng is installed (optional)]), libpng_config_prefix="$withval", libpng_config_prefix="") fim_handle_png=yes -AC_ARG_ENABLE(png, AC_HELP_STRING([--disable-png], [Disable png support.]), +AC_ARG_ENABLE(png, AS_HELP_STRING([--disable-png],[Disable png support.]), [ if test x$enableval = xno ; then fim_handle_png=no fi @@ -957,7 +955,7 @@ dnl ============================================================================ fim_handle_xyz=no -AC_ARG_ENABLE(xyz, AC_HELP_STRING([--enable-xyz], [Enable the sample bogus 'xyz' file loading support. This makes only sense in order to learn how to include a new file format and wish to play with src/FbiStuffXyz.cpp in the while.]), +AC_ARG_ENABLE(xyz, AS_HELP_STRING([--enable-xyz],[Enable the sample bogus 'xyz' file loading support. This makes only sense in order to learn how to include a new file format and wish to play with src/FbiStuffXyz.cpp in the while.]), [ if test x$enableval = xyes ; then fim_handle_xyz=yes fi @@ -976,7 +974,7 @@ dnl ============================================================================ fim_handle_ufraw=no -AC_ARG_ENABLE(ufraw, AC_HELP_STRING([--enable-ufraw], [Enable UFRaw support (EXPERIMENTAL).]), +AC_ARG_ENABLE(ufraw, AS_HELP_STRING([--enable-ufraw],[Enable UFRaw support (EXPERIMENTAL).]), [ if test x$enableval = xno ; then fim_handle_ufraw=no else @@ -999,7 +997,7 @@ dnl ============================================================================ fim_handle_archive=no -AC_ARG_ENABLE(archive, AC_HELP_STRING([--enable-archive], [Enable libarchive support (please provide ARCHIVE_LIBS, ARCHIVE_CXXFLAGS) (EXPERIMENTAL, UNFINISHED).]), +AC_ARG_ENABLE(archive, AS_HELP_STRING([--enable-archive],[Enable libarchive support (please provide ARCHIVE_LIBS, ARCHIVE_CXXFLAGS) (EXPERIMENTAL, UNFINISHED).]), [ if test x$enableval = xno ; then fim_handle_archive=no else @@ -1018,7 +1016,7 @@ fi dnl ================================================================================ AC_CHECK_LIB(exif, exif_data_new_from_data,have_libexif=yes,have_libexif=no) -AC_ARG_ENABLE(exif, AC_HELP_STRING([--disable-exif], [JPEG EXIF tags support with libexif.]), [if test x$enableval != xno; then fim_cv_libexif=yes; fi],[fim_cv_libexif=yes;]) +AC_ARG_ENABLE(exif, AS_HELP_STRING([--disable-exif],[JPEG EXIF tags support with libexif.]), [if test x$enableval != xno; then fim_cv_libexif=yes; fi],[fim_cv_libexif=yes;]) if test x$fim_cv_libexif = xyes; then if test x$have_libexif = xyes; then @@ -1036,7 +1034,7 @@ fi dnl ================================================================================ -AC_ARG_ENABLE(jasper, AC_HELP_STRING([--enable-jasper], [Turns on JPEG-2000 files support using JasPer (EXPERIMENTAL)]), +AC_ARG_ENABLE(jasper, AS_HELP_STRING([--enable-jasper],[Turns on JPEG-2000 files support using JasPer (EXPERIMENTAL)]), [if test x$enableval = xyes; then fim_cv_libjasper=yes; CXXFLAGS="$CXXFLAGS"; @@ -1056,7 +1054,7 @@ AC_ARG_ENABLE(jasper, AC_HELP_STRING([--enable-jasper], [Turns on JPEG-2000 file dnl ================================================================================ AC_CHECK_LIB(aa, aa_getfirst,fim_cv_libaa=yes,fim_cv_libaa=no) -AC_ARG_ENABLE(aa, AC_HELP_STRING([--disable-aa], [Ascii Art (-o aa) support (via aalib)]), [if test x$enableval != xno; then fim_cv_libaa=yes; else fim_cv_libaa=no; fi],[fim_cv_libaa=yes;]) +AC_ARG_ENABLE(aa, AS_HELP_STRING([--disable-aa],[Ascii Art (-o aa) support (via aalib)]), [if test x$enableval != xno; then fim_cv_libaa=yes; else fim_cv_libaa=no; fi],[fim_cv_libaa=yes;]) if test x$fim_cv_libaa != xno; then if test x$ac_cv_lib_aa_aa_getfirst = xyes; then AC_MSG_NOTICE([Enabling aalib driver.]) @@ -1091,18 +1089,18 @@ dnl ============================================================================ ## sdl driver -AC_ARG_WITH(sdl-prefix, AC_HELP_STRING([--with-sdl-prefix=PFX], [prefix where libsdl is installed (optional)]), +AC_ARG_WITH(sdl-prefix, AS_HELP_STRING([--with-sdl-prefix=PFX],[prefix where libsdl is installed (optional)]), libsdl_config_prefix="$withval", libsdl_config_prefix="") fim_handle_sdl='auto' -dnl AC_ARG_ENABLE(sdl, AC_HELP_STRING([--disable-sdl], [Disable libsdl support.]), +dnl AC_ARG_ENABLE(sdl, AS_HELP_STRING([--disable-sdl],[Disable libsdl support.]), dnl [ if test x$enableval = xno ; then dnl fim_handle_sdl=no dnl fi dnl ]) -AC_ARG_ENABLE(sdl, AC_HELP_STRING([--disable-sdl], [Disable libsdl support.]), +AC_ARG_ENABLE(sdl, AS_HELP_STRING([--disable-sdl],[Disable libsdl support.]), [ if test x$enableval = xyes ; then fim_handle_sdl=yes ; fi ] [ if test x$enableval = xno ; then fim_handle_sdl=no ; fi ]) @@ -1141,7 +1139,7 @@ dnl ============================================================================ AH_TEMPLATE([FIM_WANT_EXIFTOOL]) fim_cv_exiftool=no -AC_ARG_ENABLE(exiftool, AC_HELP_STRING([--enable-exiftool], [Turns on exiftool support (EXPERIMENTAL, shall provide the EXIFTOOLLINK variable with library or object files and EXIFTOOLCXXFLAGS)]), +AC_ARG_ENABLE(exiftool, AS_HELP_STRING([--enable-exiftool],[Turns on exiftool support (EXPERIMENTAL, shall provide the EXIFTOOLLINK variable with library or object files and EXIFTOOLCXXFLAGS)]), [if test x$enableval = xyes; then fim_cv_exiftool=yes CXXFLAGS="$CXXFLAGS $EXIFTOOLCXXFLAGS" @@ -1162,7 +1160,7 @@ dnl ================== fim_cv_autocommands=yes -AC_ARG_ENABLE(autocommands, AC_HELP_STRING([--disable-autocommands], [Fim will by default use autocommands.]), +AC_ARG_ENABLE(autocommands, AS_HELP_STRING([--disable-autocommands],[Fim will by default use autocommands.]), [if test x$enableval = xno; then fim_cv_autocommands=no fi]) @@ -1178,7 +1176,7 @@ fi dnl ================== -AC_ARG_ENABLE(hardcoded-font, AC_HELP_STRING([--enable-hardcoded-font], [Enable a hardcoded font in the executable (good as a fallback (FBFONT=fim://) when no PSF format consolefonts files are available).]), +AC_ARG_ENABLE(hardcoded-font, AS_HELP_STRING([--enable-hardcoded-font],[Enable a hardcoded font in the executable (good as a fallback (FBFONT=fim://) when no PSF format consolefonts files are available).]), [if test x$enableval = xyes; then fim_cv_hardcoded_font=yes; else @@ -1197,7 +1195,7 @@ AM_CONDITIONAL(FIM_WANT_HARDCODED_CONSOLEFONT, test x$have_hardcoded_font = xyes dnl ================== -AC_ARG_ENABLE(long-int-vars, AC_HELP_STRING([--enable-long-int-vars], [Internals shall use 64 bit integers (EXPERIMENTAL].), +AC_ARG_ENABLE(long-int-vars, AS_HELP_STRING([--enable-long-int-vars],[Internals shall use 64 bit integers (EXPERIMENTAL.]), [if test x$enableval = xyes; then fim_cv_want_int64_int=yes; else @@ -1214,7 +1212,7 @@ dnl ================== fim_cv_windows=yes -AC_ARG_ENABLE(windows, AC_HELP_STRING([--disable-windows], [Disable windowing system in Fim. (deprecated)]), +AC_ARG_ENABLE(windows, AS_HELP_STRING([--disable-windows],[Disable windowing system in Fim. (deprecated)]), [if test x$enableval = xno; then fim_cv_windows=no fi]) @@ -1231,7 +1229,7 @@ fi dnl ================== fim_cv_fimrc=yes -AC_ARG_ENABLE(fimrc, AC_HELP_STRING([--disable-fimrc], [Fim will by default load the ~/.fimrc file.]), +AC_ARG_ENABLE(fimrc, AS_HELP_STRING([--disable-fimrc],[Fim will by default load the ~/.fimrc file.]), [if test x$enableval = xno; then fim_cv_fimrc=no fi]) @@ -1247,7 +1245,7 @@ dnl ================== AH_TEMPLATE([FIM_NOHISTORY]) fim_cv_history=yes -AC_ARG_ENABLE(history, AC_HELP_STRING([--disable-history], [Fim will by default load/save a ~/.fim_history file.]), +AC_ARG_ENABLE(history, AS_HELP_STRING([--disable-history],[Fim will by default load/save a ~/.fim_history file.]), [if test x$enableval = xno; then fim_cv_history=no fi]) @@ -1262,7 +1260,7 @@ fi dnl ================== fim_cv_warnings=no -AC_ARG_ENABLE(screen, AC_HELP_STRING([--disable-screen], [Fim will try to work under screen by default (please read BUGS)]), +AC_ARG_ENABLE(screen, AS_HELP_STRING([--disable-screen],[Fim will try to work under screen by default (please read BUGS)]), [ if test x$enableval = xno; then fim_cv_screen=no else @@ -1274,7 +1272,7 @@ AC_ARG_ENABLE(screen, AC_HELP_STRING([--disable-screen], [Fim will try to work u dnl ================== fim_cv_resize_optimizations=yes -AC_ARG_ENABLE(resize-optimizations, AC_HELP_STRING([--disable-resize-optimizations], [Some old (fbi) code is optimized for speedup in fim.]), +AC_ARG_ENABLE(resize-optimizations, AS_HELP_STRING([--disable-resize-optimizations],[Some old (fbi) code is optimized for speedup in fim.]), [ if test x$enableval = xno; then fim_cv_resize_optimizations=no else @@ -1286,7 +1284,7 @@ AC_ARG_ENABLE(resize-optimizations, AC_HELP_STRING([--disable-resize-optimizatio dnl ================== fim_cv_read_stdin_image=yes -AC_ARG_ENABLE(stdin-image-reading, AC_HELP_STRING([--disable-stdin-image-reading], [Fim will read an image from stdin with the -i switch. (experimental)]), +AC_ARG_ENABLE(stdin-image-reading, AS_HELP_STRING([--disable-stdin-image-reading],[Fim will read an image from stdin with the -i switch. (experimental)]), [ if test x$enableval = xno; then fim_cv_read_stdin_image=no else @@ -1297,7 +1295,7 @@ AC_ARG_ENABLE(stdin-image-reading, AC_HELP_STRING([--disable-stdin-image-reading dnl ================== fim_cv_scan_consolefonts=yes -AC_ARG_ENABLE(scan-consolefonts, AC_HELP_STRING([--enable-scan-consolefonts], [Fim will scan some predefined directory in look for console fonts as a fallback. (experimental)]), +AC_ARG_ENABLE(scan-consolefonts, AS_HELP_STRING([--enable-scan-consolefonts],[Fim will scan some predefined directory in look for console fonts as a fallback. (experimental)]), [ if test x$enableval = xyes; then fim_cv_scan_consolefonts=yes else @@ -1307,7 +1305,7 @@ AC_ARG_ENABLE(scan-consolefonts, AC_HELP_STRING([--enable-scan-consolefonts], [F ) dnl ================== fim_cv_seek_magic=yes -AC_ARG_ENABLE(seek-magic, AC_HELP_STRING([--enable-seek-magic], [Fim will be capable to seek on a specified magic string. (experimental)]), +AC_ARG_ENABLE(seek-magic, AS_HELP_STRING([--enable-seek-magic],[Fim will be capable to seek on a specified magic string. (experimental)]), [ if test x$enableval = xyes; then fim_cv_seek_magic=yes else @@ -1316,7 +1314,7 @@ AC_ARG_ENABLE(seek-magic, AC_HELP_STRING([--enable-seek-magic], [Fim will be cap ],[ fim_cv_seek_magic=no ] ) dnl ================== -AC_ARG_ENABLE(pushdir, AC_HELP_STRING([--enable-pushdir], [Fim will scan directories for files.]), +AC_ARG_ENABLE(pushdir, AS_HELP_STRING([--enable-pushdir],[Fim will scan directories for files.]), [ if test x$enableval = xno; then fim_cv_read_dirs=no else @@ -1325,7 +1323,7 @@ AC_ARG_ENABLE(pushdir, AC_HELP_STRING([--enable-pushdir], [Fim will scan directo ],[ fim_cv_read_dirs=yes ] ) dnl ================== -AC_ARG_ENABLE(recursive-pushdir, AC_HELP_STRING([--disable-recursive-pushdir], [Fim will be able to push directories recursively (implies --enable-push-dirs )]), +AC_ARG_ENABLE(recursive-pushdir, AS_HELP_STRING([--disable-recursive-pushdir],[Fim will be able to push directories recursively (implies --enable-push-dirs )]), [ if test x$enableval = xyes; then fim_cv_recursive_dirs=yes; fim_cv_read_dirs=yes; @@ -1387,7 +1385,7 @@ fi dnl ================== fim_cv_warnings=no -AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [Turns on debug options (recommended for debugging)]), +AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug],[Turns on debug options (recommended for debugging)]), [if test x$enableval = xyes; then fim_cv_debug=yes fi]) @@ -1395,7 +1393,7 @@ fi]) dnl ================== fim_cv_warnings=no -AC_ARG_ENABLE(warnings, AC_HELP_STRING([--enable-warnings], [Turns on compiler warnings (recommended, for debugging)]), +AC_ARG_ENABLE(warnings, AS_HELP_STRING([--enable-warnings],[Turns on compiler warnings (recommended, for debugging)]), [if test x$enableval = xyes; then fim_cv_warnings=yes fi]) @@ -1419,7 +1417,7 @@ dnl ================== fim_cv_cacalib=no -AC_ARG_ENABLE(cacalib, AC_HELP_STRING([--enable-cacalib], [Turns on cacalib support (STILL INCOMPLETE)]), +AC_ARG_ENABLE(cacalib, AS_HELP_STRING([--enable-cacalib],[Turns on cacalib support (STILL INCOMPLETE)]), [if test x$enableval = xyes; then if test x$have_cacalib = xyes; then fim_cv_cacalib=yes @@ -1433,8 +1431,7 @@ AC_ARG_ENABLE(cacalib, AC_HELP_STRING([--enable-cacalib], [Turns on cacalib supp dnl ================== # This code still awaits for integration ... -AC_ARG_WITH(cflags, AC_HELP_STRING([--with-cflags=CXXFLAGS], - [Specify a custom CXXFLAGS append value. e.g.: -pg +AC_ARG_WITH(cflags, AS_HELP_STRING([--with-cflags=CXXFLAGS],[Specify a custom CXXFLAGS append value. e.g.: -pg You cannot call this argument multiple times. In case you want completely reset CXXFLAGS use : CXXFLAGS='' ./configure .. @@ -1456,7 +1453,7 @@ AC_ARG_WITH(cflags, AC_HELP_STRING([--with-cflags=CXXFLAGS], dnl ================== # This code still awaits for integration ... -AC_ARG_WITH(exec-shell, AC_HELP_STRING([--with-exec-shell=SHELL], [Specify alternate shell (ONLY if /bin/sh is broken)]), +AC_ARG_WITH(exec-shell, AS_HELP_STRING([--with-exec-shell=SHELL],[Specify alternate shell (ONLY if /bin/sh is broken)]), [if test x$withval != xyes; then AC_DEFINE_UNQUOTED(EXECSHELL, "$withval", [program to use for shell commands]) @@ -1466,7 +1463,7 @@ AC_ARG_WITH(exec-shell, AC_HELP_STRING([--with-exec-shell=SHELL], [Specify alter [AC_DEFINE_UNQUOTED(EXECSHELL, "/bin/sh")]) dnl ================== -AC_ARG_ENABLE(convert, AC_HELP_STRING([--disable-smartautocompletion], [Fim will treat as a proper, unescaped string, nonquoted and nonevaluated strings which happen to match an existing filename.]), +AC_ARG_ENABLE(convert, AS_HELP_STRING([--disable-smartautocompletion],[Fim will treat as a proper, unescaped string, nonquoted and nonevaluated strings which happen to match an existing filename.]), [ if test x$enableval = xno; then fim_cv_smartautcompletion=no else @@ -1484,7 +1481,7 @@ if test x$fim_cv_scan_consolefonts = xyes; then fi dnl ================== -AC_ARG_ENABLE(convert, AC_HELP_STRING([--disable-convert], [Fim will try to use convert (ImageMagick) as a last resort for opening unknown format files.]), +AC_ARG_ENABLE(convert, AS_HELP_STRING([--disable-convert],[Fim will try to use convert (ImageMagick) as a last resort for opening unknown format files.]), [ if test x$enableval = xno; then fim_cv_convert=no else @@ -1497,7 +1494,7 @@ AC_ARG_ENABLE(convert, AC_HELP_STRING([--disable-convert], [Fim will try to use dnl ================== -AC_ARG_ENABLE(xcftopnm, AC_HELP_STRING([--disable-xcftopnm], [Fim will try to use xcftopnm (Gimp) for opening XCF format files.]), +AC_ARG_ENABLE(xcftopnm, AS_HELP_STRING([--disable-xcftopnm],[Fim will try to use xcftopnm (Gimp) for opening XCF format files.]), [ if test x$enableval = xno; then fim_cv_xcftopnm=no else @@ -1509,7 +1506,7 @@ AC_ARG_ENABLE(xcftopnm, AC_HELP_STRING([--disable-xcftopnm], [Fim will try to us dnl ================== fim_cv_inkscape=yes -AC_ARG_ENABLE(inkscape, AC_HELP_STRING([--disable-inkscape], [Fim will try to use Inkscape for opening SVG format files.]), +AC_ARG_ENABLE(inkscape, AS_HELP_STRING([--disable-inkscape],[Fim will try to use Inkscape for opening SVG format files.]), [ if test x$enableval = xno; then fim_cv_inkscape=no else @@ -1520,7 +1517,7 @@ AC_ARG_ENABLE(inkscape, AC_HELP_STRING([--disable-inkscape], [Fim will try to us dnl ================== -AC_ARG_ENABLE(xfig, AC_HELP_STRING([--disable-xfig], [Fim will try to use xfig (fig2dev) for opening FIG format files.]), +AC_ARG_ENABLE(xfig, AS_HELP_STRING([--disable-xfig],[Fim will try to use xfig (fig2dev) for opening FIG format files.]), [ if test x$enableval = xno; then fim_cv_xfig=no else @@ -1531,7 +1528,7 @@ AC_ARG_ENABLE(xfig, AC_HELP_STRING([--disable-xfig], [Fim will try to use xfig ( dnl ================== -AC_ARG_ENABLE(dia, AC_HELP_STRING([--disable-dia], [Fim will try to use dia for opening DIA format files.]), +AC_ARG_ENABLE(dia, AS_HELP_STRING([--disable-dia],[Fim will try to use dia for opening DIA format files.]), [ if test x$enableval = xno; then fim_cv_dia=no else @@ -1542,19 +1539,19 @@ AC_ARG_ENABLE(dia, AC_HELP_STRING([--disable-dia], [Fim will try to use dia for dnl ================== AH_TEMPLATE([FIM_DEFAULT_CONSOLEFONT]) -AC_ARG_WITH(default-consolefont, AC_HELP_STRING([--with-default-consolefont=FILE], [Specify a default consolefont (psf or psf.gz format) file.]), [ AC_DEFINE_UNQUOTED(FIM_DEFAULT_CONSOLEFONT, "$withval") ], [fim_cv_defaultconsolefont=""]) +AC_ARG_WITH(default-consolefont, AS_HELP_STRING([--with-default-consolefont=FILE],[Specify a default consolefont (psf or psf.gz format) file.]), [ AC_DEFINE_UNQUOTED(FIM_DEFAULT_CONSOLEFONT, "$withval") ], [fim_cv_defaultconsolefont=""]) dnl ================== -AC_ARG_WITH(custom-hardcoded-consolefont, AC_HELP_STRING([--with-custom-hardcoded-consolefont=FILE], [Specify a custom consolefont to be hardcoded (uncompressed psf format, absolute path) at build time (requires --enable-hardcoded-font).]), [ +AC_ARG_WITH(custom-hardcoded-consolefont, AS_HELP_STRING([--with-custom-hardcoded-consolefont=FILE],[Specify a custom consolefont to be hardcoded (uncompressed psf format, absolute path) at build time (requires --enable-hardcoded-font).]), [ fim_cv_want_custom_hardcoded_consolefont=true; AC_SUBST(FIM_CUSTOM_HARDCODED_CONSOLEFONT, "$withval") ], []) AM_CONDITIONAL(FIM_WANT_CUSTOM_HARDCODED_CONSOLEFONT, test x$fim_cv_want_custom_hardcoded_consolefont = xtrue ) dnl ================== -AC_ARG_WITH(tmpfile, AC_HELP_STRING([--with-tmpfile=FILE], [Specify where to put temporary files created when interacting with external conversion programs (default is "/tmp/__FIM_TEMPORARY_FILE").]), +AC_ARG_WITH(tmpfile, AS_HELP_STRING([--with-tmpfile=FILE],[Specify where to put temporary files created when interacting with external conversion programs (default is "/tmp/__FIM_TEMPORARY_FILE").]), [fim_cv_tmpfile=$withval], [fim_cv_tmpfile="/tmp/__FIM_TEMPORARY_FILE"]) dnl ================== -AC_ARG_ENABLE(custom-status-bar, AC_HELP_STRING([--disable-custom-status-bar], [Customization of status bar via a printf-like string.]), +AC_ARG_ENABLE(custom-status-bar, AS_HELP_STRING([--disable-custom-status-bar],[Customization of status bar via a printf-like string.]), [ if test x$enableval = xno; then fim_cv_custom_status_bar=no; else @@ -1564,7 +1561,7 @@ AC_ARG_ENABLE(custom-status-bar, AC_HELP_STRING([--disable-custom-status-bar], [ ) dnl ================== -AC_ARG_ENABLE(optimizations, AC_HELP_STRING([--enable-optimizations], [Will try to enhance compilation flags (EXPERIMENTAL)]), +AC_ARG_ENABLE(optimizations, AS_HELP_STRING([--enable-optimizations],[Will try to enhance compilation flags (EXPERIMENTAL)]), [ if test x$enableval = xno; then fim_cv_optimizations=no else @@ -1722,23 +1719,23 @@ dnl ================== dnl ================== AH_TEMPLATE([FIM_WANT_FILENAME_MARK_AND_DUMP]) -AC_ARG_ENABLE(mark-and-dump, AC_HELP_STRING([--enable-mark-and-dump], [Fim will be capable of marking files while viewing and outputting their names on exit. (enabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_mark_and_dump=1 ; else fim_cv_want_mark_and_dump=0 ; fi ],[ fim_cv_want_mark_and_dump=1 ]) +AC_ARG_ENABLE(mark-and-dump, AS_HELP_STRING([--enable-mark-and-dump],[Fim will be capable of marking files while viewing and outputting their names on exit. (enabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_mark_and_dump=1 ; else fim_cv_want_mark_and_dump=0 ; fi ],[ fim_cv_want_mark_and_dump=1 ]) AC_DEFINE_UNQUOTED([FIM_WANT_FILENAME_MARK_AND_DUMP], $fim_cv_want_mark_and_dump, [Fim will be capable of marking files while viewing and outputting their names on exit.]) dnl ================== AH_TEMPLATE([FIM_WANT_NOSCRIPTING]) -AC_ARG_ENABLE(scripting, AC_HELP_STRING([--enable-scripting], [Scripting. (enabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_noscripting=0 ; else fim_cv_want_noscripting=1 ; fi ],[ fim_cv_want_noscripting=0 ]) +AC_ARG_ENABLE(scripting, AS_HELP_STRING([--enable-scripting],[Scripting. (enabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_noscripting=0 ; else fim_cv_want_noscripting=1 ; fi ],[ fim_cv_want_noscripting=0 ]) if test x$fim_cv_want_noscripting == x1 ; then AC_DEFINE_UNQUOTED([FIM_WANT_NOSCRIPTING], $fim_cv_want_noscripting, [Scripting. (enabled by default)]) fi dnl ================== AH_TEMPLATE([FIM_WANT_NO_OUTPUT_CONSOLE]) -AC_ARG_ENABLE(output-console, AC_HELP_STRING([--enable-output-console], [Output console. (enabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_no_output_console=0 ; else fim_cv_want_no_output_console=1 ; fi ],[ fim_cv_want_no_output_console=0 ]) +AC_ARG_ENABLE(output-console, AS_HELP_STRING([--enable-output-console],[Output console. (enabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_no_output_console=0 ; else fim_cv_want_no_output_console=1 ; fi ],[ fim_cv_want_no_output_console=0 ]) if test x$fim_cv_want_no_output_console == x1 ; then AC_DEFINE_UNQUOTED([FIM_WANT_NO_OUTPUT_CONSOLE], $fim_cv_want_no_output_console, [Output console. (enabled by default)]) fi dnl ================== AH_TEMPLATE([FIM_WANT_UNICODE]) -AC_ARG_ENABLE(unicode, AC_HELP_STRING([--enable-unicode], [Unicode. (disabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_unicode=1 ; else fim_cv_want_unicode=0 ; fi ],[ fim_cv_want_unicode=0 ]) +AC_ARG_ENABLE(unicode, AS_HELP_STRING([--enable-unicode],[Unicode. (disabled by default)]), [ if test x$enableval = xyes; then fim_cv_want_unicode=1 ; else fim_cv_want_unicode=0 ; fi ],[ fim_cv_want_unicode=0 ]) if test x$fim_cv_want_unicode == x1 ; then # CXXFLAGS="$CXXFLAGS `freetype-config --cflags`" # LIBS="$LIBS `freetype-config --libs`" @@ -1747,7 +1744,7 @@ fi dnl ================== AH_TEMPLATE([FIM_WANT_TEXT_RENDERING]) fim_want_astext=yes -AC_ARG_ENABLE(as-text-rendering, AC_HELP_STRING([--disable-as-text-rendering], [Disable as-text rendering (viewing of any file as character bytes -- not to be confused with the ASCII art output).]), +AC_ARG_ENABLE(as-text-rendering, AS_HELP_STRING([--disable-as-text-rendering],[Disable as-text rendering (viewing of any file as character bytes -- not to be confused with the ASCII art output).]), [ if test x$enableval = xno ; then fim_want_astext=no fi @@ -1758,7 +1755,7 @@ fi dnl ================== AH_TEMPLATE([FIM_WANT_RAW_BITS_RENDERING]) fim_want_rbr=yes -AC_ARG_ENABLE(raw-bits-rendering, AC_HELP_STRING([--disable-raw-bits-rendering], [Disable raw bits rendering (viewing of any file as either a 1 or 24 bpp bitmap).]), +AC_ARG_ENABLE(raw-bits-rendering, AS_HELP_STRING([--disable-raw-bits-rendering],[Disable raw bits rendering (viewing of any file as either a 1 or 24 bpp bitmap).]), [ if test x$enableval = xno ; then fim_want_rbr=no fi @@ -1769,7 +1766,7 @@ fi dnl ================== AH_TEMPLATE([FIM_ALLOW_LOADER_STRING_SPECIFICATION]) fim_want_lss=yes -AC_ARG_ENABLE(loader-string-specification, AC_HELP_STRING([--disable-loader-string-specification], [Disables the chance to specify a file loader.]), +AC_ARG_ENABLE(loader-string-specification, AS_HELP_STRING([--disable-loader-string-specification],[Disables the chance to specify a file loader.]), [ if test x$enableval = xno ; then fim_want_lss=no fi @@ -1851,7 +1848,7 @@ AC_DEFINE([FBI_AUTHOR],["Gerd Hoffmann "]) dnl ############################################################################### dnl this is experimental stuff dnl ############################################################################### -AC_ARG_ENABLE(matrices-rendering, AC_HELP_STRING([--enable-matrices-rendering], [Uses librsb for rendering of Matrix Market files (must have librsb-config in the PATH).]), +AC_ARG_ENABLE(matrices-rendering, AS_HELP_STRING([--enable-matrices-rendering],[Uses librsb for rendering of Matrix Market files (must have librsb-config in the PATH).]), [ if test x$enableval = xyes; then if test x$ac_cv_func_rsb_lib_init = xyes; then AH_TEMPLATE([HAVE_MATRIX_MARKET_DECODER]) @@ -1881,12 +1878,13 @@ AC_SUBST(CXXFLAGS) #AC_CONFIG_FILES([Makefile],[src/Makefile]) -AC_OUTPUT(Makefile src/Makefile doc/Makefile distros/Makefile scripts/Makefile +AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile distros/Makefile scripts/Makefile scripts/maintenance/cron-build.sh scripts/maintenance/remote-build.sh scripts/maintenance/cron-svndump.pl scripts/maintenance/cron-rsync.sh - ) + ]) +AC_OUTPUT #AC_OUTPUT AC_MSG_NOTICE([ -- cgit v1.2.3 From aa7ddfd7b4757cf73b977d467a21c3301a6d6560 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Laboissi=C3=A8re?= Date: Sun, 4 Dec 2022 12:38:59 -0300 Subject: Honor the CPPFLAGS environment variable Forwarded: https://savannah.nongnu.org/bugs/index.php?61478 Last-Update: 2021-11-14 This is required in Debian, such that hardening flags like -D_FORTIFY_SOURCE=2 are used in the compilation of C++ files. Gbp-Pq: Name honor-cppflags.patch --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 64ecc07..11c624c 100644 --- a/configure.ac +++ b/configure.ac @@ -79,7 +79,7 @@ AM_INIT_AUTOMAKE #AM_INIT_AUTOMAKE(fim, $fim_cv_version) #AM_INIT_AUTOMAKE(fim, 1.0) AC_SUBST([CONFIG_STATUS_DEPENDENCIES], ['$(top_srcdir)/VERSION']) -CPPFLAGS='' +#CPPFLAGS='' AC_SUBST(FIM_LIBS) -- cgit v1.2.3 From 55d29673d6d491e41c046a4f0c324bd3d2bd6acd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Laboissi=C3=A8re?= Date: Sun, 4 Dec 2022 12:38:59 -0300 Subject: Commit patch to update .gitignore [dgit (10.1) update-gitignore-quilt-fixup] --- debian/patches/auto-gitignore | 52 +++++++++++++++++++++++++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 53 insertions(+) create mode 100644 debian/patches/auto-gitignore diff --git a/debian/patches/auto-gitignore b/debian/patches/auto-gitignore new file mode 100644 index 0000000..9e2d7ce --- /dev/null +++ b/debian/patches/auto-gitignore @@ -0,0 +1,52 @@ +Subject: Update .gitignore from Debian packaging branch + +The Debian packaging git branch contains these updates to the upstream +.gitignore file(s). This patch is autogenerated, to provide these +updates to users of the official Debian archive view of the package. + +[dgit (10.1) update-gitignore] +--- +diff --git a/.gitignore b/.gitignore +new file mode 100644 +index 0000000..73185d7 +--- /dev/null ++++ b/.gitignore +@@ -0,0 +1,38 @@ ++/.pc/ ++/Makefile ++/autom4te.cache/ ++/compile ++/config.h ++/config.h.in~ ++/config.log ++/config.status ++/debian/.debhelper/ ++/debian/autoreconf.* ++/debian/debhelper-build-stamp ++/debian/files ++/debian/fim.debhelper.log ++/debian/fim.substvars ++/debian/fim/ ++/distros/Makefile ++/doc/Makefile ++/doc/doctags ++/doc/tags ++/scripts/Makefile ++/scripts/maintenance/cron-build.sh ++/scripts/maintenance/cron-rsync.sh ++/scripts/maintenance/cron-svndump.pl ++/scripts/maintenance/remote-build.sh ++/src/*.o ++/src/b2ba ++/src/conf.h ++/src/config.h.in ++/src/fim ++/src/Makefile ++/src/lex.yy.cc ++/src/yacc.output ++/src/yacc.tab.cpp ++/src/yacc.tab.hpp ++/src/yacc.tab.o ++/stamp-h1 ++/src/testdir/*.out ++/src/testdir/test.log diff --git a/debian/patches/series b/debian/patches/series index 97797f6..4bf0196 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -3,3 +3,4 @@ reproducible-build.patch compile-with-gcc-10.patch update-configure-ac.patch honor-cppflags.patch +auto-gitignore -- cgit v1.2.3 From 5eded5006ce74f131b1fe19d198354acd51a5053 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Laboissi=C3=A8re?= Date: Sat, 17 Jun 2023 16:49:07 -0300 Subject: Commit patch to update .gitignore [dgit (10.7) update-gitignore-quilt-fixup] --- debian/patches/auto-gitignore | 52 +++++++++++++++++++++++++++++++++++++++++++ debian/patches/series | 2 ++ 2 files changed, 54 insertions(+) create mode 100644 debian/patches/auto-gitignore create mode 100644 debian/patches/series diff --git a/debian/patches/auto-gitignore b/debian/patches/auto-gitignore new file mode 100644 index 0000000..a914722 --- /dev/null +++ b/debian/patches/auto-gitignore @@ -0,0 +1,52 @@ +Subject: Update .gitignore from Debian packaging branch + +The Debian packaging git branch contains these updates to the upstream +.gitignore file(s). This patch is autogenerated, to provide these +updates to users of the official Debian archive view of the package. + +[dgit (10.7) update-gitignore] +--- +diff --git a/.gitignore b/.gitignore +new file mode 100644 +index 0000000..73185d7 +--- /dev/null ++++ b/.gitignore +@@ -0,0 +1,38 @@ ++/.pc/ ++/Makefile ++/autom4te.cache/ ++/compile ++/config.h ++/config.h.in~ ++/config.log ++/config.status ++/debian/.debhelper/ ++/debian/autoreconf.* ++/debian/debhelper-build-stamp ++/debian/files ++/debian/fim.debhelper.log ++/debian/fim.substvars ++/debian/fim/ ++/distros/Makefile ++/doc/Makefile ++/doc/doctags ++/doc/tags ++/scripts/Makefile ++/scripts/maintenance/cron-build.sh ++/scripts/maintenance/cron-rsync.sh ++/scripts/maintenance/cron-svndump.pl ++/scripts/maintenance/remote-build.sh ++/src/*.o ++/src/b2ba ++/src/conf.h ++/src/config.h.in ++/src/fim ++/src/Makefile ++/src/lex.yy.cc ++/src/yacc.output ++/src/yacc.tab.cpp ++/src/yacc.tab.hpp ++/src/yacc.tab.o ++/stamp-h1 ++/src/testdir/*.out ++/src/testdir/test.log diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..a22980a --- /dev/null +++ b/debian/patches/series @@ -0,0 +1,2 @@ + +auto-gitignore -- cgit v1.2.3 From 2401da999a4ba30bcce382282097b0579ba7e7bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Laboissi=C3=A8re?= Date: Wed, 26 Jul 2023 07:22:40 -0300 Subject: Prioritize dynamic over static SDL2 library Forwarded: not-needed Last-Update: 2023-07-26 Gbp-Pq: Name sdl-dynamic-lib.patch --- configure.ac | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 31e97d4..e684f74 100644 --- a/configure.ac +++ b/configure.ac @@ -1209,11 +1209,11 @@ if test x$fim_handle_sdl != xno; then fim_handle_sdl='yes' LIBSDL_CXXFLAGS=`$LIBSDL_CONFIG --cflags` CXXFLAGS="$CXXFLAGS $LIBSDL_CXXFLAGS" - LIBSDL_CONFIG_FLAGS=--static-libs + LIBSDL_CONFIG_FLAGS=--libs if $LIBSDL_CONFIG $LIBSDL_CONFIG_FLAGS ; then - LIBSDL_CONFIG_FLAGS=--static-libs - else LIBSDL_CONFIG_FLAGS=--libs + else + LIBSDL_CONFIG_FLAGS=--static-libs fi AC_MSG_NOTICE([Invoking $LIBSDL_CONFIG $LIBSDL_CONFIG_FLAGS.]) LIBS="$LIBS `$LIBSDL_CONFIG $LIBSDL_CONFIG_FLAGS`" -- cgit v1.2.3 From 3f2779c57fdd33facdb18f41d8c7748324b2cb61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Laboissi=C3=A8re?= Date: Wed, 26 Jul 2023 07:22:40 -0300 Subject: Commit patch to update .gitignore [dgit (11.0) update-gitignore-quilt-fixup] --- debian/patches/auto-gitignore | 52 +++++++++++++++++++++++++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 53 insertions(+) create mode 100644 debian/patches/auto-gitignore diff --git a/debian/patches/auto-gitignore b/debian/patches/auto-gitignore new file mode 100644 index 0000000..22489eb --- /dev/null +++ b/debian/patches/auto-gitignore @@ -0,0 +1,52 @@ +Subject: Update .gitignore from Debian packaging branch + +The Debian packaging git branch contains these updates to the upstream +.gitignore file(s). This patch is autogenerated, to provide these +updates to users of the official Debian archive view of the package. + +[dgit (11.0) update-gitignore] +--- +diff --git a/.gitignore b/.gitignore +new file mode 100644 +index 0000000..73185d7 +--- /dev/null ++++ b/.gitignore +@@ -0,0 +1,38 @@ ++/.pc/ ++/Makefile ++/autom4te.cache/ ++/compile ++/config.h ++/config.h.in~ ++/config.log ++/config.status ++/debian/.debhelper/ ++/debian/autoreconf.* ++/debian/debhelper-build-stamp ++/debian/files ++/debian/fim.debhelper.log ++/debian/fim.substvars ++/debian/fim/ ++/distros/Makefile ++/doc/Makefile ++/doc/doctags ++/doc/tags ++/scripts/Makefile ++/scripts/maintenance/cron-build.sh ++/scripts/maintenance/cron-rsync.sh ++/scripts/maintenance/cron-svndump.pl ++/scripts/maintenance/remote-build.sh ++/src/*.o ++/src/b2ba ++/src/conf.h ++/src/config.h.in ++/src/fim ++/src/Makefile ++/src/lex.yy.cc ++/src/yacc.output ++/src/yacc.tab.cpp ++/src/yacc.tab.hpp ++/src/yacc.tab.o ++/stamp-h1 ++/src/testdir/*.out ++/src/testdir/test.log diff --git a/debian/patches/series b/debian/patches/series index d55866c..6d5dcfa 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1 +1,2 @@ sdl-dynamic-lib.patch +auto-gitignore -- cgit v1.2.3 From 48922ba39d153a7b8c5e05424ee660aa23c2b20d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Laboissi=C3=A8re?= Date: Sun, 14 Apr 2024 03:26:04 -0300 Subject: Disable failing test Forwarded: no Last-Update: 2024-04-14 This patch disables a unit test in Makefile.am, which is mysteriously failing on the autobuilders, but passes flawlessly when the package is built locally. Hopefully, this will be fixed in the future. Gbp-Pq: Name disable-failing-test.patch --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 2c281f6..f794e85 100644 --- a/Makefile.am +++ b/Makefile.am @@ -253,7 +253,7 @@ gtktests: all $(NO_ASAN) $(FIM_EXE) $(FIMNORCOPTS) $(top_srcdir)/media/ -o gtk -c 'display "menuadd" "_Help/_Variables FimMenuVariablesHelp/" "Help_/_Variables FimMenuVariablesHelp/";quit 0;' # notice Help_ is a different menu than _Help $(NO_ASAN) $(FIM_EXE) $(FIMNORCOPTS) $(top_srcdir)/media/ -o gtk -c 'cl1=_console_lines;man_fimrc;cl2=_console_lines; quit!(cl1 Date: Sun, 14 Apr 2024 10:16:32 -0300 Subject: Disable failing test Forwarded: no Last-Update: 2024-04-14 This patch disables a unit test in Makefile.am, which is mysteriously failing on the autobuilders, but passes flawlessly when the package is built locally. Hopefully, this will be fixed in the future. Gbp-Pq: Name disable-failing-test.patch --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 2c281f6..398e831 100644 --- a/Makefile.am +++ b/Makefile.am @@ -658,7 +658,7 @@ endif endif if ENABLE_HISTORY if ENABLE_PCX - test "`$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media/numbers_pcx/ -K /pcx -K q -F 'stdout _fileindex'`" -lt "`$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media/numbers_pcx/ -K /pcx -K .q -F 'stdout _fileindex'`" # 2 -lt 3 (. after / does repeat action) +# test "`$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media/numbers_pcx/ -K /pcx -K q -F 'stdout _fileindex'`" -lt "`$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media/numbers_pcx/ -K /pcx -K .q -F 'stdout _fileindex'`" # 2 -lt 3 (. after / does repeat action) endif endif if ENABLE_JPEG -- cgit v1.2.3 From 6446e05e48f4ef4781e042e1713866b5c097be6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Laboissi=C3=A8re?= Date: Mon, 15 Apr 2024 08:09:07 -0300 Subject: Disable failing test Forwarded: no Last-Update: 2024-04-14 This patch disables a unit test in Makefile.am, which is mysteriously failing on the autobuilders, but passes flawlessly when the package is built locally. Hopefully, this will be fixed in the future. Gbp-Pq: Name disable-failing-test.patch --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 2c281f6..398e831 100644 --- a/Makefile.am +++ b/Makefile.am @@ -658,7 +658,7 @@ endif endif if ENABLE_HISTORY if ENABLE_PCX - test "`$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media/numbers_pcx/ -K /pcx -K q -F 'stdout _fileindex'`" -lt "`$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media/numbers_pcx/ -K /pcx -K .q -F 'stdout _fileindex'`" # 2 -lt 3 (. after / does repeat action) +# test "`$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media/numbers_pcx/ -K /pcx -K q -F 'stdout _fileindex'`" -lt "`$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media/numbers_pcx/ -K /pcx -K .q -F 'stdout _fileindex'`" # 2 -lt 3 (. after / does repeat action) endif endif if ENABLE_JPEG -- cgit v1.2.3 From 175ae3ea30073300492ea8966fe4a7f5ccc07e8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Laboissi=C3=A8re?= Date: Mon, 15 Apr 2024 08:09:07 -0300 Subject: Drop unit test #20 Forwarded: no Last-Update: 2024-04-15 This is a temporary change, in order to give clues about the autobuild failures. Gbp-Pq: Name drop-test20.patch --- src/testdir/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/testdir/Makefile b/src/testdir/Makefile index b46da7c..c9a0760 100644 --- a/src/testdir/Makefile +++ b/src/testdir/Makefile @@ -9,7 +9,7 @@ FIMPROG = $(BASE)/src/fim # The output goes into a file "valgrind.$PID" (sorry, no test number). # VALGRIND = valgrind --tool=memcheck --leak-check=yes --num-callers=15 --log-file=valgrind.log -SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out test7.out test8.out test9.out test10.out test11.out test12.out test13.out test14.out test15.out test16.out test17.out test18.out test19.out test20.out test21.out test22.out +SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out test7.out test8.out test9.out test10.out test11.out test12.out test13.out test14.out test15.out test16.out test17.out test18.out test19.out test21.out test22.out .SUFFIXES: .in .out -- cgit v1.2.3 From e376804354edfc057885a78e9ea67eb67802c731 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Laboissi=C3=A8re?= Date: Mon, 15 Apr 2024 14:07:12 -0300 Subject: Disable failing test Forwarded: no Last-Update: 2024-04-14 This patch disables a unit test in Makefile.am, which is mysteriously failing on the autobuilders, but passes flawlessly when the package is built locally. Hopefully, this will be fixed in the future. Gbp-Pq: Name disable-failing-test.patch --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 2c281f6..398e831 100644 --- a/Makefile.am +++ b/Makefile.am @@ -658,7 +658,7 @@ endif endif if ENABLE_HISTORY if ENABLE_PCX - test "`$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media/numbers_pcx/ -K /pcx -K q -F 'stdout _fileindex'`" -lt "`$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media/numbers_pcx/ -K /pcx -K .q -F 'stdout _fileindex'`" # 2 -lt 3 (. after / does repeat action) +# test "`$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media/numbers_pcx/ -K /pcx -K q -F 'stdout _fileindex'`" -lt "`$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media/numbers_pcx/ -K /pcx -K .q -F 'stdout _fileindex'`" # 2 -lt 3 (. after / does repeat action) endif endif if ENABLE_JPEG -- cgit v1.2.3 From 7c0ca2ba5f5850403b082a17543b3a432c6dd8c5 Mon Sep 17 00:00:00 2001 From: Michele Martone Date: Mon, 15 Apr 2024 14:07:12 -0300 Subject: Avoid some garbage being printed out in the windowed graphic modes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Forwarded: not-needed Reviewed-By: Rafael Laboissière Last-Update: 2024-04-15 Gbp-Pq: Name avoid-readline-garbage.patch --- src/readline.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/readline.cpp b/src/readline.cpp index 12a53d3..1315ff4 100644 --- a/src/readline.cpp +++ b/src/readline.cpp @@ -465,6 +465,9 @@ void initialize_readline (fim_bool_t with_no_display_device, fim_bool_t wcs) || is_using_output_device(FIM_DDN_INN_SDL) || is_using_output_device(FIM_DDN_INN_GTK) || is_using_output_device(FIM_DDN_INN_IL2) + || is_using_output_device(FIM_DDN_INN_AA) + || is_using_output_device(FIM_DDN_INN_CACA) + || is_using_output_device(FIM_DDN_INN_DUMB) ) rl_prep_term_function=fim_rl_prep_dummy; // default rl_prep_term_function is rl_prep_terminal which call tcsetattr -- not needed here -- cgit v1.2.3 From ee9ac647c74b5e02a627b2fe9bd3741708d9719c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Laboissi=C3=A8re?= Date: Thu, 18 Apr 2024 03:44:56 -0300 Subject: Do not run unit tests that require readline Forwarded: no Last-Update: 2024-04-17 Gbp-Pq: Name disable-readline-tests.patch --- Makefile.am | 12 ++++++------ configure.ac | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Makefile.am b/Makefile.am index 2c281f6..d3a7c18 100644 --- a/Makefile.am +++ b/Makefile.am @@ -166,12 +166,12 @@ endif $(NO_ASAN) $(TIMEOUT_LARGE) \ $(FIM_EXE) $(FIMNORCOPTS) $(top_srcdir)/media/ -o aa=w $(FIMVIDEOTESTOPTS); \ fi -if WANT_READLINE +if WANT_READLINE_TEST_DISABLED_FOR_DEBIAN if test -n "$(DISPLAY)"; then $(NO_ASAN) $(FIM_EXE) $(FIMNORCOPTS) $(top_srcdir)/media/ -o aa=w -C '_debug_commands="k"' -K:quit -K '' | grep pressed.key; fi # readline mode key verbosity endif @if test -n "$(DISPLAY)"; then make autodevtests; fi # extras for readline and caption related: -if WANT_READLINE +if WANT_READLINE_TEST_DISABLED_FOR_DEBIAN $(NO_ASAN) $(FIM_EXE) $(FIMNORCOPTS) -o aa $(top_srcdir)/media/ -K :' 'ne' '' ' -K '' -Kq # completion_display_matches_hook $(NO_ASAN) $(FIM_EXE) $(FIMNORCOPTS) -o aa $(top_srcdir)/media/ -K :' 'n=x' '' ' -K '' -Kq # cover completion of variables echo q | $(NO_ASAN) $(FIM_EXE) $(FIMNORCOPTS) -o aa $(top_srcdir)/media/ -K : # cover fim_rl_getc @@ -191,7 +191,7 @@ endif $(NO_ASAN) $(TIMEOUT_LARGE) \ $(FIM_EXE) $(FIMNORCOPTS) $(top_srcdir)/media/ -o ca=w $(FIMVIDEOTESTOPTS); \ fi -if WANT_READLINE +if WANT_READLINE_TEST_DISABLED_FOR_DEBIAN if test -n "$(DISPLAY)"; then $(NO_ASAN) $(FIM_EXE) $(FIMNORCOPTS) $(top_srcdir)/media/ -o ca=w -C '_debug_commands="k"' -K:quit -K '' | grep pressed.key; fi # readline mode key verbosity endif @if test -n "$(DISPLAY)"; then make autodevtests; fi @@ -748,7 +748,7 @@ else endif test `$(FIM_EXE) $(FIMNORCOPTS) $(top_srcdir)/media/ -o dumb -X --etc-fimrc $(top_srcdir)/scripts/example/set_var.fim -c 'stdout variable;quit' $(SNTZ)` = '0' # note: --no-rc-file and --etc-fimrc are incompatible $(FIM_EXE) $(FIMNORCOPTS) $(top_srcdir)/media/ -o dumb -X --no-internal-config -c 'width;quit !(i:width == 0)' -if WANT_READLINE +if WANT_READLINE_TEST_DISABLED_FOR_DEBIAN $(FIM_EXE) $(FIMNORCOPTS) $(top_srcdir)/media/ -o dumb --no-commandline -K ':quit 10' # quits at second char rm -f record.fim; $(FIM_EXE) $(FIMNORCOPTS) $(top_srcdir)/media/ -o dumb -W record.fim -K ':quit 10' -K ''; grep -q quit.10 record.fim && rm record.fim endif @@ -853,7 +853,7 @@ endif test `$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media -c "bind 'F1' 'stdout 1';_max_iterated_commands=2;" -k 10F1 -k q | tr -d '\n' $(SNTZ)` = 11 # test binding repeat and F1 binding test `$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media -c "bind 'F1' 'stdout 1';_max_iterated_commands=1;" -k 10F1 -k q | tr -d '\n' $(SNTZ)` = 1 # test binding repeat and F1 binding test `$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media -c "bind 'F1' 'stdout 1';_max_iterated_commands=0;" -k 10F1 -k q | tr -d '\n' $(SNTZ)` = 1111111111 # test binding repeat and F1 binding -if WANT_READLINE +if WANT_READLINE_TEST_DISABLED_FOR_DEBIAN if ENABLE_GIF cp -p $(top_srcdir)/media/icon_smile.gif $(top_srcdir)/media/icon_smile.pgm cp -p $(top_srcdir)/media/icon_smile.gif $(top_srcdir)/media/icon_smile.ppm @@ -880,7 +880,7 @@ if ENABLE_GIF endif test "`$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media -c 'stderr; stdout; quit' 2>&1 > /dev/null | grep echo`" = "echo command" # stdout vs stderr test `$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media -c 'stderr "out:due";stdout "out:uno";quit' 2>&1 > /dev/null | grep out $(SNTZ)` = "out:due" # stdout vs stderr -if WANT_READLINE +if WANT_READLINE_TEST_DISABLED_FOR_DEBIAN test `$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media -C set_commandline_mode -K 'stdout "cli"; quit;' -K '' $(SNTZ)` = cli endif test `$(FIM_EXE) $(FIMNORCOPTS) -o dumb -c 'set; stdout _last_cmd_output; quit' | wc -w` -ge 50 # test set diff --git a/configure.ac b/configure.ac index d4a83c0..de74f2d 100644 --- a/configure.ac +++ b/configure.ac @@ -660,6 +660,7 @@ if test x$have_readline = xyes; then fi fi AM_CONDITIONAL(WANT_READLINE, test x$have_readline = xyes) +AM_CONDITIONAL(WANT_READLINE_TEST_DISABLED_FOR_DEBIAN, false) dnl ============= jpeg file handling -- cgit v1.2.3 From 4e84f9643d941284ea9800b6502391077ebe1115 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Laboissi=C3=A8re?= Date: Thu, 18 Apr 2024 13:40:41 -0300 Subject: Do not run unit tests that require readline Forwarded: no Last-Update: 2024-04-18 Gbp-Pq: Name disable-readline-tests.patch --- Makefile.am | 16 ++++++++-------- configure.ac | 2 ++ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Makefile.am b/Makefile.am index 2c281f6..1f19224 100644 --- a/Makefile.am +++ b/Makefile.am @@ -166,12 +166,12 @@ endif $(NO_ASAN) $(TIMEOUT_LARGE) \ $(FIM_EXE) $(FIMNORCOPTS) $(top_srcdir)/media/ -o aa=w $(FIMVIDEOTESTOPTS); \ fi -if WANT_READLINE +if WANT_READLINE_TEST_DISABLED_FOR_DEBIAN if test -n "$(DISPLAY)"; then $(NO_ASAN) $(FIM_EXE) $(FIMNORCOPTS) $(top_srcdir)/media/ -o aa=w -C '_debug_commands="k"' -K:quit -K '' | grep pressed.key; fi # readline mode key verbosity endif @if test -n "$(DISPLAY)"; then make autodevtests; fi # extras for readline and caption related: -if WANT_READLINE +if WANT_READLINE_TEST_DISABLED_FOR_DEBIAN $(NO_ASAN) $(FIM_EXE) $(FIMNORCOPTS) -o aa $(top_srcdir)/media/ -K :' 'ne' '' ' -K '' -Kq # completion_display_matches_hook $(NO_ASAN) $(FIM_EXE) $(FIMNORCOPTS) -o aa $(top_srcdir)/media/ -K :' 'n=x' '' ' -K '' -Kq # cover completion of variables echo q | $(NO_ASAN) $(FIM_EXE) $(FIMNORCOPTS) -o aa $(top_srcdir)/media/ -K : # cover fim_rl_getc @@ -191,7 +191,7 @@ endif $(NO_ASAN) $(TIMEOUT_LARGE) \ $(FIM_EXE) $(FIMNORCOPTS) $(top_srcdir)/media/ -o ca=w $(FIMVIDEOTESTOPTS); \ fi -if WANT_READLINE +if WANT_READLINE_TEST_DISABLED_FOR_DEBIAN if test -n "$(DISPLAY)"; then $(NO_ASAN) $(FIM_EXE) $(FIMNORCOPTS) $(top_srcdir)/media/ -o ca=w -C '_debug_commands="k"' -K:quit -K '' | grep pressed.key; fi # readline mode key verbosity endif @if test -n "$(DISPLAY)"; then make autodevtests; fi @@ -656,7 +656,7 @@ endif $(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media/numbers_pcx/* --// media/numbers_pcx/4.___ -c 'stdout _fileindex;if(_fileindex!=1){quit 255}quit' $(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media/numbers_pcx/* --// media/numbers_pcx/4.pcx -c 'stdout _fileindex;if(_fileindex!=5){quit 255}quit' endif -if ENABLE_HISTORY +if ENABLE_HISTORY_TEST_DISABLED_FOR_DEBIAN if ENABLE_PCX test "`$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media/numbers_pcx/ -K /pcx -K q -F 'stdout _fileindex'`" -lt "`$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media/numbers_pcx/ -K /pcx -K .q -F 'stdout _fileindex'`" # 2 -lt 3 (. after / does repeat action) endif @@ -748,11 +748,11 @@ else endif test `$(FIM_EXE) $(FIMNORCOPTS) $(top_srcdir)/media/ -o dumb -X --etc-fimrc $(top_srcdir)/scripts/example/set_var.fim -c 'stdout variable;quit' $(SNTZ)` = '0' # note: --no-rc-file and --etc-fimrc are incompatible $(FIM_EXE) $(FIMNORCOPTS) $(top_srcdir)/media/ -o dumb -X --no-internal-config -c 'width;quit !(i:width == 0)' -if WANT_READLINE +if WANT_READLINE_TEST_DISABLED_FOR_DEBIAN $(FIM_EXE) $(FIMNORCOPTS) $(top_srcdir)/media/ -o dumb --no-commandline -K ':quit 10' # quits at second char rm -f record.fim; $(FIM_EXE) $(FIMNORCOPTS) $(top_srcdir)/media/ -o dumb -W record.fim -K ':quit 10' -K ''; grep -q quit.10 record.fim && rm record.fim endif -if ENABLE_HISTORY +if ENABLE_HISTORY_TEST_DISABLED_FOR_DEBIAN $(FIM_EXE) $(FIMNORCOPTS) $(top_srcdir)/media/ -o dumb --no-history --no-history-load --no-history-save -kq # FIXME: bogus test rm -f .fim_history && HOME=`pwd` $(FIM_EXE) -N --no-etc-fimrc-file $(top_srcdir)/media/ -o dumb -C 'next;next' -c quit && grep -q '^next;next' .fim_history && rm .fim_history # note: history file may contain spaces newlines etc else @@ -853,7 +853,7 @@ endif test `$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media -c "bind 'F1' 'stdout 1';_max_iterated_commands=2;" -k 10F1 -k q | tr -d '\n' $(SNTZ)` = 11 # test binding repeat and F1 binding test `$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media -c "bind 'F1' 'stdout 1';_max_iterated_commands=1;" -k 10F1 -k q | tr -d '\n' $(SNTZ)` = 1 # test binding repeat and F1 binding test `$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media -c "bind 'F1' 'stdout 1';_max_iterated_commands=0;" -k 10F1 -k q | tr -d '\n' $(SNTZ)` = 1111111111 # test binding repeat and F1 binding -if WANT_READLINE +if WANT_READLINE_TEST_DISABLED_FOR_DEBIAN if ENABLE_GIF cp -p $(top_srcdir)/media/icon_smile.gif $(top_srcdir)/media/icon_smile.pgm cp -p $(top_srcdir)/media/icon_smile.gif $(top_srcdir)/media/icon_smile.ppm @@ -880,7 +880,7 @@ if ENABLE_GIF endif test "`$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media -c 'stderr; stdout; quit' 2>&1 > /dev/null | grep echo`" = "echo command" # stdout vs stderr test `$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media -c 'stderr "out:due";stdout "out:uno";quit' 2>&1 > /dev/null | grep out $(SNTZ)` = "out:due" # stdout vs stderr -if WANT_READLINE +if WANT_READLINE_TEST_DISABLED_FOR_DEBIAN test `$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media -C set_commandline_mode -K 'stdout "cli"; quit;' -K '' $(SNTZ)` = cli endif test `$(FIM_EXE) $(FIMNORCOPTS) -o dumb -c 'set; stdout _last_cmd_output; quit' | wc -w` -ge 50 # test set diff --git a/configure.ac b/configure.ac index d4a83c0..9bcd934 100644 --- a/configure.ac +++ b/configure.ac @@ -660,6 +660,8 @@ if test x$have_readline = xyes; then fi fi AM_CONDITIONAL(WANT_READLINE, test x$have_readline = xyes) +AM_CONDITIONAL(WANT_READLINE_TEST_DISABLED_FOR_DEBIAN, false) +AM_CONDITIONAL(ENABLE_HISTORY_TEST_DISABLED_FOR_DEBIAN, false) dnl ============= jpeg file handling -- cgit v1.2.3 From 76fe93d14cacbf4f277e552cc558f8af7ccda02f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Laboissi=C3=A8re?= Date: Fri, 19 Apr 2024 01:13:12 -0300 Subject: Do not run unit tests that require readline Forwarded: no Last-Update: 2024-04-18 Gbp-Pq: Name disable-readline-tests.patch --- Makefile.am | 16 ++++++++-------- configure.ac | 2 ++ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Makefile.am b/Makefile.am index 2c281f6..1f19224 100644 --- a/Makefile.am +++ b/Makefile.am @@ -166,12 +166,12 @@ endif $(NO_ASAN) $(TIMEOUT_LARGE) \ $(FIM_EXE) $(FIMNORCOPTS) $(top_srcdir)/media/ -o aa=w $(FIMVIDEOTESTOPTS); \ fi -if WANT_READLINE +if WANT_READLINE_TEST_DISABLED_FOR_DEBIAN if test -n "$(DISPLAY)"; then $(NO_ASAN) $(FIM_EXE) $(FIMNORCOPTS) $(top_srcdir)/media/ -o aa=w -C '_debug_commands="k"' -K:quit -K '' | grep pressed.key; fi # readline mode key verbosity endif @if test -n "$(DISPLAY)"; then make autodevtests; fi # extras for readline and caption related: -if WANT_READLINE +if WANT_READLINE_TEST_DISABLED_FOR_DEBIAN $(NO_ASAN) $(FIM_EXE) $(FIMNORCOPTS) -o aa $(top_srcdir)/media/ -K :' 'ne' '' ' -K '' -Kq # completion_display_matches_hook $(NO_ASAN) $(FIM_EXE) $(FIMNORCOPTS) -o aa $(top_srcdir)/media/ -K :' 'n=x' '' ' -K '' -Kq # cover completion of variables echo q | $(NO_ASAN) $(FIM_EXE) $(FIMNORCOPTS) -o aa $(top_srcdir)/media/ -K : # cover fim_rl_getc @@ -191,7 +191,7 @@ endif $(NO_ASAN) $(TIMEOUT_LARGE) \ $(FIM_EXE) $(FIMNORCOPTS) $(top_srcdir)/media/ -o ca=w $(FIMVIDEOTESTOPTS); \ fi -if WANT_READLINE +if WANT_READLINE_TEST_DISABLED_FOR_DEBIAN if test -n "$(DISPLAY)"; then $(NO_ASAN) $(FIM_EXE) $(FIMNORCOPTS) $(top_srcdir)/media/ -o ca=w -C '_debug_commands="k"' -K:quit -K '' | grep pressed.key; fi # readline mode key verbosity endif @if test -n "$(DISPLAY)"; then make autodevtests; fi @@ -656,7 +656,7 @@ endif $(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media/numbers_pcx/* --// media/numbers_pcx/4.___ -c 'stdout _fileindex;if(_fileindex!=1){quit 255}quit' $(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media/numbers_pcx/* --// media/numbers_pcx/4.pcx -c 'stdout _fileindex;if(_fileindex!=5){quit 255}quit' endif -if ENABLE_HISTORY +if ENABLE_HISTORY_TEST_DISABLED_FOR_DEBIAN if ENABLE_PCX test "`$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media/numbers_pcx/ -K /pcx -K q -F 'stdout _fileindex'`" -lt "`$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media/numbers_pcx/ -K /pcx -K .q -F 'stdout _fileindex'`" # 2 -lt 3 (. after / does repeat action) endif @@ -748,11 +748,11 @@ else endif test `$(FIM_EXE) $(FIMNORCOPTS) $(top_srcdir)/media/ -o dumb -X --etc-fimrc $(top_srcdir)/scripts/example/set_var.fim -c 'stdout variable;quit' $(SNTZ)` = '0' # note: --no-rc-file and --etc-fimrc are incompatible $(FIM_EXE) $(FIMNORCOPTS) $(top_srcdir)/media/ -o dumb -X --no-internal-config -c 'width;quit !(i:width == 0)' -if WANT_READLINE +if WANT_READLINE_TEST_DISABLED_FOR_DEBIAN $(FIM_EXE) $(FIMNORCOPTS) $(top_srcdir)/media/ -o dumb --no-commandline -K ':quit 10' # quits at second char rm -f record.fim; $(FIM_EXE) $(FIMNORCOPTS) $(top_srcdir)/media/ -o dumb -W record.fim -K ':quit 10' -K ''; grep -q quit.10 record.fim && rm record.fim endif -if ENABLE_HISTORY +if ENABLE_HISTORY_TEST_DISABLED_FOR_DEBIAN $(FIM_EXE) $(FIMNORCOPTS) $(top_srcdir)/media/ -o dumb --no-history --no-history-load --no-history-save -kq # FIXME: bogus test rm -f .fim_history && HOME=`pwd` $(FIM_EXE) -N --no-etc-fimrc-file $(top_srcdir)/media/ -o dumb -C 'next;next' -c quit && grep -q '^next;next' .fim_history && rm .fim_history # note: history file may contain spaces newlines etc else @@ -853,7 +853,7 @@ endif test `$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media -c "bind 'F1' 'stdout 1';_max_iterated_commands=2;" -k 10F1 -k q | tr -d '\n' $(SNTZ)` = 11 # test binding repeat and F1 binding test `$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media -c "bind 'F1' 'stdout 1';_max_iterated_commands=1;" -k 10F1 -k q | tr -d '\n' $(SNTZ)` = 1 # test binding repeat and F1 binding test `$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media -c "bind 'F1' 'stdout 1';_max_iterated_commands=0;" -k 10F1 -k q | tr -d '\n' $(SNTZ)` = 1111111111 # test binding repeat and F1 binding -if WANT_READLINE +if WANT_READLINE_TEST_DISABLED_FOR_DEBIAN if ENABLE_GIF cp -p $(top_srcdir)/media/icon_smile.gif $(top_srcdir)/media/icon_smile.pgm cp -p $(top_srcdir)/media/icon_smile.gif $(top_srcdir)/media/icon_smile.ppm @@ -880,7 +880,7 @@ if ENABLE_GIF endif test "`$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media -c 'stderr; stdout; quit' 2>&1 > /dev/null | grep echo`" = "echo command" # stdout vs stderr test `$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media -c 'stderr "out:due";stdout "out:uno";quit' 2>&1 > /dev/null | grep out $(SNTZ)` = "out:due" # stdout vs stderr -if WANT_READLINE +if WANT_READLINE_TEST_DISABLED_FOR_DEBIAN test `$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media -C set_commandline_mode -K 'stdout "cli"; quit;' -K '' $(SNTZ)` = cli endif test `$(FIM_EXE) $(FIMNORCOPTS) -o dumb -c 'set; stdout _last_cmd_output; quit' | wc -w` -ge 50 # test set diff --git a/configure.ac b/configure.ac index d4a83c0..9bcd934 100644 --- a/configure.ac +++ b/configure.ac @@ -660,6 +660,8 @@ if test x$have_readline = xyes; then fi fi AM_CONDITIONAL(WANT_READLINE, test x$have_readline = xyes) +AM_CONDITIONAL(WANT_READLINE_TEST_DISABLED_FOR_DEBIAN, false) +AM_CONDITIONAL(ENABLE_HISTORY_TEST_DISABLED_FOR_DEBIAN, false) dnl ============= jpeg file handling -- cgit v1.2.3 From e1602c93affe8dcc49c44812a320aec79b167290 Mon Sep 17 00:00:00 2001 From: Michele Martone Date: Fri, 19 Apr 2024 01:13:12 -0300 Subject: Fix FTBFS on armel, armhf, and i386 (type size mismatch) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Forwarded: no Reviewed-By: Rafael Laboissière Last-Update: 2024-04-19 Gbp-Pq: Name gtk-32bit-string-size-type.patch --- src/GTKDevice.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/GTKDevice.cpp b/src/GTKDevice.cpp index 9fbd991..c5589bb 100644 --- a/src/GTKDevice.cpp +++ b/src/GTKDevice.cpp @@ -713,7 +713,7 @@ void do_rebuild_help_aliases_menu(GtkWidget *aliaMi, const bool help_or_cmd, con gtk_menu_item_set_submenu(GTK_MENU_ITEM(aliaMi), aliaMenu_), gtk_widget_set_tooltip_text(aliaMi, verbose_specs_?s:"" ); - for (auto a0 = 0UL, a1 = aliases_.find(' '); a0 < a1 && a1!=std::string::npos ; a0 = a1+1, a1 = aliases_.find(' ',a1+1) ) + for (decltype(aliases_.find(' ')) a0 = 0UL, a1 = aliases_.find(' '); a0 < a1 && a1!=std::string::npos ; a0 = a1+1, a1 = aliases_.find(' ',a1+1) ) { const auto alias = aliases_.substr(a0,a1-a0); GtkWidget * const aliMi = gtk_menu_item_new_with_label(alias.c_str()); @@ -744,7 +744,7 @@ void do_rebuild_help_variables_menu(GtkWidget *varsMi, const bool help_or_cmd, c gtk_menu_item_set_submenu(GTK_MENU_ITEM(varsMi), varsMenu_), gtk_widget_set_tooltip_text(varsMi, verbose_specs_?s:"" ); - for (auto v0 = 0UL, v1 = variables_.find(' '); v0 < v1 && v1!=std::string::npos ; v0 = v1+1, v1 = variables_.find(' ',v1+1) ) + for (decltype(variables_.find(' ')) v0 = 0UL, v1 = variables_.find(' '); v0 < v1 && v1!=std::string::npos ; v0 = v1+1, v1 = variables_.find(' ',v1+1) ) { const auto var = variables_.substr(v0,v1-v0); //void * vp = (void*) (variables_.c_str()+v0); @@ -779,7 +779,7 @@ void do_rebuild_help_commands_menu(GtkWidget *cmdsMi, const bool help_or_press, gtk_widget_set_tooltip_text(cmdsMi, verbose_specs_?s:"" ); - for (auto c0 = 0UL, c1 = commands_.find(' '); c0 < c1 && c1!=std::string::npos ; c0 = c1+1, c1 = commands_.find(' ',c1+1) ) + for (decltype(commands_.find(' ')) c0 = 0UL, c1 = commands_.find(' '); c0 < c1 && c1!=std::string::npos ; c0 = c1+1, c1 = commands_.find(' ',c1+1) ) { const auto cmd = commands_.substr(c0,c1-c0); //void * cp = (void*) (commands_.c_str()+c0); -- cgit v1.2.3 From 535e7bd8377082d45fc340dd7f2d0c39bea90846 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Laboissi=C3=A8re?= Date: Sat, 20 Apr 2024 01:29:56 -0300 Subject: Do not run unit tests that require readline Forwarded: no Last-Update: 2024-04-18 Gbp-Pq: Name disable-readline-tests.patch --- Makefile.am | 16 ++++++++-------- configure.ac | 2 ++ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Makefile.am b/Makefile.am index 2c281f6..1f19224 100644 --- a/Makefile.am +++ b/Makefile.am @@ -166,12 +166,12 @@ endif $(NO_ASAN) $(TIMEOUT_LARGE) \ $(FIM_EXE) $(FIMNORCOPTS) $(top_srcdir)/media/ -o aa=w $(FIMVIDEOTESTOPTS); \ fi -if WANT_READLINE +if WANT_READLINE_TEST_DISABLED_FOR_DEBIAN if test -n "$(DISPLAY)"; then $(NO_ASAN) $(FIM_EXE) $(FIMNORCOPTS) $(top_srcdir)/media/ -o aa=w -C '_debug_commands="k"' -K:quit -K '' | grep pressed.key; fi # readline mode key verbosity endif @if test -n "$(DISPLAY)"; then make autodevtests; fi # extras for readline and caption related: -if WANT_READLINE +if WANT_READLINE_TEST_DISABLED_FOR_DEBIAN $(NO_ASAN) $(FIM_EXE) $(FIMNORCOPTS) -o aa $(top_srcdir)/media/ -K :' 'ne' '' ' -K '' -Kq # completion_display_matches_hook $(NO_ASAN) $(FIM_EXE) $(FIMNORCOPTS) -o aa $(top_srcdir)/media/ -K :' 'n=x' '' ' -K '' -Kq # cover completion of variables echo q | $(NO_ASAN) $(FIM_EXE) $(FIMNORCOPTS) -o aa $(top_srcdir)/media/ -K : # cover fim_rl_getc @@ -191,7 +191,7 @@ endif $(NO_ASAN) $(TIMEOUT_LARGE) \ $(FIM_EXE) $(FIMNORCOPTS) $(top_srcdir)/media/ -o ca=w $(FIMVIDEOTESTOPTS); \ fi -if WANT_READLINE +if WANT_READLINE_TEST_DISABLED_FOR_DEBIAN if test -n "$(DISPLAY)"; then $(NO_ASAN) $(FIM_EXE) $(FIMNORCOPTS) $(top_srcdir)/media/ -o ca=w -C '_debug_commands="k"' -K:quit -K '' | grep pressed.key; fi # readline mode key verbosity endif @if test -n "$(DISPLAY)"; then make autodevtests; fi @@ -656,7 +656,7 @@ endif $(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media/numbers_pcx/* --// media/numbers_pcx/4.___ -c 'stdout _fileindex;if(_fileindex!=1){quit 255}quit' $(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media/numbers_pcx/* --// media/numbers_pcx/4.pcx -c 'stdout _fileindex;if(_fileindex!=5){quit 255}quit' endif -if ENABLE_HISTORY +if ENABLE_HISTORY_TEST_DISABLED_FOR_DEBIAN if ENABLE_PCX test "`$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media/numbers_pcx/ -K /pcx -K q -F 'stdout _fileindex'`" -lt "`$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media/numbers_pcx/ -K /pcx -K .q -F 'stdout _fileindex'`" # 2 -lt 3 (. after / does repeat action) endif @@ -748,11 +748,11 @@ else endif test `$(FIM_EXE) $(FIMNORCOPTS) $(top_srcdir)/media/ -o dumb -X --etc-fimrc $(top_srcdir)/scripts/example/set_var.fim -c 'stdout variable;quit' $(SNTZ)` = '0' # note: --no-rc-file and --etc-fimrc are incompatible $(FIM_EXE) $(FIMNORCOPTS) $(top_srcdir)/media/ -o dumb -X --no-internal-config -c 'width;quit !(i:width == 0)' -if WANT_READLINE +if WANT_READLINE_TEST_DISABLED_FOR_DEBIAN $(FIM_EXE) $(FIMNORCOPTS) $(top_srcdir)/media/ -o dumb --no-commandline -K ':quit 10' # quits at second char rm -f record.fim; $(FIM_EXE) $(FIMNORCOPTS) $(top_srcdir)/media/ -o dumb -W record.fim -K ':quit 10' -K ''; grep -q quit.10 record.fim && rm record.fim endif -if ENABLE_HISTORY +if ENABLE_HISTORY_TEST_DISABLED_FOR_DEBIAN $(FIM_EXE) $(FIMNORCOPTS) $(top_srcdir)/media/ -o dumb --no-history --no-history-load --no-history-save -kq # FIXME: bogus test rm -f .fim_history && HOME=`pwd` $(FIM_EXE) -N --no-etc-fimrc-file $(top_srcdir)/media/ -o dumb -C 'next;next' -c quit && grep -q '^next;next' .fim_history && rm .fim_history # note: history file may contain spaces newlines etc else @@ -853,7 +853,7 @@ endif test `$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media -c "bind 'F1' 'stdout 1';_max_iterated_commands=2;" -k 10F1 -k q | tr -d '\n' $(SNTZ)` = 11 # test binding repeat and F1 binding test `$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media -c "bind 'F1' 'stdout 1';_max_iterated_commands=1;" -k 10F1 -k q | tr -d '\n' $(SNTZ)` = 1 # test binding repeat and F1 binding test `$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media -c "bind 'F1' 'stdout 1';_max_iterated_commands=0;" -k 10F1 -k q | tr -d '\n' $(SNTZ)` = 1111111111 # test binding repeat and F1 binding -if WANT_READLINE +if WANT_READLINE_TEST_DISABLED_FOR_DEBIAN if ENABLE_GIF cp -p $(top_srcdir)/media/icon_smile.gif $(top_srcdir)/media/icon_smile.pgm cp -p $(top_srcdir)/media/icon_smile.gif $(top_srcdir)/media/icon_smile.ppm @@ -880,7 +880,7 @@ if ENABLE_GIF endif test "`$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media -c 'stderr; stdout; quit' 2>&1 > /dev/null | grep echo`" = "echo command" # stdout vs stderr test `$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media -c 'stderr "out:due";stdout "out:uno";quit' 2>&1 > /dev/null | grep out $(SNTZ)` = "out:due" # stdout vs stderr -if WANT_READLINE +if WANT_READLINE_TEST_DISABLED_FOR_DEBIAN test `$(FIM_EXE) $(FIMNORCOPTS) -o dumb $(top_srcdir)/media -C set_commandline_mode -K 'stdout "cli"; quit;' -K '' $(SNTZ)` = cli endif test `$(FIM_EXE) $(FIMNORCOPTS) -o dumb -c 'set; stdout _last_cmd_output; quit' | wc -w` -ge 50 # test set diff --git a/configure.ac b/configure.ac index d4a83c0..9bcd934 100644 --- a/configure.ac +++ b/configure.ac @@ -660,6 +660,8 @@ if test x$have_readline = xyes; then fi fi AM_CONDITIONAL(WANT_READLINE, test x$have_readline = xyes) +AM_CONDITIONAL(WANT_READLINE_TEST_DISABLED_FOR_DEBIAN, false) +AM_CONDITIONAL(ENABLE_HISTORY_TEST_DISABLED_FOR_DEBIAN, false) dnl ============= jpeg file handling -- cgit v1.2.3 From 160e144d38825099faee32ccb5bd05da510c3a88 Mon Sep 17 00:00:00 2001 From: Michele Martone Date: Sat, 20 Apr 2024 01:29:56 -0300 Subject: Fix FTBFS on armel, armhf, and i386 (type size mismatch) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Forwarded: no Reviewed-By: Rafael Laboissière Last-Update: 2024-04-19 Gbp-Pq: Name gtk-32bit-string-size-type.patch --- src/GTKDevice.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/GTKDevice.cpp b/src/GTKDevice.cpp index 9fbd991..c5589bb 100644 --- a/src/GTKDevice.cpp +++ b/src/GTKDevice.cpp @@ -713,7 +713,7 @@ void do_rebuild_help_aliases_menu(GtkWidget *aliaMi, const bool help_or_cmd, con gtk_menu_item_set_submenu(GTK_MENU_ITEM(aliaMi), aliaMenu_), gtk_widget_set_tooltip_text(aliaMi, verbose_specs_?s:"" ); - for (auto a0 = 0UL, a1 = aliases_.find(' '); a0 < a1 && a1!=std::string::npos ; a0 = a1+1, a1 = aliases_.find(' ',a1+1) ) + for (decltype(aliases_.find(' ')) a0 = 0UL, a1 = aliases_.find(' '); a0 < a1 && a1!=std::string::npos ; a0 = a1+1, a1 = aliases_.find(' ',a1+1) ) { const auto alias = aliases_.substr(a0,a1-a0); GtkWidget * const aliMi = gtk_menu_item_new_with_label(alias.c_str()); @@ -744,7 +744,7 @@ void do_rebuild_help_variables_menu(GtkWidget *varsMi, const bool help_or_cmd, c gtk_menu_item_set_submenu(GTK_MENU_ITEM(varsMi), varsMenu_), gtk_widget_set_tooltip_text(varsMi, verbose_specs_?s:"" ); - for (auto v0 = 0UL, v1 = variables_.find(' '); v0 < v1 && v1!=std::string::npos ; v0 = v1+1, v1 = variables_.find(' ',v1+1) ) + for (decltype(variables_.find(' ')) v0 = 0UL, v1 = variables_.find(' '); v0 < v1 && v1!=std::string::npos ; v0 = v1+1, v1 = variables_.find(' ',v1+1) ) { const auto var = variables_.substr(v0,v1-v0); //void * vp = (void*) (variables_.c_str()+v0); @@ -779,7 +779,7 @@ void do_rebuild_help_commands_menu(GtkWidget *cmdsMi, const bool help_or_press, gtk_widget_set_tooltip_text(cmdsMi, verbose_specs_?s:"" ); - for (auto c0 = 0UL, c1 = commands_.find(' '); c0 < c1 && c1!=std::string::npos ; c0 = c1+1, c1 = commands_.find(' ',c1+1) ) + for (decltype(commands_.find(' ')) c0 = 0UL, c1 = commands_.find(' '); c0 < c1 && c1!=std::string::npos ; c0 = c1+1, c1 = commands_.find(' ',c1+1) ) { const auto cmd = commands_.substr(c0,c1-c0); //void * cp = (void*) (commands_.c_str()+c0); -- cgit v1.2.3 From 00b7e0c89016516952a85707561723b8cd1dadfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Laboissi=C3=A8re?= Date: Sat, 20 Apr 2024 01:29:56 -0300 Subject: Allow setting of fim exectuable via FIM_EXE variable Forwarded: no Last-Update: 2024-04-19 Gbp-Pq: Name fim-exe-version-sh.patch --- scripts/tests/version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/tests/version.sh b/scripts/tests/version.sh index 334e99f..72a9bf7 100755 --- a/scripts/tests/version.sh +++ b/scripts/tests/version.sh @@ -3,7 +3,7 @@ # tests the -V switch in fim # TODO : should be integrated in the vim-like test suite. -f=src/fim +f=${FIM_EXE-src/fim} fail() { -- cgit v1.2.3