From d4ac44b77c483da96640d2909702229703d7c3d2 Mon Sep 17 00:00:00 2001 From: juan Date: Mon, 2 Aug 2021 21:45:24 +0800 Subject: [PATCH] Initial Commit --- ANNOUNCE | 99 +++ AUTHORS | 8 + COPYING | 339 +++++++++ ChangeLog | 25 + INSTALL | 12 + Makefile.am | 6 + Makefile.in | 438 +++++++++++ NEWS | 4 + README | 111 +++ README.flip | 98 +++ TODO | 1 + aclocal.m4 | 297 ++++++++ asciiview | 73 ++ asciiview.1 | 44 ++ aview.1 | 44 ++ aview.lsm | 31 + config.h.in | 14 + configure | 1951 +++++++++++++++++++++++++++++++++++++++++++++++++ configure.in | 20 + fli.h | 46 ++ flip.c | 920 +++++++++++++++++++++++ general.c | 7 + general.h | 41 ++ image.c | 112 +++ image.h | 6 + install-sh | 238 ++++++ main.c | 57 ++ missing | 190 +++++ mkinstalldirs | 40 + shrink.c | 138 ++++ shrink.h | 4 + stamp-h.in | 1 + ui.c | 475 ++++++++++++ ui.h | 7 + 34 files changed, 5897 insertions(+) create mode 100644 ANNOUNCE create mode 100644 AUTHORS create mode 100644 COPYING create mode 100644 ChangeLog 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.flip create mode 100644 TODO create mode 100644 aclocal.m4 create mode 100755 asciiview create mode 100644 asciiview.1 create mode 100644 aview.1 create mode 100644 aview.lsm create mode 100644 config.h.in create mode 100755 configure create mode 100644 configure.in create mode 100644 fli.h create mode 100644 flip.c create mode 100644 general.c create mode 100644 general.h create mode 100644 image.c create mode 100644 image.h create mode 100755 install-sh create mode 100644 main.c create mode 100755 missing create mode 100755 mkinstalldirs create mode 100644 shrink.c create mode 100644 shrink.h create mode 100644 stamp-h.in create mode 100644 ui.c create mode 100644 ui.h diff --git a/ANNOUNCE b/ANNOUNCE new file mode 100644 index 0000000..7b4763c --- /dev/null +++ b/ANNOUNCE @@ -0,0 +1,99 @@ + + Since version 1.0 was very broken (released in a hurry) there +is bugfixing 1.1. Only known problem at the moment is that aaflip +don't work at non intel platforms. There is many fixes and also +some new features. Most notable are MS-DOS version, support for +all p?m file formats, user interface for aaflip and asciiview +script that browses many image formats using ImageMagick or NetPBM +tools. + +What does this software do then ? +================================= + + aview is an high quality ascii-art image(pnm) browser and +animation(fli/flc) player usefull especially with lynx browser. + +Supports: dos (VGA + MDA), stdio, curses, slang, X11, gpm, linux-console + +Features +======== + o High quality ascii art rendering + o Portable + o Save into many formats (html, text, ansi, more/less etc...) + o Contrast, Bright, Gamma control + o Image zooming/unzooming + o Three dithering modes + o Hidden "bonus" features :) + o Inversion + o Support for bright, dim, inverse attributes/extended + character set + +What is PNM file format? +======================== + + PNM if an graphics format similiar to GIF, JPEG, PNG, TIFF and +others. Aview uses it because of its simplicity. Many free or shareware +conversion tools from other graphics format exist (ImageMagick, NetPBM +for UNIX, alchemy for DOS and others.) So you should use aview to +browse images in many graphics format. UNIX version has script that +does conversion automatically (using eighter NetPBM (preffered way) +or ImageMagic conversion program. FIFO is used to do not waste your +disc space so conversion is fully transparent. Under DOS and other +operating systems you probably need to do it yourself. + +ChangeLog +========= + o Fixed bugs in Makefile + o Do not require efence anymore + o Configure script + o Fixed memory leak in flip.c + o Hide cursor + o Extended documentation + o Faster animation preloading + o Uses faster memcpy/memset functions + o image.c now reads P1 - P6 file formats (pgm, ppm, pnm both raw/ascii) + o gifview obsoleted by asciiview - new script that uses eighter + imagemagick or netpbm tools to convert image using fifo. + So it is fast and saves memory/disk space + o Added some keys into aaflip - contrast, bright, gamma tunning etc. + Press 'H' for help + +Where to find Aview +=================== + + Just join our mailing list: `aa@horac.ta.jcu.cz'. Send: +subscribe aa +to majordomo@horac.ta.jcu.cz + + All programs covered under AA-project can be obtained at +`ftp://ftp.ta.jcu.cz://pub/aa'. + + Or just browse our homepage at `http://www.ta.jcu.cz://aa'. A ton of +examples of ascii-art generated by aalib, pointers to other AA-Project +resources etc. + +AA-Project +========== + + dT8 8Tb + dT 8 8 Tb + dT 8 8 Tb + + dT 8 8 Tb + dT 8 8 Tb + +Three goals of AA-Project: + + 1. Port all important software (like Doom, Second Reality, X windows + etc..) on AA-lib. + + 2. Port AA-lib on all available platforms (mainly ZX-Spectrum and + Sharp). + + 3. Force IBM to start manufacturing MDA cards again. + + AA-project was started by Jan Hubicka. In that times just a few +people knew about it. Then a new demo named BB has been relased to show +the power of AA-lib technology. Now the project is freely available and +anyone can help. + diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..4dec007 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,8 @@ +Jan Hubicka + - Original code, maitainer +Kamil Toman + - Maitenance of version 1.2 +Ladislav Michl + - Number of fixes and improvements +Michael Bramer + - Debian package maitainer; author of manual pages. diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..e77696a --- /dev/null +++ b/COPYING @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, 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 + + 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., 675 Mass Ave, Cambridge, MA 02139, 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..e090ebe --- /dev/null +++ b/ChangeLog @@ -0,0 +1,25 @@ +Changed in version 1.3 + o Fixed asciiview script to properly fall back to imagemagick + o Added manual pages + o Converted to automake + o Fixed crashes and compilation problems. +Changes in version 1.2 + o Updated for aalib-1.1 + o Better 'u' menu +Changes in version 1.1 + o Fixed bugs in Makefile + o Do not require efence anymore + o Configure script + o Fixed memory leak in flip.c + o Hide cursor + o Extended documentation + o Faster animation preloading + o Uses faster memcpy/memset functions + o image.c now reads P1 - P6 file formats (pgm, ppm, pnm both raw/ascii) + o gifview obsoleted by asciiview - new script that uses eighter + imagemagick or netpbm tools to convert image using fifo. + So it is fast and saves memory/disk space + o Added some keys into aaflip - contrast, bright, gamma tunning etc. + Press 'H' for help +Changes in version 1.0 + o First version (released in a hurry and very broken) diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..2de8540 --- /dev/null +++ b/INSTALL @@ -0,0 +1,12 @@ + +To compile Aview at UNIX enviroment use: + +./configure +make +make install + +This should work in most cases. I believe. + +MS-DOS users: + +make -f Makefile.dos diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..962b2c3 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,6 @@ +bin_PROGRAMS = aview aaflip +aview_SOURCES = image.c main.c shrink.c ui.c +aaflip_SOURCES = flip.c general.c +bin_SCRIPTS = asciiview +man_MANS = aview.1 asciiview.1 +EXTRA_DIST = fli.h general.h shrink.h ui.h TODO README.flip ANNOUNCE aview.lsm image.h aview.1 asciiview.1 asciiview diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..99fe22c --- /dev/null +++ b/Makefile.in @@ -0,0 +1,438 @@ +# Makefile.in generated automatically by automake 1.4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 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. + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = . + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +AALIB_CFLAGS = @AALIB_CFLAGS@ +AALIB_CONFIG = @AALIB_CONFIG@ +AALIB_LIBS = @AALIB_LIBS@ +CC = @CC@ +MAKEINFO = @MAKEINFO@ +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ + +bin_PROGRAMS = aview aaflip +aview_SOURCES = image.c main.c shrink.c ui.c +aaflip_SOURCES = flip.c general.c +bin_SCRIPTS = asciiview +man_MANS = aview.1 asciiview.1 +EXTRA_DIST = fli.h general.h shrink.h ui.h TODO README.flip ANNOUNCE aview.lsm image.h aview.1 asciiview.1 asciiview +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = +PROGRAMS = $(bin_PROGRAMS) + + +DEFS = @DEFS@ -I. -I$(srcdir) -I. +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +aview_OBJECTS = image.o main.o shrink.o ui.o +aview_LDADD = $(LDADD) +aview_DEPENDENCIES = +aview_LDFLAGS = +aaflip_OBJECTS = flip.o general.o +aaflip_LDADD = $(LDADD) +aaflip_DEPENDENCIES = +aaflip_LDFLAGS = +SCRIPTS = $(bin_SCRIPTS) + +CFLAGS = @CFLAGS@ +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +man1dir = $(mandir)/man1 +MANS = $(man_MANS) + +NROFF = nroff +DIST_COMMON = README ./stamp-h.in AUTHORS COPYING ChangeLog INSTALL \ +Makefile.am Makefile.in NEWS TODO aclocal.m4 config.h.in configure \ +configure.in install-sh missing mkinstalldirs + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = tar +GZIP_ENV = --best +SOURCES = $(aview_SOURCES) $(aaflip_SOURCES) +OBJECTS = $(aview_OBJECTS) $(aaflip_OBJECTS) + +all: all-redirect +.SUFFIXES: +.SUFFIXES: .S .c .o .s +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +$(ACLOCAL_M4): configure.in + cd $(srcdir) && $(ACLOCAL) + +config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck +$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) + cd $(srcdir) && $(AUTOCONF) + +config.h: stamp-h + @if test ! -f $@; then \ + rm -f stamp-h; \ + $(MAKE) stamp-h; \ + else :; fi +stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES= CONFIG_HEADERS=config.h \ + $(SHELL) ./config.status + @echo timestamp > stamp-h 2> /dev/null +$(srcdir)/config.h.in: $(srcdir)/stamp-h.in + @if test ! -f $@; then \ + rm -f $(srcdir)/stamp-h.in; \ + $(MAKE) $(srcdir)/stamp-h.in; \ + else :; fi +$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOHEADER) + @echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null + +mostlyclean-hdr: + +clean-hdr: + +distclean-hdr: + -rm -f config.h + +maintainer-clean-hdr: + +mostlyclean-binPROGRAMS: + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + +distclean-binPROGRAMS: + +maintainer-clean-binPROGRAMS: + +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(bindir) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \ + $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + list='$(bin_PROGRAMS)'; for p in $$list; do \ + rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + done + +.c.o: + $(COMPILE) -c $< + +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + +mostlyclean-compile: + -rm -f *.o core *.core + +clean-compile: + +distclean-compile: + -rm -f *.tab.c + +maintainer-clean-compile: + +aview: $(aview_OBJECTS) $(aview_DEPENDENCIES) + @rm -f aview + $(LINK) $(aview_LDFLAGS) $(aview_OBJECTS) $(aview_LDADD) $(LIBS) + +aaflip: $(aaflip_OBJECTS) $(aaflip_DEPENDENCIES) + @rm -f aaflip + $(LINK) $(aaflip_LDFLAGS) $(aaflip_OBJECTS) $(aaflip_LDADD) $(LIBS) + +install-binSCRIPTS: $(bin_SCRIPTS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(bindir) + @list='$(bin_SCRIPTS)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \ + $(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \ + else if test -f $(srcdir)/$$p; then \ + echo " $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \ + $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \ + else :; fi; fi; \ + done + +uninstall-binSCRIPTS: + @$(NORMAL_UNINSTALL) + list='$(bin_SCRIPTS)'; for p in $$list; do \ + rm -f $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \ + done + +install-man1: + $(mkinstalldirs) $(DESTDIR)$(man1dir) + @list='$(man1_MANS)'; \ + l2='$(man_MANS)'; for i in $$l2; do \ + case "$$i" in \ + *.1*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ + else file=$$i; fi; \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst"; \ + $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst; \ + done + +uninstall-man1: + @list='$(man1_MANS)'; \ + l2='$(man_MANS)'; for i in $$l2; do \ + case "$$i" in \ + *.1*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " rm -f $(DESTDIR)$(man1dir)/$$inst"; \ + rm -f $(DESTDIR)$(man1dir)/$$inst; \ + done +install-man: $(MANS) + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-man1 +uninstall-man: + @$(NORMAL_UNINSTALL) + $(MAKE) $(AM_MAKEFLAGS) uninstall-man1 + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(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 + -rm -rf $(distdir) + GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz + mkdir $(distdir)/=build + mkdir $(distdir)/=inst + dc_install_base=`cd $(distdir)/=inst && pwd`; \ + cd $(distdir)/=build \ + && ../configure --srcdir=.. --prefix=$$dc_install_base \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) dist + -rm -rf $(distdir) + @banner="$(distdir).tar.gz is ready for distribution"; \ + dashes=`echo "$$banner" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + echo "$$dashes" +dist: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +dist-all: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +distdir: $(DISTFILES) + -rm -rf $(distdir) + mkdir $(distdir) + -chmod 777 $(distdir) + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +flip.o: flip.c general.h fli.h +general.o: general.c general.h +image.o: image.c config.h +main.o: main.c image.h ui.h config.h +shrink.o: shrink.c image.h shrink.h +ui.o: ui.c shrink.h image.h + +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: all-am +check: check-am +installcheck-am: +installcheck: installcheck-am +all-recursive-am: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +install-exec-am: install-binPROGRAMS install-binSCRIPTS +install-exec: install-exec-am + +install-data-am: install-man +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS uninstall-man +uninstall: uninstall-am +all-am: Makefile $(PROGRAMS) $(SCRIPTS) $(MANS) config.h +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(bindir) \ + $(DESTDIR)$(mandir)/man1 + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-hdr mostlyclean-binPROGRAMS \ + mostlyclean-compile mostlyclean-tags \ + mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-hdr clean-binPROGRAMS clean-compile clean-tags \ + clean-generic mostlyclean-am + +clean: clean-am + +distclean-am: distclean-hdr distclean-binPROGRAMS distclean-compile \ + distclean-tags distclean-generic clean-am + +distclean: distclean-am + -rm -f config.status + +maintainer-clean-am: maintainer-clean-hdr maintainer-clean-binPROGRAMS \ + maintainer-clean-compile maintainer-clean-tags \ + maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + -rm -f config.status + +.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \ +mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \ +maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \ +mostlyclean-compile distclean-compile clean-compile \ +maintainer-clean-compile uninstall-binSCRIPTS install-binSCRIPTS \ +install-man1 uninstall-man1 install-man uninstall-man tags \ +mostlyclean-tags distclean-tags clean-tags maintainer-clean-tags \ +distdir info-am info dvi-am dvi check check-am installcheck-am \ +installcheck all-recursive-am install-exec-am install-exec \ +install-data-am install-data install-am install uninstall-am uninstall \ +all-redirect all-am all installdirs mostlyclean-generic \ +distclean-generic clean-generic maintainer-clean-generic clean \ +mostlyclean distclean maintainer-clean + + +# 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..d3b223f --- /dev/null +++ b/NEWS @@ -0,0 +1,4 @@ +News since version 1.2 + - Turned to automake + - Bugfixes + - Compilation fixed on glibc2 based systems diff --git a/README b/README new file mode 100644 index 0000000..e98db3b --- /dev/null +++ b/README @@ -0,0 +1,111 @@ +What does this software do then ? +================================= + + aview is an high quality ascii-art image(pnm) browser and +animation(fli/flc) player usefull especially with lynx browser. + +Supports: dos (VGA + MDA), stdio, curses, slang, X11, gpm, linux-console + +Features +======== + o High quality ascii art rendering + o Portable + o Save into many formats (html, text, ansi, more/less etc...) + o Contrast, Bright, Gamma control + o Image zooming/unzooming + o Three dithering modes + o Hidden "bonus" features :) + o Inversion + o Support for bright, dim, inverse attributes/extended + character set + +What is PNM file format? +======================== + + PNM if an graphics format similiar to GIF, JPEG, PNG, TIFF and +others. Aview uses it because of its simplicity. Many free or shareware +conversion tools from other graphics format exist (ImageMagick, NetPBM +for UNIX, alchemy for DOS and others.) So you should use aview to +browse images in many graphics format. UNIX version has script that +does conversion automatically (using eighter NetPBM (preffered way) +or ImageMagic conversion program. FIFO is used to do not waste your +disc space so conversion is fully transparent. Under DOS and other +operating systems you probably need to do it yourself. + +Usage +===== + + UNIX: + asciiview [filenames] [options] + + to browse any image format supported by NetPBM or ImageMagick. Use OTHERS + way if you don't have installed these tools + + options should be listed using aview or aaflip program when used w/o + parameters + + OTHERS: + aview [options] [filename] + + To browse pbm pgm ppm or pnm image. + + aaflip [options] [filename] + + to browse fli or flc animation + +Once aview is started use 'H' for help about keys. + +How this all started +==================== + + Once upon a time we've (my friend Kamil and I) bought two old +Herculeses as secondary monitors. We didn't know for that time that our +Diamond Stealths 64 cards would become obsolete soon. The next day we +downloaded the logo of Linux Texas Users Group - nice silly penguin +looking like a cowboy! It was so exciting logo ... we decided that we +couldn't live without it and we wanted to see it at boot time as a logo +on our secondary monitors. There was a small problem - Hercules doesn't +support color graphics. So we decided to convert the penguin image to +ascii art using netpbm tools. + + The output was very ugly because the converting algorithm was +absolutly stupid. During the night I designed a new convertor that +used a font bitmap to creat an aproximation table. The output wasn't +very good since the algorithm wasn't tuned so well. Many months this +small piece of code was waiting on my disc for the day "D". Meanwhile I +started a new project XaoS (a fractal zoomer) with my friend Thomas. +And then I got an idea: Ascii Art Mandelbrots! I was really impressed +by the result! XaoS was faster, portable and looking much better than +ever before. I found a new way to go ... + + +AA-Project +========== + + dT8 8Tb + dT 8 8 Tb + dT 8 8 Tb + + dT 8 8 Tb + dT 8 8 Tb + +Three goals of AA-Project: + + 1. Port all important software (like Doom, Second Reality, X windows + etc..) on AA-lib. + + 2. Port AA-lib on all available platforms (mainly ZX-Spectrum and + Sharp). + + 3. Force IBM to start manufacturing MDA cards again. + + AA-project was started by Jan Hubicka. In that times just a few +people knew about it. Then a new demo named BB has been relased to show +the power of AA-lib technology. Now the project is freely available and +anyone can help. + +Where to find Aview +=================== + + All programs covered under AA-project can be obtained at +`http://aa-project.sourceforge.net'. diff --git a/README.flip b/README.flip new file mode 100644 index 0000000..79a9260 --- /dev/null +++ b/README.flip @@ -0,0 +1,98 @@ +aaflip -- an ascii arted flic player for aalib +Version 0.3 +This is modifies version of flip(flic animation file player, see bellow) +that works in text mode. + +ORIGINAL FLIP README +==================== + + +flip -- a flic file player for the Linux console +Version 0.3 +By John Remyn + +This is a non-X flic animation file player for Linux. A VGA compatible card +is required. + +Flic files can usually be recognized by the .fli or .flc extensions at the +end of their filenames. Fli files are limited to a resolution of 320x200, +while flc files can have any resolution. + +The binary requires svgalib to be installed (svgalib can be found at +sunsite.unc.edu: /pub/Linux/libs). + +The default method of playing is to load the first frame of the animation +sequence and display it. After this the remainder of the flic file is loaded +into memory, and the animation starts. The animation ends when q or ctrl-c +is pressed. There are some flags that control the way the flic file is +handled: + +-a Remove frames from memory after processing. Using this option + leaves more memory for other processes, but relies on the buffer + cache for continuous animation. + +-b Process frames immediately as they are loaded. When using this + option the animation frames are shown as soon as the player has read + them, so you don't have to wait until the entire file has been + read. The disadvantage is that the animation becomes jumpy if the + speed set by the animation is higher than the speed of loading. + +-c Keep the screen black while loading the animation. This conflicts + with option b, which can give interesting results. + +-f This removes the clock synchronization. This is just for fun, so + you can show off the speed of your computer :-) + +-n + Play the flic file times. + +-s + Sets the delay between frames to *0.01 seconds. Option -s 0 + is the same as -f. + +- Causes flip to read the flic file from stdin. Using this with option + -a may cause trouble since backward seeks are done. + +Other options are: + +-v Shows some information about the flic file being played. + +-? Shows a bit of help. + +Flc files: +Flc files with resolutions higher than 320x200 are now supported, out of the +3 files I could find, 2 work OK, 1 works almost OK. +There are some considerations to be made when playing big flic files. If the +file fits completely into memory, there are no problems. However when memory +is short Linux swaps pages out of memory, which can happen while a frame is +being decoded. This is not only slow but also results in very ugly +animation. Animation improves when option -a is used, in which case there +will be much less swapping (there still is a lot of disk/buffer-cache access +going on though). Using option -b is also advisable since the animation +won't be smooth anyway. + + +Bugs: +- X and Y offsets are not handled. +- Flic files with resolutions smaller (or bigger) than the screen size are + probably not handled correctly, but I have yet to see one. +- At least one of the flc files I have displays a few pixels of trash in a + place where they should definately not be. This could be caused by + incorrect handling of a page break. When I feel motivated enough I'll try + and fix it. + + +Release history: + +V0.3a Added support for FLC files with resolutions greater than 320x200. + (A real pain) + +V0.2a Added decoding of DELTA_FLC chunks, so some flc files can also be + played. Changed the command line parameters. Removed some small + bugs. + +V0.1 First release, only just capable of playing fli files. + + +John Remyn (author) (boogyman@xs4all.hacktic.nl may work soon) +Harm Hanemaayer hhanemaa@cs.ruu.nl (for mail) diff --git a/TODO b/TODO new file mode 100644 index 0000000..868cdb6 --- /dev/null +++ b/TODO @@ -0,0 +1 @@ +o Make aaflip working at non intel platforms diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000..8b713f4 --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,297 @@ +dnl aclocal.m4 generated automatically by aclocal 1.4 + +dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without +dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A +dnl PARTICULAR PURPOSE. + +# Do all the work for Automake. 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. + +# serial 1 + +dnl Usage: +dnl AM_INIT_AUTOMAKE(package,version, [no-define]) + +AC_DEFUN(AM_INIT_AUTOMAKE, +[AC_REQUIRE([AC_PROG_INSTALL]) +PACKAGE=[$1] +AC_SUBST(PACKAGE) +VERSION=[$2] +AC_SUBST(VERSION) +dnl test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi +ifelse([$3],, +AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) +AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) +AC_REQUIRE([AM_SANITY_CHECK]) +AC_REQUIRE([AC_ARG_PROGRAM]) +dnl FIXME This is truly gross. +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_REQUIRE([AC_PROG_MAKE_SET])]) + +# +# Check to make sure that the build environment is sane. +# + +AC_DEFUN(AM_SANITY_CHECK, +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftestfile +# 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 conftestfile 2> /dev/null` + if test "[$]*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "[$]*" != "X $srcdir/configure conftestfile" \ + && test "[$]*" != "X conftestfile $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" = conftestfile + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +rm -f conftest* +AC_MSG_RESULT(yes)]) + +dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) +dnl The program must properly implement --version. +AC_DEFUN(AM_MISSING_PROG, +[AC_MSG_CHECKING(for working $2) +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if ($2 --version) < /dev/null > /dev/null 2>&1; then + $1=$2 + AC_MSG_RESULT(found) +else + $1="$3/missing $2" + AC_MSG_RESULT(missing) +fi +AC_SUBST($1)]) + +# Like AC_CONFIG_HEADER, but automatically create stamp file. + +AC_DEFUN(AM_CONFIG_HEADER, +[AC_PREREQ([2.12]) +AC_CONFIG_HEADER([$1]) +dnl When config.status generates a header, we must update the stamp-h file. +dnl This file resides in the same directory as the config header +dnl that is generated. We must strip everything past the first ":", +dnl and everything past the last "/". +AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl +ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>, +<>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>, +<>; do + case " <<$>>CONFIG_HEADERS " in + *" <<$>>am_file "*<<)>> + echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx + ;; + esac + am_indx=`expr "<<$>>am_indx" + 1` +done<<>>dnl>>) +changequote([,]))]) + +# Configure paths for AALIB +# Jan Hubicka 4/22/2001 +# stolen from Sam Lantinga 9/21/99 +# stolen from Manish Singh +# stolen back from Frank Belew +# stolen from Manish Singh +# Shamelessly stolen from Owen Taylor + +dnl AM_PATH_AALIB([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for AALIB, and define AALIB_CFLAGS and AALIB_LIBS +dnl +AC_DEFUN(AM_PATH_AALIB, +[dnl +dnl Get the cflags and libraries from the aalib-config script +dnl +AC_ARG_WITH(aalib-prefix,[ --with-aalib-prefix=PFX Prefix where AALIB is installed (optional)], + aalib_prefix="$withval", aalib_prefix="") +AC_ARG_WITH(aalib-exec-prefix,[ --with-aalib-exec-prefix=PFX Exec prefix where AALIB is installed (optional)], + aalib_exec_prefix="$withval", aalib_exec_prefix="") +AC_ARG_ENABLE(aalibtest, [ --disable-aalibtest Do not try to compile and run a test AALIB program], + , enable_aalibtest=yes) + + if test x$aalib_exec_prefix != x ; then + aalib_args="$aalib_args --exec-prefix=$aalib_exec_prefix" + if test x${AALIB_CONFIG+set} != xset ; then + AALIB_CONFIG=$aalib_exec_prefix/bin/aalib-config + fi + fi + if test x$aalib_prefix != x ; then + aalib_args="$aalib_args --prefix=$aalib_prefix" + if test x${AALIB_CONFIG+set} != xset ; then + AALIB_CONFIG=$aalib_prefix/bin/aalib-config + fi + fi + + AC_PATH_PROG(AALIB_CONFIG, aalib-config, no) + min_aalib_version=ifelse([$1], ,0.11.0,$1) + AC_MSG_CHECKING(for AALIB - version >= $min_aalib_version) + no_aalib="" + if test "$AALIB_CONFIG" = "no" ; then + no_aalib=yes + else + AALIB_CFLAGS=`$AALIB_CONFIG $aalibconf_args --cflags` + AALIB_LIBS=`$AALIB_CONFIG $aalibconf_args --libs` + + aalib_major_version=`$AALIB_CONFIG $aalib_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + aalib_minor_version=`$AALIB_CONFIG $aalib_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + aalib_micro_version=`$AALIB_CONFIG $aalib_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_aalibtest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $AALIB_CFLAGS" + LIBS="$LIBS $AALIB_LIBS" +dnl +dnl Now check if the installed AALIB is sufficiently new. (Also sanity +dnl checks the results of aalib-config to some extent +dnl + rm -f conf.aalibtest + AC_TRY_RUN([ +#include +#include +#include +#include "aalib.h" + +char* +my_strdup (char *str) +{ + char *new_str; + + if (str) + { + new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); + strcpy (new_str, str); + } + else + new_str = NULL; + + return new_str; +} + +int main (int argc, char *argv[]) +{ + int major, minor, micro; + char *tmp_version; + + /* This hangs on some systems (?) + system ("touch conf.aalibtest"); + */ + { FILE *fp = fopen("conf.aalibtest", "a"); if ( fp ) fclose(fp); } + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = my_strdup("$min_aalib_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_aalib_version"); + exit(1); + } + + if (($aalib_major_version > major) || + (($aalib_major_version == major) && ($aalib_minor_version > minor)) || + (($aalib_major_version == major) && ($aalib_minor_version == minor) && ($aalib_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** 'aalib-config --version' returned %d.%d.%d, but the minimum version\n", $aalib_major_version, $aalib_minor_version, $aalib_micro_version); + printf("*** of AALIB required is %d.%d.%d. If aalib-config is correct, then it is\n", major, minor, micro); + printf("*** best to upgrade to the required version.\n"); + printf("*** If aalib-config was wrong, set the environment variable AALIB_CONFIG\n"); + printf("*** to point to the correct copy of aalib-config, and remove the file\n"); + printf("*** config.cache before re-running configure\n"); + return 1; + } +} + +],, no_aalib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_aalib" = x ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test "$AALIB_CONFIG" = "no" ; then + echo "*** The aalib-config script installed by AALIB could not be found" + echo "*** If AALIB was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the AALIB_CONFIG environment variable to the" + echo "*** full path to aalib-config." + else + if test -f conf.aalibtest ; then + : + else + echo "*** Could not run AALIB test program, checking why..." + CFLAGS="$CFLAGS $AALIB_CFLAGS" + LIBS="$LIBS $AALIB_LIBS" + AC_TRY_LINK([ +#include +#include "AALIB.h" +], [ return 0; ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding AALIB or finding the wrong" + echo "*** version of AALIB. If it is not finding AALIB, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means AALIB was incorrectly installed" + echo "*** or that you have moved AALIB since it was installed. In the latter case, you" + echo "*** may want to edit the aalib-config script: $AALIB_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + AALIB_CFLAGS="" + AALIB_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(AALIB_CFLAGS) + AC_SUBST(AALIB_LIBS) + rm -f conf.aalibtest +]) + diff --git a/asciiview b/asciiview new file mode 100755 index 0000000..6226dcb --- /dev/null +++ b/asciiview @@ -0,0 +1,73 @@ +#!/bin/bash +# asciiview - an ascii art image browser script. Front end for aview/aaflip +clear() +{ + kill $! 2>/dev/null + rm -f /tmp/aview$$.pgm 2>/dev/null +} +myconvert() +{ + if anytopnm $1 >/tmp/aview$$.pgm 2>/dev/null ; then + exit + elif convert -colorspace gray $1 pgm:- 2>/dev/null ; then + exit + fi + echo "Failed to convert file format to PNM by both convert and anytopnm" >&2 + while true; do + echo "0 " + done +} +filenames="" +options="" +if [ "$1" = "" ]; then + echo "$0 - an ascii art image/animation browser. + + To run this script you need aview, aaflip and NetPBM or ImageMagick. + You may browse any graphics format supported by NetPBM or ImageMagick + and .fli/.flc files. + + Usage: + $0 [options] [filenames] + + type aview --help [enter] for list of options. + " + exit 1 +fi +while [ "$1" != "" ]; do + case $1 in + "-font" | "-driver" | "-kbddriver" | "-mousedriver" | "-*width" | "-*height" | "-bright" | "-contrast" | "-gamma" | "-random" | "-dimmul" | "-boldmul") + options="$options $1 $2" + shift + shift + ;; + -*) + options="$options $1" + shift + ;; + *) + filenames="$filenames $1" + shift + ;; + esac +done +trap clear 0 +mkfifo /tmp/aview$$.pgm +outfile=/tmp/aview$$.pgm +for name in $filenames ; do +if test -r $name ; then +case $name in +*.fli | *.lfc | *.flic ) + PATH="$PATH:." + aaflip $options $name + ;; +*) + myconvert $name >/tmp/aview$$.pgm & + pid=$! + PATH="$PATH:." + aview $options /tmp/aview$$.pgm + kill $pid 2>/dev/null +esac +else + echo "$name could not be opended" +fi +done diff --git a/asciiview.1 b/asciiview.1 new file mode 100644 index 0000000..a6778f9 --- /dev/null +++ b/asciiview.1 @@ -0,0 +1,44 @@ +.TH NAME SECTION +.\" NAME should be all caps, SECTION should be 1-8, maybe w/ subsection +.\" other parms are allowed: see man(7), man(1) +.SH NAME +aview \- An high quality ascii-art image(pgm) browser +.SH SYNOPSIS +.B aview +.I "[options] filename.p[ngbp]m" +.SH "DESCRIPTION" +This manual page documents briefly the +.BR aview , +and +.B asciiview +commands. +This manual page was written for the Debian GNU/Linux distribution +because the original program does not have a manual page. +.PP +.B aview/asciiview +is a program that show files with ascii-art. +.B aview +support zooming/unzooming, three dithering modes, Inversion, Contrast, Bright, +Gamma control and can save into many formats (html, text, ansi, more/less +etc...). The +.B aview +can only show files in the PNM file format. But the +.B asciiview +program convert the file formats to PNM (with extern programs like NetPBM and +ImageMagic) and start +.B aview. +It's support the driver from the aalib. Normaly slang, x11 and stdout. It +support the mousedriver (X11 and gpm) too. +.SH OPTIONS +For a complete description, make only +.TP +.B aview +.TP +This show all option. +.SH "SEE ALSO" +.B bb +, +.B "aalib (info-page)" +.SH AUTHOR +This manual page was written by Michael Bramer , +for the Debian GNU/Linux system (but may be used by others). diff --git a/aview.1 b/aview.1 new file mode 100644 index 0000000..a6778f9 --- /dev/null +++ b/aview.1 @@ -0,0 +1,44 @@ +.TH NAME SECTION +.\" NAME should be all caps, SECTION should be 1-8, maybe w/ subsection +.\" other parms are allowed: see man(7), man(1) +.SH NAME +aview \- An high quality ascii-art image(pgm) browser +.SH SYNOPSIS +.B aview +.I "[options] filename.p[ngbp]m" +.SH "DESCRIPTION" +This manual page documents briefly the +.BR aview , +and +.B asciiview +commands. +This manual page was written for the Debian GNU/Linux distribution +because the original program does not have a manual page. +.PP +.B aview/asciiview +is a program that show files with ascii-art. +.B aview +support zooming/unzooming, three dithering modes, Inversion, Contrast, Bright, +Gamma control and can save into many formats (html, text, ansi, more/less +etc...). The +.B aview +can only show files in the PNM file format. But the +.B asciiview +program convert the file formats to PNM (with extern programs like NetPBM and +ImageMagic) and start +.B aview. +It's support the driver from the aalib. Normaly slang, x11 and stdout. It +support the mousedriver (X11 and gpm) too. +.SH OPTIONS +For a complete description, make only +.TP +.B aview +.TP +This show all option. +.SH "SEE ALSO" +.B bb +, +.B "aalib (info-page)" +.SH AUTHOR +This manual page was written by Michael Bramer , +for the Debian GNU/Linux system (but may be used by others). diff --git a/aview.lsm b/aview.lsm new file mode 100644 index 0000000..57a71ce --- /dev/null +++ b/aview.lsm @@ -0,0 +1,31 @@ +Begin3 +Title: Aview - High qualitty ascii art renderer/animation player +Version: 1.3 +Entered-date: Apr 25 2001 + +Description: aview is an high quality ascii-art image(pgm) browser and + animation(fli/flc) player usefull especially with + lynx browser. + +Keywords: X11 ascii-art text cool art ironing cooking fire library c GNU + demo fun game fli pgm pnm +Author: hubicka@freesoft.cz (Jan Hubicka) + (Filip Kupsa) + titana@mbox.vol.cz (Mojmir Svoboda) + toman@horac.ta.jcu.cz (Kamil Toman) +Maintained-by: hubicka@freesoft.cz (Jan Hubicka) + +Primary-site: sunsite.unc.edu /pub/Linux/apps/graphics/viewers + aview-1.3.tar.gz +Alternate-site: tsx-11.mit.edu /pub/linux/sources/usr.bin + aview-1.3.tar.gz + +Platform: dos (VG + MDA), stdio, curses, slang, X11, gpm, linux-console + Sound: OSS, Sun audio, SGI, DEC Aplha, AIX, HP-UX, DOS + (GUS CLASSIC, GUS CLASSIC, GUS MAX, GUS ACE, GUS PNP, + SB, ESS, PC-buzzer) + +Copying-policy: GNU GENERAL PUBLIC LICENSE +End + + diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000..6a65668 --- /dev/null +++ b/config.h.in @@ -0,0 +1,14 @@ +/* config.h.in. Generated automatically from configure.in by autoheader. */ + +/* Define if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define if you have the isatty function. */ +#undef HAVE_ISATTY + +/* Name of package */ +#undef PACKAGE + +/* Version number of package */ +#undef VERSION + diff --git a/configure b/configure new file mode 100755 index 0000000..b0d2654 --- /dev/null +++ b/configure @@ -0,0 +1,1951 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.13 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: +ac_help="$ac_help + --with-aalib-prefix=PFX Prefix where AALIB is installed (optional)" +ac_help="$ac_help + --with-aalib-exec-prefix=PFX Exec prefix where AALIB is installed (optional)" +ac_help="$ac_help + --disable-aalibtest Do not try to compile and run a test AALIB program" + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +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=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -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 ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$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" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$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) + # 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 << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --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 +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$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" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + 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) + 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" ;; + + -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 ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.13" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=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" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=main.c + +# 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 its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + 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 + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +ac_exeext= +ac_objext=o +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +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 + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + +# 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 +# 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" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:562: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/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 + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +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. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&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_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 +echo "configure:615: checking whether build environment is sane" >&5 +# Just in case +sleep 1 +echo timestamp > conftestfile +# 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 conftestfile 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "$*" != "X $srcdir/configure conftestfile" \ + && test "$*" != "X conftestfile $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". + { echo "configure: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" 1>&2; exit 1; } + fi + + test "$2" = conftestfile + ) +then + # Ok. + : +else + { echo "configure: error: newly created file is older than distributed files! +Check your system clock" 1>&2; exit 1; } +fi +rm -f conftest* +echo "$ac_t""yes" 1>&6 +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +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" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," + +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:672: checking whether ${MAKE-make} sets \${MAKE}" >&5 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftestmake +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= +else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + + +PACKAGE=aview + +VERSION=1.3.0 + +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } +fi +cat >> confdefs.h <> confdefs.h <&6 +echo "configure:718: checking for working aclocal" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (aclocal --version) < /dev/null > /dev/null 2>&1; then + ACLOCAL=aclocal + echo "$ac_t""found" 1>&6 +else + ACLOCAL="$missing_dir/missing aclocal" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 +echo "configure:731: checking for working autoconf" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoconf --version) < /dev/null > /dev/null 2>&1; then + AUTOCONF=autoconf + echo "$ac_t""found" 1>&6 +else + AUTOCONF="$missing_dir/missing autoconf" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working automake""... $ac_c" 1>&6 +echo "configure:744: checking for working automake" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (automake --version) < /dev/null > /dev/null 2>&1; then + AUTOMAKE=automake + echo "$ac_t""found" 1>&6 +else + AUTOMAKE="$missing_dir/missing automake" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 +echo "configure:757: checking for working autoheader" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoheader --version) < /dev/null > /dev/null 2>&1; then + AUTOHEADER=autoheader + echo "$ac_t""found" 1>&6 +else + AUTOHEADER="$missing_dir/missing autoheader" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 +echo "configure:770: checking for working makeinfo" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (makeinfo --version) < /dev/null > /dev/null 2>&1; then + MAKEINFO=makeinfo + echo "$ac_t""found" 1>&6 +else + MAKEINFO="$missing_dir/missing makeinfo" + echo "$ac_t""missing" 1>&6 +fi + + + + + + +use_cc_g_flag=no +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:791: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +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 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:821: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_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 $# -gt 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 + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # Extract the first word of "cl", so it can be a program name with args. +set dummy cl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:872: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + ;; + esac + fi + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:904: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext << EOF + +#line 915 "configure" +#include "confdefs.h" + +main(){return(0);} +EOF +if { (eval echo configure:920: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:946: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +cross_compiling=$ac_cv_prog_cc_cross + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:951: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +else + GCC= +fi + +ac_test_CFLAGS="${CFLAGS+set}" +ac_save_CFLAGS="$CFLAGS" +CFLAGS= +echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:979: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&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 + +# 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 +# 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" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:1022: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/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 + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +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. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&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_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:1075: checking how to run the C preprocessor" >&5 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1096: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -E -traditional-cpp" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1113: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -nologo -E" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1130: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP=/lib/cpp +fi +rm -f conftest* +fi +rm -f conftest* +fi +rm -f conftest* + ac_cv_prog_CPP="$CPP" +fi + CPP="$ac_cv_prog_CPP" +else + ac_cv_prog_CPP="$CPP" +fi +echo "$ac_t""$CPP" 1>&6 + +echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 +echo "configure:1155: checking for ANSI C header files" >&5 +if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +#include +#include +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1168: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + ac_cv_header_stdc=yes +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. +cat > conftest.$ac_ext < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + rm -rf conftest* + 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 > conftest.$ac_ext < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + rm -rf conftest* + 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 > conftest.$ac_ext < +#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#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)) exit(2); +exit (0); } + +EOF +if { (eval echo configure:1235: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_header_stdc=no +fi +rm -fr conftest* +fi + +fi +fi + +echo "$ac_t""$ac_cv_header_stdc" 1>&6 +if test $ac_cv_header_stdc = yes; then + cat >> confdefs.h <<\EOF +#define STDC_HEADERS 1 +EOF + +fi + + +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:1260: checking whether ${MAKE-make} sets \${MAKE}" >&5 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftestmake +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= +else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + + +for ac_func in isatty +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:1290: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* 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_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:1318: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + +# Check whether --with-aalib-prefix or --without-aalib-prefix was given. +if test "${with_aalib_prefix+set}" = set; then + withval="$with_aalib_prefix" + aalib_prefix="$withval" +else + aalib_prefix="" +fi + +# Check whether --with-aalib-exec-prefix or --without-aalib-exec-prefix was given. +if test "${with_aalib_exec_prefix+set}" = set; then + withval="$with_aalib_exec_prefix" + aalib_exec_prefix="$withval" +else + aalib_exec_prefix="" +fi + +# Check whether --enable-aalibtest or --disable-aalibtest was given. +if test "${enable_aalibtest+set}" = set; then + enableval="$enable_aalibtest" + : +else + enable_aalibtest=yes +fi + + + if test x$aalib_exec_prefix != x ; then + aalib_args="$aalib_args --exec-prefix=$aalib_exec_prefix" + if test x${AALIB_CONFIG+set} != xset ; then + AALIB_CONFIG=$aalib_exec_prefix/bin/aalib-config + fi + fi + if test x$aalib_prefix != x ; then + aalib_args="$aalib_args --prefix=$aalib_prefix" + if test x${AALIB_CONFIG+set} != xset ; then + AALIB_CONFIG=$aalib_prefix/bin/aalib-config + fi + fi + + # Extract the first word of "aalib-config", so it can be a program name with args. +set dummy aalib-config; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1383: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_AALIB_CONFIG'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$AALIB_CONFIG" in + /*) + ac_cv_path_AALIB_CONFIG="$AALIB_CONFIG" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_AALIB_CONFIG="$AALIB_CONFIG" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_AALIB_CONFIG="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_AALIB_CONFIG" && ac_cv_path_AALIB_CONFIG="no" + ;; +esac +fi +AALIB_CONFIG="$ac_cv_path_AALIB_CONFIG" +if test -n "$AALIB_CONFIG"; then + echo "$ac_t""$AALIB_CONFIG" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + min_aalib_version=1.4.0 + echo $ac_n "checking for AALIB - version >= $min_aalib_version""... $ac_c" 1>&6 +echo "configure:1418: checking for AALIB - version >= $min_aalib_version" >&5 + no_aalib="" + if test "$AALIB_CONFIG" = "no" ; then + no_aalib=yes + else + AALIB_CFLAGS=`$AALIB_CONFIG $aalibconf_args --cflags` + AALIB_LIBS=`$AALIB_CONFIG $aalibconf_args --libs` + + aalib_major_version=`$AALIB_CONFIG $aalib_args --version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` + aalib_minor_version=`$AALIB_CONFIG $aalib_args --version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` + aalib_micro_version=`$AALIB_CONFIG $aalib_config_args --version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` + if test "x$enable_aalibtest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $AALIB_CFLAGS" + LIBS="$LIBS $AALIB_LIBS" + rm -f conf.aalibtest + if test "$cross_compiling" = yes; then + echo $ac_n "cross compiling; assumed OK... $ac_c" +else + cat > conftest.$ac_ext < +#include +#include +#include "aalib.h" + +char* +my_strdup (char *str) +{ + char *new_str; + + if (str) + { + new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); + strcpy (new_str, str); + } + else + new_str = NULL; + + return new_str; +} + +int main (int argc, char *argv[]) +{ + int major, minor, micro; + char *tmp_version; + + /* This hangs on some systems (?) + system ("touch conf.aalibtest"); + */ + { FILE *fp = fopen("conf.aalibtest", "a"); if ( fp ) fclose(fp); } + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = my_strdup("$min_aalib_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_aalib_version"); + exit(1); + } + + if (($aalib_major_version > major) || + (($aalib_major_version == major) && ($aalib_minor_version > minor)) || + (($aalib_major_version == major) && ($aalib_minor_version == minor) && ($aalib_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** 'aalib-config --version' returned %d.%d.%d, but the minimum version\n", $aalib_major_version, $aalib_minor_version, $aalib_micro_version); + printf("*** of AALIB required is %d.%d.%d. If aalib-config is correct, then it is\n", major, minor, micro); + printf("*** best to upgrade to the required version.\n"); + printf("*** If aalib-config was wrong, set the environment variable AALIB_CONFIG\n"); + printf("*** to point to the correct copy of aalib-config, and remove the file\n"); + printf("*** config.cache before re-running configure\n"); + return 1; + } +} + + +EOF +if { (eval echo configure:1503: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + no_aalib=yes +fi +rm -fr conftest* +fi + + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_aalib" = x ; then + echo "$ac_t""yes" 1>&6 + : + else + echo "$ac_t""no" 1>&6 + if test "$AALIB_CONFIG" = "no" ; then + echo "*** The aalib-config script installed by AALIB could not be found" + echo "*** If AALIB was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the AALIB_CONFIG environment variable to the" + echo "*** full path to aalib-config." + else + if test -f conf.aalibtest ; then + : + else + echo "*** Could not run AALIB test program, checking why..." + CFLAGS="$CFLAGS $AALIB_CFLAGS" + LIBS="$LIBS $AALIB_LIBS" + cat > conftest.$ac_ext < +#include "AALIB.h" + +int main() { + return 0; +; return 0; } +EOF +if { (eval echo configure:1547: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding AALIB or finding the wrong" + echo "*** version of AALIB. If it is not finding AALIB, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means AALIB was incorrectly installed" + echo "*** or that you have moved AALIB since it was installed. In the latter case, you" + echo "*** may want to edit the aalib-config script: $AALIB_CONFIG" +fi +rm -f conftest* + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + AALIB_CFLAGS="" + AALIB_LIBS="" + { echo "configure: error: *** AALIB >= 1.4.0 not installed - please install first ***" 1>&2; exit 1; } + fi + + + rm -f conf.aalibtest + +CFLAGS="$CFLAGS $AALIB_CFLAGS" +LIBS="$CLFAGS $AALIB_LIBS" + +trap '' 1 2 15 +cat > confcache <<\EOF +# 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. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# 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. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +DEFS=-DHAVE_CONFIG_H + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS </dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@PACKAGE@%$PACKAGE%g +s%@VERSION@%$VERSION%g +s%@ACLOCAL@%$ACLOCAL%g +s%@AUTOCONF@%$AUTOCONF%g +s%@AUTOMAKE@%$AUTOMAKE%g +s%@AUTOHEADER@%$AUTOHEADER%g +s%@MAKEINFO@%$MAKEINFO%g +s%@SET_MAKE@%$SET_MAKE%g +s%@CC@%$CC%g +s%@CPP@%$CPP%g +s%@AALIB_CONFIG@%$AALIB_CONFIG%g +s%@AALIB_CFLAGS@%$AALIB_CFLAGS%g +s%@AALIB_LIBS@%$AALIB_LIBS%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' +ac_dC='\3' +ac_dD='%g' +# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='\([ ]\)%\1#\2define\3' +ac_uC=' ' +ac_uD='\4%g' +# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_eB='$%\1#\2define\3' +ac_eC=' ' +ac_eD='%g' + +if test "${CONFIG_HEADERS+set}" != set; then +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +fi +for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + cat $ac_file_inputs > conftest.in + +EOF + +# Transform confdefs.h into a sed script conftest.vals that substitutes +# the proper values into config.h.in to produce config.h. And first: +# Protect against being on the right side of a sed subst in config.status. +# Protect against being in an unquoted here document in config.status. +rm -f conftest.vals +cat > conftest.hdr <<\EOF +s/[\\&%]/\\&/g +s%[\\$`]%\\&%g +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp +s%ac_d%ac_u%gp +s%ac_u%ac_e%gp +EOF +sed -n -f conftest.hdr confdefs.h > conftest.vals +rm -f conftest.hdr + +# This sed command replaces #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. +cat >> conftest.vals <<\EOF +s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% +EOF + +# Break up conftest.vals because some shells have a limit on +# the size of here documents, and old seds have small limits too. + +rm -f conftest.tail +while : +do + ac_lines=`grep -c . conftest.vals` + # grep -c gives empty output for an empty file on some AIX systems. + if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi + # Write a limited-size here document to conftest.frag. + echo ' cat > conftest.frag <> $CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + echo 'CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in +' >> $CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail + rm -f conftest.vals + mv conftest.tail conftest.vals +done +rm -f conftest.vals + +cat >> $CONFIG_STATUS <<\EOF + rm -f conftest.frag conftest.h + echo "/* $ac_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $ac_file conftest.h 2>/dev/null; then + echo "$ac_file is unchanged" + rm -f conftest.h + else + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + fi + rm -f $ac_file + mv conftest.h $ac_file + fi +fi; done + +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + diff --git a/configure.in b/configure.in new file mode 100644 index 0000000..21caaf1 --- /dev/null +++ b/configure.in @@ -0,0 +1,20 @@ +dnl Process this file with autoconf to produce a configure script. +AC_INIT(main.c) +AM_INIT_AUTOMAKE(aview, 1.3.0) +AM_CONFIG_HEADER(config.h) + +use_cc_g_flag=no +AC_PROG_CC +AC_PROG_INSTALL +AC_HEADER_STDC + +dnl Checks for programs. +AC_PROG_MAKE_SET + +AC_CHECK_FUNCS(isatty) +dnl Check for AA-lib +AM_PATH_AALIB(1.4.0, , AC_MSG_ERROR([*** AALIB >= 1.4.0 not installed - please install first ***])) +CFLAGS="$CFLAGS $AALIB_CFLAGS" +LIBS="$CLFAGS $AALIB_LIBS" + +AC_OUTPUT(Makefile) diff --git a/fli.h b/fli.h new file mode 100644 index 0000000..a30f0fd --- /dev/null +++ b/fli.h @@ -0,0 +1,46 @@ + +#define FLITYPE 0xAF11 +#define FLCTYPE 0xAF12 + +#define COLOR_256 4 +#define DELTA_FLC 7 +#define COLOR_64 11 +#define DELTA_FLI 12 +#define BLACK 13 +#define BYTE_RUN 15 +#define LITERAL 16 +#define PSTAMP 18 + +/* Structure of flic file header. Fields with + before the comment are FLC only. */ +struct FLI_HEADER { + long size; /* size of entire file */ + unsigned short int type; /* 0xAF12 = FLC, 0xAF11 = FLI */ + short int frames; /* number of frames in flic */ + short int width; /* screen width in pixels */ + short int height; /* sceen height in pixels */ + short int depth; /* bits per pixel (always 8) */ + unsigned short int flags; /* set to 0x0003 */ + long speed; /* time delay between frames, FLI: 1/70thsec, FLC: msec */ + short int reserved0; /* set to 0 */ + long created; /*+ MS-DOS formatted date and time of creation */ + long creator; /*+ Animator Pro serial number */ + long updated; /*+ date of last update */ + long updater; /*+ Serial number of updating program */ + short int aspectx; /*+ ratio of screen used to create flic */ + short int aspecty; /*+ */ + char reserved1[38]; /*+ 38 bytes set to 0 */ + long oframe1; /*+ file offset of first frame */ + long oframe2; /*+ file offset of second frame */ + char reserved2[40]; /* 40 bytes set to 0 */ +}; + +#define FLI_HEADERLEN ( sizeof( struct FLI_HEADER ) ) + +struct FLI_CHUNK_HEADER { + long size; /* size of chunk */ + short unsigned int type; /* chunk type */ + short unsigned int chunks; /* number of subchunks */ + char reserved[8]; /* set to 0 */ +}; + +#define FLI_CHUNK_HEADERLEN ( sizeof( struct FLI_CHUNK_HEADER ) ) \ No newline at end of file diff --git a/flip.c b/flip.c new file mode 100644 index 0000000..a619f4a --- /dev/null +++ b/flip.c @@ -0,0 +1,920 @@ + +/* Copyright 1993 J. Remyn */ +/* This program is freely distributable, but there is no warranty */ +/* of any kind. */ +/* version 0.3 */ +/* Modified for aaflip version 1.0 by Jan Hubicka*/ + +#include +#include +#include +#include +#include + +#include "general.h" +#include "fli.h" + +#define NAMELEN 256 + +struct OPTIONS { + char filename[NAMELEN]; /* filename given on command line */ + char fast; /* 1 = play without delays */ + char verbose; /* 1 = show info about flic file */ + char release; /* 1 = don't keep frames in memory */ + char firstp; /* 1 = process frames while loading */ + char blank; /* 1 = keep black screen while loading */ + char stdinp; /* 1 = take flic file from stdin */ + int speed; /* speed gotten from command line (-1 if nothing gotten) */ + int playrep; /* nr of times to play animation */ +} options; + +struct FLI_FRAMECHUNK { + long size; /* Size of chunk data part */ + long file_offset; /* Offset of chunk data part into flic file */ + int subchunks; /* Number of subchunks in data part */ + void *cd; /* Pointer to memory containing data part, */ + /* is NULL if data not kept in memory */ +}; + +struct FLI { + char filename[NAMELEN]; /* filename of fli file */ + char flc; /* 0 = fli, 1 = flc */ + int mode; /* vgalib mode number to be used */ + int scr_width; /* width of screen mode used */ + int scr_height; /* guess */ + int current; /* current frame index */ + long time; /* time of last processed frame in usec */ + FILE *f; /* file pointer of opened flic file */ + struct FLI_HEADER h; /* 128 byte fli file header structure */ + struct FLI_FRAMECHUNK *frame; + /* pointer to an allocated 'array' of + FLI_FRAMECHUNK structs */ +} fli; + + +static aa_palette pal; +static aa_context *context; +static aa_renderparams *params; +static char *graph_mem; + + +static void dcd_color_64( char *data ) { +uchar start = 0; +int ops; +int count; +int i; +/* puts( "color_64" ); */ + ops = *(short int *)data; + data = (void *)(((short int *)data) + 1); + while( ops-- > 0 ) { + start += *(uchar *)data; + data = (void *) ((uchar *)data + 1); + if( (count = (int)*(uchar *)data) == 0 ) + count = 256; + data = (void *) ((uchar *)data + 1); + for( i=0; i 0 ) { + start += *(uchar *)data; + data = (void *)((uchar *)data + 1); + if( (count = (int)*(uchar *)data) == 0 ) + count = 256; + data = (void *)((uchar *)data + 1); + for( i=0; i> 2, + *((uchar *)data+1) >> 2, + *((uchar *)data+2) >> 2 + ); + data = (void *)((uchar *)data + 3); + } + start += count; + } +} + +void *memsetw( unsigned short *target, unsigned short w, int count ) { + while( count-->0 ) { + *target++ = w; + } + return( target ); +} + +static void dcd_delta_flc( struct FLI *fli, char *data ) { +short int line; +short int nrlines; +char *index; +short packets; +short type; +int x; +uchar lastbyte; +char setlastbyte; +/* puts( "delta flc" ); */ + /* get nr of lines in chunk */ + nrlines = *(short int *)data; + data = (void *)((short int *)data + 1); + line = 0; + setlastbyte = 0; + lastbyte = 0; /* this is just to get rid of a compiler warning */ + index = graph_mem; + + while( nrlines>0 ) { /* don't put nrlines-- here, the continues don't allow it */ + + type = *(short *)data; + data = (void *)((short *)data + 1); + /* the 2 highest bits of type indicate how to interpret it */ + if( type<0 ) { + if( type&0x4000 ) { + /* add to the line number and act as if nothing + * happened. + * documentation says it's all right just to + * add the abs. value of the word, which is the + * same as subtracting the word as it is always + * negative. + */ + line -= type; + index += fli->scr_width * (-type); + continue; + } + /* the low byte contains a lastbyte (the last byte + * on a line in odd-width resolution flic files), + * this word is followed by the packet count + */ + setlastbyte = 1; + lastbyte = (uchar)(type & 0x00FF); + packets = *(short *)data; + data = (void *)((short *)data + 1); + /* packets can be 0 now if just the last byte + * changes for this line + */ + } + if( type>=0 ) { + /* the word contains the nr of packets + * we can just assign this to packets because the + * high bits are zero + */ + packets = type; + } + + /* decode packets */ + x = 0; + while( packets-->0 ) { + /* get & decode packet */ + x += *(uchar *)data; + data = (void *)((uchar *)data + 1); + type = *(char *)data; + data = (void *)((uchar *)data + 1); + if( (char)type>=0 ) { + /* copy ptype words */ + type <<= 1; + memcpy( index + x, data, type ); + x += type; + data = (void *)((uchar *)data + type); + continue; + } + type = -(char)type; + memsetw( (ushort *)(index + x), *(ushort *)data, type ); + x += type<<1; + data = (void *)((ushort *)data + 1); + } + if( !setlastbyte ) { + index = (char *)((uchar *)index + fli->scr_width); + nrlines--; + continue; + } + /* put lastbyte at end of line */ + *(uchar *)(index + fli->scr_width - 1) = lastbyte; + setlastbyte = 0; + index = (char *)((uchar *)index + fli->scr_width); + nrlines--; + } +} + + +static void dcd_delta_fli( struct FLI *fli, char *data ) { +short int line; +short int nrlines; +char *index; +uchar packets; +int index_x; +char type; +/* puts( "delta fli" ); */ + line = *(short int *)data; + data = (void *)((short int *)data + 1); + index = graph_mem + line * fli->scr_width; + nrlines = *(short int *)data; + data = (void *)((short int *)data + 1); + while( nrlines-- > 0 ) { + index_x = 0; + packets = *(uchar *)data; + data = (void *)((uchar *)data + 1); + while( packets > 0 ) { + index_x += *(uchar *)data; + data = (void *)((uchar *)data + 1); + type = *(char *)data; + data = (void *)((char *)data + 1); + if( type >= 0 ) { + memcpy( index + index_x, data, type ); + index_x += type; + data = (void *)((uchar *)data + type); + packets--; + continue; + } + memset( index + index_x, *(uchar *)data, -type ); + index_x -= type; + data = (void *)((uchar *)data + 1); + packets--; + } + index += fli->scr_width; + } +} + + + +static void dcd_byte_run( struct FLI *fli, char *data ) { +int lines; +int width; +char type; +int index; +int index_x; +/* puts( "byte run" ); */ + lines = fli->h.height; + width = fli->h.width; + index = 0; + while( lines-->0 ) { + data = (void *)((uchar *)data + 1); /* skip byte containing number of packets */ + /* start a loop to decode packets until end of line is reached */ + index_x = 0; + while ( index_x < width ) { + type = *((char *)data++); + if( type<0 ) { + /* type now contains nr of bytes to copy to video */ + memcpy( graph_mem + index + index_x, (uchar *)data, -type ); + index_x -= type; + data = (void *)((uchar *)data - type); + } + else { + memset( graph_mem + index + index_x, *(uchar *)data++, type ); + index_x += type; + } + } + index += fli->scr_width; + } +} + + +static void dcd_black( struct FLI *fli, char *data ) { +/* puts( "black" ); */ + int l; + uchar *index; + + l = fli->h.height; + index = graph_mem; + while( l-- > 0 ) { + memset( index, 0, fli->h.width ); + index += fli->scr_width; + } +} + +static void dcd_literal( struct FLI *fli, char *data ) { +int l; +/* puts( "literal" ); */ + l = fli->h.height; + { + /* linear video memory */ + char *index; + index = graph_mem; + while( l-- > 0 ) { + memcpy( index, data, fli->h.width ); + data = (void *)((uchar *)data + fli->h.width); + index += fli->scr_width; + } + } +} + +static void dcd_pstamp( char *data ) { +/* puts( "pstamp" ); */ +} + +static void showhelp( void ) { + puts( "FLI Player for Linux (version 0.2a) by John Remyn" ); + puts( "modified version for aalib by Jan Hubicka" ); + puts( "Now it is ascii arted FLI Player for text mode" ); + puts( "Usage:" ); + puts( " flip [switch] " ); + puts( "Valid switches are :" ); + puts( " -f Switch off clock synchronization." ); + puts( " -v Show information on flic file." ); + puts( " -? -h Show help." ); + puts( " -a Don't keep frames in memory." ); + puts( " -b Process frames when they are loaded." ); + puts( " -c Keep a blank screen while frames are being loaded." ); + puts( " -n Play the animation sequence times." ); + puts( " -s Set delay between frames to miliseconds." ); + puts( " - Read flic file from standard input." ); + puts( "also standard aalib options are supported" ); + puts( " -dim, -bold, -reverse, -normal for enabling attributes"); + puts( " -nodim, -nobold, -noreverse, -nonormal for disabling"); + puts( "Press H for help on keys while playing." ); +} + +static void parse_cmdln( int argc, char *argv[], struct OPTIONS *options ) { +int i,j; + + options->filename[0] = '\0'; + options->fast = 0; + options->verbose = 0; + options->release = 0; + options->firstp = 0; + options->blank = 0; + options->playrep = 1; + options->speed = -1; + options->stdinp = 0; + for( i=1; istdinp = 1; + } + j = 1; + k = 0; + while( (c = *(argv[i]+j))!='\0' ) { + switch( c ) { + case 'f' : options->fast = 1; break; + case 'v' : options->verbose = 1; break; + case 'a' : options->release = 1; break; + case 'b' : options->firstp = 1; break; + case 'c' : options->blank = 1; break; + case '?' : + case 'h' : showhelp(); exit( 0 ); break; + case 'n' : if( i+k+1playrep = abs( atoi( argv[i+k] ) ); + } + break; + case 's' : if( i+k+1speed = abs( atoi( argv[i+k] ) ); + /* adjust to some reasonable value */ + if (options->speed > 1000) options->speed = 1000; + /* convert to usec */ + options->speed *= 1000; + } + break; + default : showhelp(); + puts( "Unknown option." ); + exit( -1 ); + } + j++; + } + i = i+k; + } + else { + if( argv[i]!=NULL ) { + /* argv[i] is the filename of the flic file */ + strncpy( options->filename, argv[i], NAMELEN ); + } + } + } + if( options->filename[0]=='\0' && options->stdinp==0 ) { + showhelp(); + puts( "No filename given." ); + exit( -1 ); + } +} + +static int open_fli( struct FLI *fli, struct OPTIONS *options ) { + /* open file and read the header */ + if( !options->stdinp ) { + fli->f = fopen( fli->filename, "rb" ); + if( !fli->f ) { + return 0; + } + } + else { + fli->f = stdin; + } + freadblock( fli->f, sizeof( fli->h.size ), &(fli->h.size) ); + freadblock( fli->f, sizeof( fli->h.type ), &(fli->h.type) ); + freadblock( fli->f, sizeof( fli->h.frames ), &(fli->h.frames) ); + freadblock( fli->f, sizeof( fli->h.width ), &(fli->h.width) ); + freadblock( fli->f, sizeof( fli->h.height ), &(fli->h.height) ); + freadblock( fli->f, sizeof( fli->h.depth ), &(fli->h.depth) ); + freadblock( fli->f, sizeof( fli->h.flags ), &(fli->h.flags) ); + freadblock( fli->f, sizeof( fli->h.speed ), &(fli->h.speed) ); + freadblock( fli->f, sizeof( fli->h.reserved0 ), &(fli->h.reserved0) ); + freadblock( fli->f, sizeof( fli->h.created ), &(fli->h.created) ); + freadblock( fli->f, sizeof( fli->h.creator ), &(fli->h.creator) ); + freadblock( fli->f, sizeof( fli->h.updated ), &(fli->h.updated) ); + freadblock( fli->f, sizeof( fli->h.updater ), &(fli->h.updater) ); + freadblock( fli->f, sizeof( fli->h.aspectx ), &(fli->h.aspectx) ); + freadblock( fli->f, sizeof( fli->h.aspecty ), &(fli->h.aspecty) ); + freadblock( fli->f, sizeof( fli->h.reserved1 ), &(fli->h.reserved1) ); + freadblock( fli->f, sizeof( fli->h.oframe1 ), &(fli->h.oframe1) ); + freadblock( fli->f, sizeof( fli->h.oframe2 ), &(fli->h.oframe2) ); + freadblock( fli->f, sizeof( fli->h.reserved2 ), &(fli->h.reserved2) ); + + /* now check if it's a flc or a fli and take necessary precautions */ + if( (unsigned)fli->h.type==FLITYPE ) { + /* it's a fli. convert as much as possible to flc */ + fli->flc = 0; + /* convert frame rate from 1/70 sec to usec */ + fli->h.speed *= 100; + fli->h.speed /= 7; + fli->h.speed *= 1000; + /* ascpect ratio is ignored, but fix it anyway */ + fli->h.aspectx = 6; + fli->h.aspecty = 5; + /* can't convert frame offsets */ + } + else if( (unsigned)fli->h.type==FLCTYPE ) { + fli->flc = 1; + fli->h.speed *= 1000; /* convert msec to usec */ + } + else { + puts( "File type not recognized." ); + exit( -1 ); + } + return 1; +}; + + +static void describe_fli( struct FLI *fli ) { + printf( "Filename %s\n", fli->filename ); + printf( "size %li\n", fli->h.size ); + printf( "type %x\n", fli->h.type ); + printf( "frames %i\n", fli->h.frames ); + printf( "width %i\n", fli->h.width ); + printf( "height %i\n", fli->h.height ); + printf( "depth %i\n", fli->h.depth ); + printf( "flags %x\n", fli->h.flags ); + printf( "speed %li\n", fli->h.speed ); + printf( "aspectx %i\n", fli->h.aspectx ); + printf( "aspecty %i\n", fli->h.aspecty ); + printf( "oframe1 %li\n", fli->h.oframe1 ); + printf( "oframe2 %li\n", fli->h.oframe2 ); +}; + + +static void readchunkheader( FILE *f, struct FLI_CHUNK_HEADER *buf ) { + freadblock( f, sizeof( buf->size ), &buf->size ); + freadblock( f, sizeof( buf->type ), &buf->type ); + freadblock( f, sizeof( buf->chunks ), &buf->chunks ); + freadblock( f, sizeof( buf->reserved ), &buf->reserved ); +} + +static void scan_to_frame( struct FLI *fli ) { +struct FLI_CHUNK_HEADER buf; +struct FLI_FRAMECHUNK *fc; + do { + readchunkheader( fli->f, &buf ); + if( buf.type==0xF1FA ) break; + fseek( fli->f, buf.size - FLI_CHUNK_HEADERLEN, SEEK_CUR ); + } while ( buf.type!=0xF1FA ); + fc = fli->frame + fli->current; + fc->size = buf.size - FLI_CHUNK_HEADERLEN; + fc->subchunks = buf.chunks; + fc->file_offset = ftell( fli->f ); + fc->cd = NULL; +} + +static void getframechunkdata( struct FLI *fli ) { +struct FLI_FRAMECHUNK *fc; +void *data; + fc = fli->frame + fli->current; + data = fc->cd; + if( data ) + return; /* frame chunk data already loaded */ + if(fc->size) { + data = malloc( fc->size ); + if( !data ) { + printf( "cannot allocate memory for frame data\n" ); + exit( 1 ); + } + fseek( fli->f, fc->file_offset, SEEK_SET ); + freadblock( fli->f, fc->size, data ); + } else data=NULL; + fc->cd = data; +} + +static void releaseframechunkdata( struct FLI *fli ) { +struct FLI_FRAMECHUNK *fc; + fc = fli->frame + fli->current; + if( fc->cd ) { + free( fc->cd ); + fc->cd = NULL; + } +} + +static void processframechunk( struct FLI *fli ) { +struct FLI_FRAMECHUNK *fc; +void *data; +int i; + fc = fli->frame + fli->current; + data = fc->cd; + for( i=0; isubchunks; i++ ) { + /* switch( chunktype ) */ + switch( *((short int *)((char *)data+4)) ) { + case COLOR_256 : + dcd_color_256( (char *)data + 6 ); + break; + case DELTA_FLC : + dcd_delta_flc( fli, (char *)data + 6 ); + break; + case COLOR_64 : + dcd_color_64( (char *)data + 6 ); + break; + case DELTA_FLI : + dcd_delta_fli( fli, (char *)data + 6 ); + break; + case BLACK : + dcd_black( fli, (char *)data + 6 ); + break; + case BYTE_RUN : + dcd_byte_run( fli, (char *)data + 6 ); + break; + case LITERAL : + dcd_literal( fli, (char *)data + 6 ); + break; + case PSTAMP : + dcd_pstamp( (char *)data + 6 ); + break; + default : + puts( "unknown subchunk" ); + } + data = (void *)((char *)data + *(long *)data); + } +} + +long gettime(void) { +struct timeval t; + gettimeofday(&t, NULL); + return(t.tv_usec); +} + +int await() { +#define T 10000 /* process key every 10ms */ +int i; +long t; + t = gettime(); + if (t < fli.time) t = t + 1E6; + t = fli.h.speed - (t - fli.time); + if (t > 0) { + if (t > T) { + for (i = 0; i < (t / T); i++) { + usleep(T); + if (f_getkey() == 'q') return(1); + } + usleep(t % T); + } + else usleep(t); + } + return(f_getkey() == 'q'); +} + +static void fastscale(char *b1, char *b2, int x1, int x2, int y1, int y2, int width1, int width2) +{ + int ddx1, ddx, spx = 0, ex; + int ddy1, ddy, spy = 0, ey; + int x; + char *bb1 = b1; + width2 -= x2; + if (!x1 || !x2 || !y1 || !y2) + return; + ddx = x1 + x1; + ddx1 = x2 + x2; + if (ddx1 < ddx) + spx = ddx / ddx1, ddx %= ddx1; + ddy = y1 + y1; + ddy1 = y2 + y2; + if (ddy1 < ddy) + spy = (ddy / ddy1) * width1, ddy %= ddy1; + ey = -ddy1; + for (; y2; y2--) { + ex = -ddx1; + for (x = x2; x; x--) { + *b2 = *b1; + b2++; + b1 += spx; + ex += ddx; + if (ex > 0) { + b1++; + ex -= ddx1; + } + } + b2 += width2; + bb1 += spy; + ey += ddy; + if (ey > 0) { + bb1 += width1; + ey -= ddy1; + } + b1 = bb1; + } +} +static int resized; +static void resize(aa_context * c) +{ + aa_resize(c); + resized = 1; +} + +static int yesno(int x, int y, char *string) +{ + char c; + aa_puts(context, x, y, AA_SPECIAL, string); + aa_flush(context); + while ((c = tolower(aa_getkey(context, 1))) != 'y' && c != 'n'); + return (c == 'y'); +} +static int getnum(char *string) +{ + unsigned char c; + aa_puts(context, 0, 0, AA_SPECIAL, string); + aa_flush(context); + while ((c = tolower(aa_getkey(context, 1))) < '0' || c > '9'); + return (c - '0'); +} +static void selectfont(aa_context * c) +{ + int i = 0, i1; + char string[255]; + for (i = 0; aa_fonts[i] != NULL; i++) { + sprintf(string, "%i - %-40s", i, aa_fonts[i]->name); + aa_puts(context, 0, i, AA_SPECIAL, string); + } + i1 = getnum(""); + if (i1 < i) + aa_setfont(c, *(aa_fonts + i1)); +} + +#if AA_LIB_VERSION==1 && AA_LIB_MINNOR==0 +#define SUPPORTED c->driver->params.supported +#else +#define SUPPORTED c->driverparams.supported +#endif +static void selectsupported(aa_context * c) +{ + int supported = c->params.supported; + char text[40]; + int ch; + do { + char *texts[]={ + "Normal characters", + "Half bright (dim)", + "Double bright (bold)", + "Bold font", + "Reversed", + "8 bit ascii", + "Control characters"}; + int masks[]={AA_NORMAL_MASK,AA_DIM_MASK,AA_BOLD_MASK,AA_BOLDFONT_MASK,AA_REVERSE_MASK,AA_EIGHT,AA_ALL}; + int i; + for(i=0;i<7;i++) + { + sprintf(text,"%i %-20s:%-12s",i+1,texts[i],(SUPPORTED&masks[i])?((supported&masks[i])?"On":"Off"):"Unsupported"); + aa_puts(c,0,i,AA_SPECIAL,text); + } + aa_puts(c,0,i,AA_SPECIAL,"8 Leave this menu"); + aa_flush(c); + while ((ch = tolower(aa_getkey(context, 1))) < '1' || ch > '8'); + ch-='1'; + if(ch<7) supported^=masks[ch]; + } while (ch<7); + + aa_setsupported(c, supported); +} +int f_getkey(void) +{ + int c=aa_getkey(context,0); + switch(c) { + case 'h': + case 'H': + aa_puts(context,0,0,AA_SPECIAL," aaflip - an ascii art fli/flc player "); + aa_puts(context,0,1,AA_SPECIAL," "); + aa_puts(context,0,2,AA_SPECIAL," ';' '\\' - gamma '<' '>' - bright "); + aa_puts(context,0,3,AA_SPECIAL," '[' ']' - Random dithering',' '.' - contrast "); + aa_puts(context,0,4,AA_SPECIAL," 'I' 'i' - inversion "); + aa_puts(context,0,5,AA_SPECIAL," "); + aa_puts(context,0,6,AA_SPECIAL," 'm' - Dithering method 'q' - quit "); + aa_puts(context,0,7,AA_SPECIAL," 'u' - Select attributes 'g' - font "); + aa_flush(context); + aa_getkey(context,1); + break; + case ';': + params->gamma /= 1.05; + break; + case '\'': + params->gamma *= 1.05; + break; + case '<': + params->bright -= 4; + break; + case '>': + params->bright += 4; + break; + case '[': + params->randomval -= 4; + break; + case ']': + params->randomval += 4; + break; + case ',': + params->contrast -= 2; + break; + case '.': + params->contrast += 2; + break; + case 'm': + params->dither = (params->dither + 1) % AA_DITHERTYPES; + break; + case 'i': + params->inversion = 1; + break; + case 'I': + params->inversion = 0; + break; + case 'u': + selectsupported(context); + break; + case 'g': + selectfont(context); + break; + } + return(c); +} + +int main( int argc, char *argv[] ) { +int quit = 0; +int playstartframe = 0; +int first=1; +long t, tdelta; + aa_parseoptions(NULL,NULL,&argc,argv); + parse_cmdln( argc, argv, &options ); + strcpy( fli.filename, options.filename ); + + /* open flic and get header information */ + if( !open_fli( &fli, &options ) ) { + puts( "cannot open fli file" ); + exit( 1 ); + } + + /* show header */ + if( options.verbose==1 ) { + describe_fli( &fli ); + } + + /* optionally set delays */ + if( options.speed>=0 ) { + fli.h.speed = options.speed; + } + + /* optionally reduce delays to 0 (this overrides the set delay option) */ + if( options.fast==1 ) { + fli.h.speed = 0; + } + + + /* silly but might happen */ + if( options.playrep<=0 ) { + exit( 0 ); + } + + /* determine graphics mode to use */ + /* set mode */ + context=aa_autoinit(&aa_defparams); + if(context==NULL) { + printf("Failed to initialize aalib\n"); + exit(1); + } + aa_hidecursor(context); + aa_autoinitkbd(context,0); + aa_resizehandler(context,resize); + params=aa_getrenderparams(); + fli.scr_width = fli.h.width; + fli.scr_height = fli.h.height; + graph_mem=malloc(fli.scr_width*fli.scr_height); + + fli.frame = (struct FLI_FRAMECHUNK *)malloc( (fli.h.frames+1) * sizeof( struct FLI_FRAMECHUNK ) ); + if( fli.frame==NULL ) { + puts( "cannot allocate enough memory to store frame information\n" ); + exit( 1 ); + } + + fli.current = 0; + /* preloading */ + /* first the 1st frame which is a full screen frame */ + scan_to_frame( &fli ); + + if( !options.blank ) { + getframechunkdata( &fli ); + processframechunk( &fli ); + releaseframechunkdata( &fli ); + playstartframe = 1; + } + else { + getframechunkdata( &fli ); + playstartframe = 0; + if( options.release ) { + releaseframechunkdata( &fli ); + } + } + fli.current++; + first=1; + while( fli.current<=fli.h.frames && !quit ) { + scan_to_frame( &fli ); + getframechunkdata( &fli ); + if( options.firstp ) { + fli.time = gettime(); + processframechunk( &fli ); + } + if( options.release ) { + releaseframechunkdata( &fli ); + } + if(first||options.firstp) { + fastscale(graph_mem,context->imagebuffer, + fli.scr_width,aa_imgwidth(context), + fli.scr_height,aa_imgheight(context), + fli.scr_width,aa_imgwidth(context)); + aa_renderpalette(context,pal,params,0,0,aa_imgwidth(context),aa_imgheight(context)); + if(first&&!options.firstp) + aa_puts(context,0,0,AA_SPECIAL,"Preloading..."); + aa_flush(context); + } + fli.current++; + first=0; + if( f_getkey()=='q' ) quit = 1; + if(options.firstp&&!quit) quit = await(); + } + + if(!quit) { + + if( options.firstp ) { + options.playrep--; + if( options.playrep==0 ) { + quit = 1; + } + } + + fli.current = playstartframe; + while( !quit ) { + fli.time = gettime(); + getframechunkdata( &fli ); + processframechunk( &fli ); + if( options.release ) { + releaseframechunkdata( &fli ); + } + fli.current++; + fastscale(graph_mem,context->imagebuffer, + fli.scr_width,aa_imgwidth(context), + fli.scr_height,aa_imgheight(context), + fli.scr_width,aa_imgwidth(context)); + aa_renderpalette(context,pal,params,0,0,aa_imgwidth(context),aa_imgheight(context)); + aa_flush(context); + if( fli.current>fli.h.frames ) { + fli.current = 1; + options.playrep--; + if( options.playrep==0 ) { + quit = 1; + break; + } + } + quit = await(); + + } + } + + /* restore textmode */ + aa_close(context); + + /* close flic */ + if( !options.stdinp ) { + fclose( fli.f ); + } + fli.f = NULL; + return 0; +}; + + + diff --git a/general.c b/general.c new file mode 100644 index 0000000..aef76e8 --- /dev/null +++ b/general.c @@ -0,0 +1,7 @@ +#include "general.h" + +/* general module source */ + +long freadblock( FILE *fp, long size, void *target ) { + return fread( target, size, 1, fp ); +} diff --git a/general.h b/general.h new file mode 100644 index 0000000..c969b4f --- /dev/null +++ b/general.h @@ -0,0 +1,41 @@ +/* General module include file */ + +#ifndef _GENERAL_H +#define _GENERAL_H + +#ifndef _STDIO_H +#include +#endif + +#include +#include +#include + +#ifndef uint +#define uint unsigned int +#define ulong unsigned long +#define ushort unsigned short int +#define uchar unsigned char +#endif + +#ifndef abs +#define abs(x) (((x)>0)? (x) : (0-(x))) +#endif + +long freadblock( FILE *f, long size, void *target ); + /* reads size bytes from file f to target + returns 1 on success, 0 on error + */ + +void echo( void *source, long size ); + /* echos size bytes taken from source to the std output this way: + 000 001 002 000 255 ....... + */ + +int getkey( void ); + /* returns a character from the stdin stream, returning 0 if no + key was pressed + */ + +#endif + diff --git a/image.c b/image.c new file mode 100644 index 0000000..232b838 --- /dev/null +++ b/image.c @@ -0,0 +1,112 @@ +#include +#include +#include +#include "config.h" + +int imgwidth, imgheight; +unsigned char *imgdata; +#define PBM 0 +#define PGM 1 +#define PPM 2 + +int load_image(char *name) +{ + char data[65536]; + int i, c, max; + int raw = 0; + int type; + FILE *file; + + if (name[0]=='\0') { +#ifdef HAVE_ISATTY + if (isatty(STDIN_FILENO)) { + printf("Missing filename.\n Use --help for list of options.\n"); + return 0; + } +#endif + file = stdin; + } + else { + if ((file = fopen(name, "rb")) == NULL) { + printf("File not found\n"); + return 0; + } + } + if (getc(file) != 'P') { + printf("Invalid magic-not p?m family format\n"); + return 0; + } + c = getc(file); + if (c < '1' || c > '6') { + printf("Invalid magic-unknown p?m family format\n"); + return 0; + } + if (c >= '4') + raw = 1, c -= 3; + type = c - '1'; + c = getc(file); + while (c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '#') { + if (c == '#') + fgets(data, 65536, file); + c = getc(file); + } + ungetc(c, file); + + if (fscanf(file, "%i %i", &imgwidth, &imgheight) != 2) { + printf("Parse error\n"); + return 0; + } + switch (type) { + case PGM: + case PPM: + if (fscanf(file, "%i", &max) != 1) { + printf("Parse error\n"); + return 0; + } + break; + case PBM: + max=1; + break; + } + c = getc(file); + if ((imgdata = malloc(imgwidth * imgheight)) == NULL) { + printf("Out of memory\n"); + return 0; + } + if (!raw) { + if(type==PPM) { + int r,g,b; + for (i = 0; i < imgwidth * imgheight; i++) + fscanf(file, "%i %i %i", &r,&g,&b), + imgdata[i]=(r*76+g*150+b*29)/max; + max=255; + } else + for (i = 0; i < imgwidth * imgheight; i++) + fscanf(file, "%i\n", &c), imgdata[i] = c; + } else { + if(type==PBM) { + for(i=0;i>=1,i++) + imgdata[i]=(n&c)!=0; + } + } else + if(type==PPM) { + for(i=0;i +#include "image.h" +#include "ui.h" +#include "config.h" + +#define NAMELEN 256 + +char filename[NAMELEN]; + +static void showhelp(char *prgname) +{ + printf("Usage: %s [options] filename.p[ngbp]m\n", prgname); + printf("Options:\n%s\n", aa_help); + +} + +static void showversion(char *prgname) +{ + printf("This is %s version %s\n", prgname, VERSION); +} + +static void parse_cmdline( int argc, char *argv[]) +{ + int i; + + filename[0] = '\0'; + for (i = 1; i < argc; i++) { + if (!strncmp(argv[i], "--", 2)) { + if (!strcmp(argv[i], "--help")) { showhelp(argv[0]); exit(0); } + if (!strcmp(argv[i], "--version")) { showversion(argv[0]); exit(0); } + printf("Unknown option. Use %s --help for help\n", argv[0]); + exit(-1); + } + else { + if (argv[i]!=NULL) { + /* argv[i] is the filename of the image file */ + strncpy(filename, argv[i], NAMELEN); + } + } + } +} + +int main(int argc, char **argv) +{ + aa_parseoptions(NULL,NULL,&argc,argv); + parse_cmdline(argc, argv); + if (!load_image(filename)) + exit(-1); + context = aa_autoinit(&aa_defparams); + if (context == NULL) + exit(-1); + aa_autoinitkbd(context,0); + aa_hidecursor(context); + main_loop(); + aa_close(context); + return(0); +} diff --git a/missing b/missing new file mode 100755 index 0000000..7789652 --- /dev/null +++ b/missing @@ -0,0 +1,190 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. +# Copyright (C) 1996, 1997 Free Software Foundation, Inc. +# Franc,ois 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, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +case "$1" in + + -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 + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + 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]" + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing - GNU libit 0.0" + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + + aclocal) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acinclude.m4' or \`configure.in'. 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 missing on your system. You should only need it if + you modified \`configure.in'. 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 missing on your system. You should only need it if + you modified \`acconfig.h' or \`configure.in'. 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.in` + 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 missing on your system. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'. + 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 + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + makeinfo) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. 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." + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + fi + touch $file + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. 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 prerequirements 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 diff --git a/mkinstalldirs b/mkinstalldirs new file mode 100755 index 0000000..18a884d --- /dev/null +++ b/mkinstalldirs @@ -0,0 +1,40 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# Created: 1993-05-16 +# Public domain + +# $Id: mkinstalldirs,v 1.1 2001/04/23 14:12:37 hubicka Exp $ + +errstatus=0 + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here diff --git a/shrink.c b/shrink.c new file mode 100644 index 0000000..cbfd0dc --- /dev/null +++ b/shrink.c @@ -0,0 +1,138 @@ +#include +#include +#include +#include "aalib.h" +#include "image.h" +#include "shrink.h" +typedef double atype; +static atype xstep, ystep; +static atype max; +static int fast; +static int getval(atype x, atype y) +{ + atype xe = x + xstep, ye = y + ystep; + atype ycount, xcount = 0; + int xi, yi, xie = floor(xe), yie = floor(ye); + ycount = 0; + if (x < 0 || x + xstep > imgwidth || y < 0 || y + ystep > imgheight) + return 0; + if (fast) { + xi = x; + yi = y; + xi = imgdata[xi + yi * imgwidth]; + } else { + for (yi = y; yi <= yie; yi++) { + xcount = 0; + xi = x; + xcount += (((int) imgdata[xi + yi * imgwidth])) * (1.0 - x + floor(x)); + xi++; + for (; xi <= xie; xi++) + xcount += (((int) imgdata[xi + yi * imgwidth])); + xi--; + /*if(xie!=floor(xie)) */ + xcount -= (((int) imgdata[xi + yi * imgwidth])) * (1.0 - xe + floor(xe)); + + if (yi == (int) y) + ycount += xcount * (1.0 - y + floor(y)); + else + ycount += xcount; + /*printw("%f %f %f %i\n",xcount,ycount,x,xie); */ + } + /*if(yie!=floor(yie)) */ + ycount -= xcount * (1.0 - ye + floor(ye)); + xi = 256 * ycount / max; + } + if (xi < 0) + xi = 0; + if (xi > 255) + xi = 255; + return (xi); +} +void fastscale(char *b1, char *b2, int x1, int x2, int y1, int y2, int width1, int width2) +{ + int ddx1, ddx, spx = 0, ex; + int ddy1, ddy, spy = 0, ey; + int x; + char *bb1=b1; + width2 -= x2; + if(!x1||!x2||!y1||!y2) return; + ddx = x1 + x1; + ddx1 = x2 + x2; + if (ddx1 < ddx) + spx = ddx / ddx1, ddx %= ddx1; + ddy = y1 + y1; + ddy1 = y2 + y2; + if (ddy1 < ddy) + spy = (ddy / ddy1)*width1, ddy %= ddy1; + ey = -ddy1; + for (; y2; y2--) { + ex = -ddx1; + for (x = x2; x; x--) { + *b2 = *b1; + b2++; + b1 += spx; + ex += ddx; + if (ex > 0) { + b1++; + ex -= ddx1; + } + } + b2 += width2; + bb1 += spy; + ey += ddy; + if (ey > 0) { + bb1 += width1; + ey -= ddy1; + } + b1=bb1; + } +} +void shrink(aa_context * c, int fast1, int x1, int y1, int x2, int y2) +{ + int x, y; + int width = aa_imgwidth(c); + int height = aa_imgheight(c); + if(x2<0||x1>=imgwidth||y2<0||y1>=imgheight) { + memset(c->imagebuffer,0,aa_imgwidth(c)*aa_imgheight(c)); + return; + } + if (fast) { + if(x1<0||y1<0||x2>=imgwidth||y2>=imgheight) + { int xx1=0,xx2=aa_imgwidth(c)-1,yy1=0,yy2=aa_imgheight(c)-1; + memset(c->imagebuffer,0,aa_imgwidth(c)*aa_imgheight(c)); + xstep = ((atype) width) / (x2 - x1 - 1) ; + ystep = ((atype) height) / (y2 - y1 - 1) ; + if(x2>=imgwidth) { + xx2=(imgwidth-1-x1)*xstep; + x2=imgwidth-1; + } + if(y2>=imgheight) { + yy2=(imgheight-1-y1)*ystep; + y2=imgheight-1; + } + if(x1<0) { + xx1=-xstep*x1; + x1=0; + } + if(y1<0) { + yy1=-ystep*y1; + y1=0; + } + fastscale(imgdata + x1 + imgwidth * y1, c->imagebuffer+xx1+yy1*width, x2 - x1, xx2-xx1, y2 - y1, yy2-yy1, imgwidth, aa_imgwidth(c)); + return; + } + else + fastscale(imgdata + x1 + imgwidth * y1, c->imagebuffer, x2 - x1, aa_imgwidth(c), y2 - y1, aa_imgheight(c), imgwidth, aa_imgwidth(c)); + return; + } + fast = fast1; + xstep = (x2 - x1 - 1) / (atype) (width); + ystep = (y2 - y1 - 1) / (atype) (height); + max = xstep * ystep * 256; + for (y = 0; y < height; y++) { + for (x = 0; x < width; x++) { + atype xp = x1 + xstep * x, yp = y1 + ystep * y; + aa_putpixel(c, x, y, getval(xp, yp)); + } + } +} diff --git a/shrink.h b/shrink.h new file mode 100644 index 0000000..6a7b8de --- /dev/null +++ b/shrink.h @@ -0,0 +1,4 @@ +#ifndef SHRINK_H +#define SHRINK_H +extern void shrink(aa_context *, int, int, int, int, int); +#endif diff --git a/stamp-h.in b/stamp-h.in new file mode 100644 index 0000000..9788f70 --- /dev/null +++ b/stamp-h.in @@ -0,0 +1 @@ +timestamp diff --git a/ui.c b/ui.c new file mode 100644 index 0000000..d316f7a --- /dev/null +++ b/ui.c @@ -0,0 +1,475 @@ +#include +#include +#include +#include +#include +#include "shrink.h" +#include "image.h" +aa_context *context; +aa_renderparams *renderparams; +static int x1, y1, x2, y2; +static int fast = 1; +static int resized; +static char getletter(int i) +{ + if(i<9) return('1'+i); + if(i==9) return('0'); + if(i>9) return('A'+i-10); +} +static void do_display(void) +{ + aa_puts(context, 0, 0, AA_SPECIAL, "Calculating.."); + aa_flush(context); + shrink(context, fast, x1, y1, x2, y2); + aa_render(context, renderparams, 0, 0, aa_scrwidth(context), aa_scrheight(context)); + aa_flush(context); +} +static void resize(aa_context * c) +{ + aa_resize(c); + resized = 1; + do_display(); +} + +static int yesno(int x, int y, char *string) +{ + char c; + aa_puts(context, x, y, AA_SPECIAL, string); + aa_flush(context); + while ((c = tolower(aa_getkey(context, 1))) != 'y' && c != 'n'); + return (c == 'y'); +} +static int getnum(char *string) +{ + unsigned char c; + aa_puts(context, 0, 0, AA_SPECIAL, string); + aa_flush(context); + while (((c = tolower(aa_getkey(context, 1))) < '0' || c > '9') && (c<'A' || c>'Z') && (c<'a' || c>'z')); + if(c=='0') return 9; + if(c<='9'&&c>='1') return (c-'1'); + if(c>='a'&&c<='z') return (c-'a'+10); + if(c>='A'&&c<='Z') return (c-'A'+10); + return (c - '0'); +} +static void selectfont(aa_context * c) +{ + int i = 0, i1; + char string[255]; + for (i = 0; aa_fonts[i] != NULL; i++) { + sprintf(string, "%c - %-40s", getletter(i), aa_fonts[i]->name); + aa_puts(context, 0, i, AA_SPECIAL, string); + } + i1 = getnum(""); + if (i1 < i) + aa_setfont(c, *(aa_fonts + i1)); +} +#if AA_LIB_VERSION==1 && AA_LIB_MINNOR==0 +#define SUPPORTED c->driver->params.supported +#else +#define SUPPORTED c->driverparams.supported +#endif +static void selectsupported(aa_context * c) +{ + int supported = c->params.supported; + char text[40]; + int ch; + do { + static char *texts[] = + { + "Normal characters", + "Half bright (dim)", + "Double bright (bold)", + "Bold font", + "Reversed", + "8 bit ascii", + "Control characters"}; + int masks[] = + {AA_NORMAL_MASK, AA_DIM_MASK, AA_BOLD_MASK, AA_BOLDFONT_MASK, AA_REVERSE_MASK, AA_EIGHT, AA_ALL}; + int i; + for (i = 0; i < 7; i++) { + sprintf(text, "%i %-20s:%-12s", i + 1, texts[i], (SUPPORTED & masks[i]) ? ((supported & masks[i]) ? "On" : "Off") : "Unsupported"); + aa_puts(context, 0, i, AA_SPECIAL, text); + } + aa_puts(context, 0, i, AA_SPECIAL, "8 Leave this menu"); + aa_flush(context); + while ((ch = tolower(aa_getkey(context, 1))) < '1' || ch > '8'); + ch -= '1'; + if (ch < 7) + supported ^= masks[ch]; + } while (ch < 7); + + aa_setsupported(c, supported); +} +static void save(void) +{ + int i = 0, i1; + struct aa_savedata data; + aa_context *c; + char string[255]; + char name[256]; + for (i = 0; aa_formats[i] != NULL; i++) { + sprintf(string, "%c - %-40s", getletter(i), aa_formats[i]->formatname); + aa_puts(context, 0, i, AA_SPECIAL, string); + } + while ((i1 = getnum("")) >= i); + do_display(); + data.format = aa_formats[i1]; + if (data.format->flags & AA_USE_PAGES) { + sprintf(string, "Page size is:%ix%i", data.format->pagewidth, data.format->pageheight); + aa_puts(context, 0, 0, AA_SPECIAL, string); + } + aa_puts(context, 0, 1, AA_SPECIAL, "Width of image:"); + sprintf(string, "%i", data.format->width); + do { + aa_edit(context, 0, 2, 5, string, 256); + } while (sscanf(string, "%i", &aa_defparams.width) != 1 || aa_defparams.width <= 0 || aa_defparams.width >= 65000); + aa_puts(context, 0, 3, AA_SPECIAL, "Height of image:"); + sprintf(string, "%i", data.format->height); + do { + aa_edit(context, 0, 4, 5, string, 256); + } while (sscanf(string, "%i", &aa_defparams.height) != 1 || aa_defparams.height <= 0 || aa_defparams.height >= 65000); + name[0] = 0; + data.name = name; + aa_puts(context, 0, 5, AA_SPECIAL, "Filename:"); + aa_edit(context, 0, 6, 20, name, 256); + strcat(name,"%c%e"); + do_display(); + aa_defparams.minwidth = 0; + aa_defparams.minheight = 0; + aa_defparams.maxwidth = 0; + aa_defparams.maxheight = 0; + c = aa_init(&save_d, &aa_defparams, &data); + if (c == NULL) { + return; + } + if (data.format->font == NULL) + selectfont(c); + else + aa_setfont(c, data.format->font); + do_display(); + selectsupported(c); + do_display(); + aa_gotoxy(context, 0, 0); + if (yesno(0, 0, "Save just current view? ")) + shrink(c, fast, x1, y1, x2, y2); + else + shrink(c, fast, 0, 0, imgwidth, imgheight); + aa_puts(context, 0, 1, AA_SPECIAL, "saving.."); + aa_flush(context); + aa_render(c, renderparams, 0, 0, aa_scrwidth(c), aa_scrheight(c)); + aa_flush(c); + aa_close(c); + do_display(); +} +static void ui_help(void) +{ + aa_puts(context, 0, 1, AA_SPECIAL, " asciiarted image viewer by Jan Hubicka "); + aa_puts(context, 0, 2, AA_SPECIAL, " a,w,d,x - move image one row/column A,W,D,X - move image one page"); + aa_puts(context, 0, 3, AA_SPECIAL, " z - unzoom Z - zoom "); + aa_puts(context, 0, 4, AA_SPECIAL, " s - Save image "); + aa_puts(context, 0, 5, AA_SPECIAL, " m - change dithering mode q - quit "); + aa_puts(context, 0, 6, AA_SPECIAL, " i - turns inversion on I - intversion off "); + aa_puts(context, 0, 7, AA_SPECIAL, " u - select attributes f - select font "); + aa_puts(context, 0, 8, AA_SPECIAL, " space - redraw ',','.' - change contrast "); + aa_puts(context, 0, 9, AA_SPECIAL, " ';',''' - change gamma '<','>' - change bright "); + aa_puts(context, 0, 10, AA_SPECIAL, " '+','-' - zoom/unzoom '<','>' - change bright "); +} +void main_loop(void) +{ + int c, i; + int quit = 0; + char string[255]; + float xmul = ((float) aa_mmheight(context)) / aa_mmwidth(context); + float ymul = ((float) aa_mmwidth(context)) / aa_mmheight(context); + resized = 1; + renderparams = aa_getrenderparams(); + aa_resizehandler(context, resize); + while (!quit) { + if (resized) { + xmul = ((float) aa_mmheight(context)) / aa_mmwidth(context); + ymul = ((float) aa_mmwidth(context)) / aa_mmheight(context); + x1 = 0; + y1 = 0; + x2 = imgwidth; + y2 = imgheight; + if (imgwidth * xmul > imgheight) + y2 = imgwidth * xmul; + else + x2 = imgheight * ymul; + x1 = (imgwidth - x2) / 2; + x2 += x1; + y1 = (imgheight - y2) / 2; + y2 += y1; + do_display(); + resized = 0; + } + aa_flush(context); + c = aa_getevent(context, 1); + switch (c) { + case 'h': + ui_help(); + break; + case 'z': + x1 = 0; + y1 = 0; + x2 = aa_imgwidth(context); + y2 = aa_imgwidth(context) * xmul; + do_display(); + break; + case 'Z': + x1 = 0; + y1 = 0; + x2 = imgwidth; + y2 = imgheight; + if (imgwidth * xmul > imgheight) + y2 = imgwidth * xmul; + else + x2 = imgheight * ymul; + do_display(); + break; + case 'd': + if (x2 < imgwidth - 1) { + x1 += context->mulx; + x2 += context->muly; + do_display(); + } + break; + case AA_RIGHT: + case 'D': + { + int step = (x2 - x1) / 5; + if (x2 < imgwidth - step) { + x1 += step; + x2 += step; + } else { + x1 = imgwidth - x2 + x1; + x2 = imgwidth; + } + } + do_display(); + break; + case 'a': + if (x1 > 1) { + x1 -= context->mulx; + x2 -= context->muly; + do_display(); + } + break; + case AA_LEFT: + case 'A': + { + int step = (x2 - x1) / 5; + if (x1 > step) { + x1 -= step; + x2 -= step; + } else { + x2 = x2 - x1; + x1 = 0; + } + do_display(); + } + break; + case 'x': + if (y2 < imgheight - 1) { + y1 += context->mulx; + y2 += context->muly; + do_display(); + } + break; + case AA_DOWN: + case 'X': + { + int step = (y2 - y1) / 5; + if (y2 < imgheight - step) { + y1 += step; + y2 += step; + } else { + y1 = imgheight - y2 + y1; + y2 = imgheight; + } + } + do_display(); + break; + case 'w': + if (y1 > 2) { + y1 -= context->mulx; + y2 -= context->muly; + } + do_display(); + break; + case AA_UP: + case 'W': + { + int step = (y2 - y1) / 5; + if (y1 > step) { + y1 -= step; + y2 -= step; + } else { + y2 = y2 - y1; + y1 = 0; + } + } + do_display(); + break; + case 'q': + quit = 1; + break; + case 'm': + renderparams->dither = (renderparams->dither + 1) % AA_DITHERTYPES; + do_display(); + aa_puts(context, 0, 0, AA_SPECIAL, aa_dithernames[renderparams->dither]); + break; + case ' ': + do_display(); + break; + case 'Q':{ + renderparams->dither = AA_FLOYD_S; + do_display(); + for (i = 2000; i > 5; i -= 7) { + renderparams->randomval = i; + aa_render(context, renderparams, 0, 0, aa_scrwidth(context), aa_scrheight(context)); + aa_flush(context); + } + } + renderparams->dither = AA_FLOYD_S; + aa_render(context, renderparams, 0, 0, aa_scrwidth(context), aa_scrheight(context)); + aa_flush(context); + break; + case 'E':{ + do_display(); + for (i = 0; i < 256; i += 50) { + renderparams->bright = i; + aa_render(context, renderparams, 0, 0, aa_scrwidth(context), aa_scrheight(context)); + aa_flush(context); + } + } + renderparams->bright = 255; + aa_render(context, renderparams, 0, 0, aa_scrwidth(context), aa_scrheight(context)); + aa_flush(context); + renderparams->bright = 0; + renderparams->dither = AA_FLOYD_S; + aa_render(context, renderparams, 0, 0, aa_scrwidth(context), aa_scrheight(context)); + aa_flush(context); + break; + case 'R':{ + do_display(); + for (i = -256; i < 0; i += 5) { + renderparams->bright = i; + aa_render(context, renderparams, 0, 0, aa_scrwidth(context), aa_scrheight(context)); + aa_flush(context); + } + } + renderparams->bright = 0; + aa_render(context, renderparams, 0, 0, aa_scrwidth(context), aa_scrheight(context)); + aa_flush(context); + break; + case 'T':{ + do_display(); + for (i = -256; i < 256; i += 5) { + renderparams->bright = i; + aa_render(context, renderparams, 0, 0, aa_scrwidth(context), aa_scrheight(context)); + aa_flush(context); + } + } + renderparams->bright = 0; + aa_render(context, renderparams, 0, 0, aa_scrwidth(context), aa_scrheight(context)); + aa_flush(context); + break; + case 'i': + renderparams->inversion = 1; + do_display(); + break; + case 'I': + renderparams->inversion = 0; + do_display(); + break; + case 's': + save(); + break; + case 'F': + fast = 1; + do_display(); + break; + case 'f': + fast = 0; + do_display(); + break; + case 'u': + selectsupported(context); + do_display(); + break; + case 'g': + selectfont(context); + do_display(); + break; + case ';': + renderparams->gamma /= 1.05; + do_display(); + sprintf(string, "gamma:%f", renderparams->gamma); + aa_puts(context, 0, 0, AA_SPECIAL, string); + break; + case '\'': + renderparams->gamma *= 1.05; + do_display(); + sprintf(string, "gamma:%f", renderparams->gamma); + aa_puts(context, 0, 0, AA_SPECIAL, string); + break; + case '<': + renderparams->bright -= 4; + do_display(); + sprintf(string, "bright:%f", renderparams->bright / 255.0); + aa_puts(context, 0, 0, AA_SPECIAL, string); + break; + case '>': + renderparams->bright += 4; + do_display(); + sprintf(string, "bright:%f", renderparams->bright / 255.0); + aa_puts(context, 0, 0, AA_SPECIAL, string); + break; + case '[': + renderparams->randomval -= 4; + do_display(); + sprintf(string, "bright:%f", renderparams->bright / 255.0); + aa_puts(context, 0, 0, AA_SPECIAL, string); + break; + case ']': + renderparams->randomval += 4; + do_display(); + sprintf(string, "bright:%f", renderparams->bright / 255.0); + aa_puts(context, 0, 0, AA_SPECIAL, string); + break; + case ',': + renderparams->contrast -= 2; + do_display(); + sprintf(string, "contrast:%f", renderparams->contrast / 127.0); + aa_puts(context, 0, 0, AA_SPECIAL, string); + break; + case '.': + renderparams->contrast += 2; + do_display(); + sprintf(string, "contrast:%f", renderparams->contrast / 127.0); + aa_puts(context, 0, 0, AA_SPECIAL, string); + break; + case '-': + { + int tmp = (x2 - x1 + 7) / 8; + x1 -= tmp; + x2 += tmp; + tmp = (y2 - y1) / 8; + y1 -= tmp; + y2 = y1 + (x2 - x1) * xmul; + do_display(); + } break; + case '+': + { + int tmp = (x2 - x1) / 8; + x1 += tmp; + x2 -= tmp; + tmp = (y2 - y1) / 8; + y1 += tmp; + y2 = y1 + (x2 - x1) * xmul; + do_display(); + } break; + } + } +} diff --git a/ui.h b/ui.h new file mode 100644 index 0000000..2dba760 --- /dev/null +++ b/ui.h @@ -0,0 +1,7 @@ +#ifndef UI_H +#define UI_H +#include "aalib.h" +extern aa_context *context; +extern void main_loop(void); +extern void fsave(void); +#endif