From: arjen Date: Thu, 25 Jul 2002 08:01:14 +0000 (+0000) Subject: First checkin, AXE release 0.2 X-Git-Tag: AXE_0_2~1 X-Git-Url: http://www.andromeda.nl/gitweb/?p=AXE.git;a=commitdiff_plain;h=8c9439657b23c12c7a05c4a56b92b5e9eab07f98 First checkin, AXE release 0.2 --- 8c9439657b23c12c7a05c4a56b92b5e9eab07f98 diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..469560b --- /dev/null +++ b/AUTHORS @@ -0,0 +1,5 @@ + +Authors +======= + +Arjen Baart diff --git a/AXE.html b/AXE.html new file mode 100644 index 0000000..962c394 --- /dev/null +++ b/AXE.html @@ -0,0 +1,38 @@ + + +AXE - Andromeda X windows Encapsulation + + + +

AXE - Andromeda X windows Encapsulation

+ +

+AXE is a C++ class library intended to make programming with +Xlib a lot easier. +Resources in X like windows, colors or graphics contexts are represented by +objects in C++ with member functions to provide the operations on those resources. +The AXE library provides a main() function with the event +loop. +All you need to do is create your own objects with classes that are derived +from the classes in AXE and override the event handling methods to +handle the events you select. +

+ +

+There is also a set of classes for user interface objects, such as menus +and buttons. +A few utility classes handle strings, times and dates. +

+ +

+You can download the AXE tarball which +contains the source and the (slghtly outdated) documentation. +To get you started, read the tutorial. +

+ +

+If you encounter any problems or if you want to make suggestions, +please don't hesitate to drop me an Email +

+ + diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..d60c31a --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 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) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +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) year 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..c5e2916 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,9 @@ +Jul 25, 2002 - Release 0.2 +=========================== + + - First chapter of the tutorial, see doc/tutorial.xml + - Some minor bug fixes + - New function window::WindowGravity() + - New class: configuration. Reads configuration parameters in + an XML file. + - Date parsing correctly understands ISO-style dates (YYYY-MM-DD). diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..b42a17a --- /dev/null +++ b/INSTALL @@ -0,0 +1,182 @@ +Basic Installation +================== + + These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, a file +`config.cache' that saves the results of its tests to speed up +reconfiguring, and a file `config.log' containing compiler output +(useful mainly for debugging `configure'). + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If at some point `config.cache' +contains results you don't want to keep, you may remove or edit it. + + The file `configure.in' is used to create `configure' by a program +called `autoconf'. You only need `configure.in' if you want to change +it or regenerate `configure' using a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. You can give `configure' +initial values for variables by setting them in the environment. Using +a Bourne-compatible shell, you can do that on the command line like +this: + CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure + +Or on systems that have the `env' program, you can do it like this: + env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not supports the `VPATH' +variable, you have to compile the package for one architecture at a time +in the source code directory. After you have installed the package for +one architecture, use `make distclean' before reconfiguring for another +architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=PATH' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + + There may be some features `configure' can not figure out +automatically, but needs to determine by the type of host the package +will run on. Usually `configure' can figure that out, but if it prints +a message saying it can not guess the host type, give it the +`--host=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name with three fields: + CPU-COMPANY-SYSTEM + +See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the host type. + + If you are building compiler tools for cross-compiling, you can also +use the `--target=TYPE' option to select the type of system they will +produce code for and the `--build=TYPE' option to select the type of +system on which you are compiling the package. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Operation Controls +================== + + `configure' recognizes the following options to control how it +operates. + +`--cache-file=FILE' + Use and save the results of the tests in FILE instead of + `./config.cache'. Set FILE to `/dev/null' to disable caching, for + debugging `configure'. + +`--help' + Print a summary of the options to `configure', and exit. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--version' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`configure' also accepts some other, not widely useful, options. diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..a9b38f2 --- /dev/null +++ b/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = src demos diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..4023e99 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,328 @@ +# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999, 2001 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 = : +AWK = @AWK@ +CC = @CC@ +CPP = @CPP@ +CXX = @CXX@ +LEX = @LEX@ +LN_S = @LN_S@ +MAKEINFO = @MAKEINFO@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +VERSION = @VERSION@ +XML_CONFIG = @XML_CONFIG@ +YACC = @YACC@ + +SUBDIRS = src demos +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_CLEAN_FILES = +DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \ +Makefile.in NEWS aclocal.m4 configure configure.in install-sh missing \ +mkinstalldirs + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +all: all-redirect +.SUFFIXES: +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + 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) + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. + +@SET_MAKE@ + +all-recursive install-data-recursive install-exec-recursive \ +installdirs-recursive install-recursive uninstall-recursive \ +check-recursive installcheck-recursive info-recursive dvi-recursive: + @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ + rev="$$subdir $$rev"; \ + test "$$subdir" != "." || dot_seen=yes; \ + done; \ + test "$$dot_seen" = "no" && rev=". $$rev"; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done + +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: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ + fi; \ + done; \ + 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)$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$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) + here=`cd $(top_builddir) && pwd`; \ + top_distdir=`cd $(distdir) && pwd`; \ + distdir=`cd $(distdir) && pwd`; \ + cd $(top_srcdir) \ + && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu Makefile + @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 + for subdir in $(SUBDIRS); do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + chmod 777 $(distdir)/$$subdir; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \ + || exit 1; \ + fi; \ + done +info-am: +info: info-recursive +dvi-am: +dvi: dvi-recursive +check-am: all-am +check: check-recursive +installcheck-am: +installcheck: installcheck-recursive +install-exec-am: +install-exec: install-exec-recursive + +install-data-am: +install-data: install-data-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-recursive +uninstall-am: +uninstall: uninstall-recursive +all-am: Makefile +all-redirect: all-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: installdirs-recursive +installdirs-am: + + +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-tags mostlyclean-generic + +mostlyclean: mostlyclean-recursive + +clean-am: clean-tags clean-generic mostlyclean-am + +clean: clean-recursive + +distclean-am: distclean-tags distclean-generic clean-am + +distclean: distclean-recursive + -rm -f config.status + +maintainer-clean-am: 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-recursive + -rm -f config.status + +.PHONY: install-data-recursive uninstall-data-recursive \ +install-exec-recursive uninstall-exec-recursive installdirs-recursive \ +uninstalldirs-recursive all-recursive check-recursive \ +installcheck-recursive info-recursive dvi-recursive \ +mostlyclean-recursive distclean-recursive clean-recursive \ +maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ +distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ +dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ +install-exec install-data-am install-data install-am install \ +uninstall-am uninstall all-redirect all-am all installdirs-am \ +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..e69de29 diff --git a/README b/README new file mode 100644 index 0000000..f061f00 --- /dev/null +++ b/README @@ -0,0 +1,23 @@ + + AXE - The Andromeda X windows Encapsulation. + ============================================ + +The AXE project started out as a few C++ classes to represent the X resources and +encapsulate the Xlib functions. On top of that, I created some utility classes +such as strings and dates. Over the years many features were added and AXE is growing +into a framework for X applications. The objective is to make programming in X +and creating user interfaces as easy as possible. + +To use AXE, do a do the usual stuff: + ./configure + make + make install (as root, to install in /usr/local) + +This wil give you the library, src/libAXE.a and a test program called +demos/testaxe. There is still a lot of work to be done and +the documentation is a bit outdated, but that doesn't need to stop you from having +fun. + +Your feedback is always appreciated, so drop me a mail, + +Arjen Baart diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000..d41ee4f --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,113 @@ +dnl aclocal.m4 generated automatically by aclocal 1.4-p5 + +dnl Copyright (C) 1994, 1995-8, 1999, 2001 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)]) + + +dnl AM_PROG_LEX +dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT +AC_DEFUN([AM_PROG_LEX], +[missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1) +AC_CHECK_PROGS(LEX, flex lex, "$missing_dir/missing flex") +AC_PROG_LEX +AC_DECL_YYTEXT]) + diff --git a/configure b/configure new file mode 100755 index 0000000..2a44db0 --- /dev/null +++ b/configure @@ -0,0 +1,3388 @@ +#! /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-x use the X Window System" + +# 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=src/xappl.h + +# 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:558: 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:611: 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:668: 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=AXE + +VERSION=0.1 + +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:714: 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:727: 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:740: 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:753: 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:766: 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 + + + + +# 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:784: 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:814: 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:865: 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:897: 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 908 "configure" +#include "confdefs.h" + +main(){return(0);} +EOF +if { (eval echo configure:913: \"$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:939: 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:944: 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:972: 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 + +for ac_prog in $CCC c++ g++ gcc CC cxx cc++ cl +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1008: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # 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_CXX="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CXX="$ac_cv_prog_CXX" +if test -n "$CXX"; then + echo "$ac_t""$CXX" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$CXX" && break +done +test -n "$CXX" || CXX="gcc" + + +echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:1040: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 + +ac_ext=C +# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cxx_cross + +cat > conftest.$ac_ext << EOF + +#line 1051 "configure" +#include "confdefs.h" + +int main(){return(0);} +EOF +if { (eval echo configure:1056: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cxx_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_cxx_cross=no + else + ac_cv_prog_cxx_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cxx_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_cxx_works" 1>&6 +if test $ac_cv_prog_cxx_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 ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:1082: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 +cross_compiling=$ac_cv_prog_cxx_cross + +echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 +echo "configure:1087: checking whether we are using GNU C++" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gxx'+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_gxx=yes +else + ac_cv_prog_gxx=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gxx" 1>&6 + +if test $ac_cv_prog_gxx = yes; then + GXX=yes +else + GXX= +fi + +ac_test_CXXFLAGS="${CXXFLAGS+set}" +ac_save_CXXFLAGS="$CXXFLAGS" +CXXFLAGS= +echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 +echo "configure:1115: checking whether ${CXX-g++} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.cc +if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then + ac_cv_prog_cxx_g=yes +else + ac_cv_prog_cxx_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cxx_g" 1>&6 +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS="$ac_save_CXXFLAGS" +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi + +for ac_declaration in \ + ''\ + '#include ' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat > conftest.$ac_ext < +$ac_declaration +int main() { +exit (42); +; return 0; } +EOF +if { (eval echo configure:1164: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + continue +fi +rm -f conftest* + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + break +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +done +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + + +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:1198: 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:1219: \"$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:1236: \"$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:1253: \"$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 + +missing_dir=`cd $ac_aux_dir && pwd` +for ac_prog in flex lex +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1283: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$LEX"; then + ac_cv_prog_LEX="$LEX" # 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_LEX="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +LEX="$ac_cv_prog_LEX" +if test -n "$LEX"; then + echo "$ac_t""$LEX" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$LEX" && break +done +test -n "$LEX" || LEX=""$missing_dir/missing flex"" + +# Extract the first word of "flex", so it can be a program name with args. +set dummy flex; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1316: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$LEX"; then + ac_cv_prog_LEX="$LEX" # 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_LEX="flex" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_LEX" && ac_cv_prog_LEX="lex" +fi +fi +LEX="$ac_cv_prog_LEX" +if test -n "$LEX"; then + echo "$ac_t""$LEX" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$LEXLIB" +then + case "$LEX" in + flex*) ac_lib=fl ;; + *) ac_lib=l ;; + esac + echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6 +echo "configure:1350: checking for yywrap in -l$ac_lib" >&5 +ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-l$ac_lib $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LEXLIB="-l$ac_lib" +else + echo "$ac_t""no" 1>&6 +fi + +fi + +echo $ac_n "checking lex output file root""... $ac_c" 1>&6 +echo "configure:1392: checking lex output file root" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_lex_root'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # The minimal lex program is just a single line: %%. But some broken lexes +# (Solaris, I think it was) want two %% lines, so accommodate them. +echo '%% +%%' | $LEX +if test -f lex.yy.c; then + ac_cv_prog_lex_root=lex.yy +elif test -f lexyy.c; then + ac_cv_prog_lex_root=lexyy +else + { echo "configure: error: cannot find output from $LEX; giving up" 1>&2; exit 1; } +fi +fi + +echo "$ac_t""$ac_cv_prog_lex_root" 1>&6 +LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root + +echo $ac_n "checking whether yytext is a pointer""... $ac_c" 1>&6 +echo "configure:1413: checking whether yytext is a pointer" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_lex_yytext_pointer'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # POSIX says lex can declare yytext either as a pointer or an array; the +# default is implementation-dependent. Figure out which it is, since +# not all implementations provide the %pointer and %array declarations. +ac_cv_prog_lex_yytext_pointer=no +echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c +ac_save_LIBS="$LIBS" +LIBS="$LIBS $LEXLIB" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_cv_prog_lex_yytext_pointer=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +LIBS="$ac_save_LIBS" +rm -f "${LEX_OUTPUT_ROOT}.c" + +fi + +echo "$ac_t""$ac_cv_prog_lex_yytext_pointer" 1>&6 +if test $ac_cv_prog_lex_yytext_pointer = yes; then + cat >> confdefs.h <<\EOF +#define YYTEXT_POINTER 1 +EOF + +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:1465: 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 ln -s works""... $ac_c" 1>&6 +echo "configure:1518: checking whether ln -s works" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + rm -f conftestdata +if ln -s X conftestdata 2>/dev/null +then + rm -f conftestdata + ac_cv_prog_LN_S="ln -s" +else + ac_cv_prog_LN_S=ln +fi +fi +LN_S="$ac_cv_prog_LN_S" +if test "$ac_cv_prog_LN_S" = "ln -s"; then + echo "$ac_t""yes" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1541: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # 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_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +for ac_prog in 'bison -y' byacc +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1573: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$YACC"; then + ac_cv_prog_YACC="$YACC" # 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_YACC="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +YACC="$ac_cv_prog_YACC" +if test -n "$YACC"; then + echo "$ac_t""$YACC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$YACC" && break +done +test -n "$YACC" || YACC="yacc" + +for ac_prog in gawk mawk nawk awk +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1608: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # 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_AWK="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +AWK="$ac_cv_prog_AWK" +if test -n "$AWK"; then + echo "$ac_t""$AWK" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$AWK" && break +done + + +# Extract the first word of "xml-config", so it can be a program name with args. +set dummy xml-config; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1641: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_XML_CONFIG'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$XML_CONFIG" in + /*) + ac_cv_path_XML_CONFIG="$XML_CONFIG" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_XML_CONFIG="$XML_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_XML_CONFIG="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_XML_CONFIG" && ac_cv_path_XML_CONFIG="no" + ;; +esac +fi +XML_CONFIG="$ac_cv_path_XML_CONFIG" +if test -n "$XML_CONFIG"; then + echo "$ac_t""$XML_CONFIG" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +# If we find X, set shell vars x_includes and x_libraries to the +# paths, otherwise set no_x=yes. +# Uses ac_ vars as temps to allow command line to override cache and checks. +# --without-x overrides everything else, but does not touch the cache. +echo $ac_n "checking for X""... $ac_c" 1>&6 +echo "configure:1680: checking for X" >&5 + +# Check whether --with-x or --without-x was given. +if test "${with_x+set}" = set; then + withval="$with_x" + : +fi + +# $have_x is `yes', `no', `disabled', or empty when we do not yet know. +if test "x$with_x" = xno; then + # The user explicitly disabled X. + have_x=disabled +else + if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then + # Both variables are already set. + have_x=yes + else +if eval "test \"`echo '$''{'ac_cv_have_x'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # One or both of the vars are not set, and there is no cached value. +ac_x_includes=NO ac_x_libraries=NO +rm -fr conftestdir +if mkdir conftestdir; then + cd conftestdir + # Make sure to not put "make" in the Imakefile rules, since we grep it out. + cat > Imakefile <<'EOF' +acfindx: + @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"' +EOF + if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then + # GNU make sometimes prints "make[1]: Entering...", which would confuse us. + eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` + # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. + for ac_extension in a so sl; do + if test ! -f $ac_im_usrlibdir/libX11.$ac_extension && + test -f $ac_im_libdir/libX11.$ac_extension; then + ac_im_usrlibdir=$ac_im_libdir; break + fi + done + # Screen out bogus values from the imake configuration. They are + # bogus both because they are the default anyway, and because + # using them would break gcc on systems where it needs fixed includes. + case "$ac_im_incroot" in + /usr/include) ;; + *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes="$ac_im_incroot" ;; + esac + case "$ac_im_usrlibdir" in + /usr/lib | /lib) ;; + *) test -d "$ac_im_usrlibdir" && ac_x_libraries="$ac_im_usrlibdir" ;; + esac + fi + cd .. + rm -fr conftestdir +fi + +if test "$ac_x_includes" = NO; then + # Guess where to find include files, by looking for this one X11 .h file. + test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h + + # First, try using that file with no special directory specified. +cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1747: \"$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* + # We can compile using X headers with no special include directory. +ac_x_includes= +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + # Look for the header file in a standard set of common directories. +# Check X11 before X11Rn because it is often a symlink to the current release. + for ac_dir in \ + /usr/X11/include \ + /usr/X11R6/include \ + /usr/X11R5/include \ + /usr/X11R4/include \ + \ + /usr/include/X11 \ + /usr/include/X11R6 \ + /usr/include/X11R5 \ + /usr/include/X11R4 \ + \ + /usr/local/X11/include \ + /usr/local/X11R6/include \ + /usr/local/X11R5/include \ + /usr/local/X11R4/include \ + \ + /usr/local/include/X11 \ + /usr/local/include/X11R6 \ + /usr/local/include/X11R5 \ + /usr/local/include/X11R4 \ + \ + /usr/X386/include \ + /usr/x386/include \ + /usr/XFree86/include/X11 \ + \ + /usr/include \ + /usr/local/include \ + /usr/unsupported/include \ + /usr/athena/include \ + /usr/local/x11r5/include \ + /usr/lpp/Xamples/include \ + \ + /usr/openwin/include \ + /usr/openwin/share/include \ + ; \ + do + if test -r "$ac_dir/$x_direct_test_include"; then + ac_x_includes=$ac_dir + break + fi + done +fi +rm -f conftest* +fi # $ac_x_includes = NO + +if test "$ac_x_libraries" = NO; then + # Check for the libraries. + + test -z "$x_direct_test_library" && x_direct_test_library=Xt + test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc + + # See if we find them without any special options. + # Don't add to $LIBS permanently. + ac_save_LIBS="$LIBS" + LIBS="-l$x_direct_test_library $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + LIBS="$ac_save_LIBS" +# We can link X programs with no special library path. +ac_x_libraries= +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + LIBS="$ac_save_LIBS" +# First see if replacing the include by lib works. +# Check X11 before X11Rn because it is often a symlink to the current release. +for ac_dir in `echo "$ac_x_includes" | sed s/include/lib/` \ + /usr/X11/lib \ + /usr/X11R6/lib \ + /usr/X11R5/lib \ + /usr/X11R4/lib \ + \ + /usr/lib/X11 \ + /usr/lib/X11R6 \ + /usr/lib/X11R5 \ + /usr/lib/X11R4 \ + \ + /usr/local/X11/lib \ + /usr/local/X11R6/lib \ + /usr/local/X11R5/lib \ + /usr/local/X11R4/lib \ + \ + /usr/local/lib/X11 \ + /usr/local/lib/X11R6 \ + /usr/local/lib/X11R5 \ + /usr/local/lib/X11R4 \ + \ + /usr/X386/lib \ + /usr/x386/lib \ + /usr/XFree86/lib/X11 \ + \ + /usr/lib \ + /usr/local/lib \ + /usr/unsupported/lib \ + /usr/athena/lib \ + /usr/local/x11r5/lib \ + /usr/lpp/Xamples/lib \ + /lib/usr/lib/X11 \ + \ + /usr/openwin/lib \ + /usr/openwin/share/lib \ + ; \ +do + for ac_extension in a so sl; do + if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then + ac_x_libraries=$ac_dir + break 2 + fi + done +done +fi +rm -f conftest* +fi # $ac_x_libraries = NO + +if test "$ac_x_includes" = NO || test "$ac_x_libraries" = NO; then + # Didn't find X anywhere. Cache the known absence of X. + ac_cv_have_x="have_x=no" +else + # Record where we found X for the cache. + ac_cv_have_x="have_x=yes \ + ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries" +fi +fi + fi + eval "$ac_cv_have_x" +fi # $with_x != no + +if test "$have_x" != yes; then + echo "$ac_t""$have_x" 1>&6 + no_x=yes +else + # If each of the values was on the command line, it overrides each guess. + test "x$x_includes" = xNONE && x_includes=$ac_x_includes + test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries + # Update the cache value to reflect the command line values. + ac_cv_have_x="have_x=yes \ + ac_x_includes=$x_includes ac_x_libraries=$x_libraries" + echo "$ac_t""libraries $x_libraries, headers $x_includes" 1>&6 +fi + +if test "$no_x" = yes; then + # Not all programs may use this symbol, but it does not hurt to define it. + cat >> confdefs.h <<\EOF +#define X_DISPLAY_MISSING 1 +EOF + + X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS= +else + if test -n "$x_includes"; then + X_CFLAGS="$X_CFLAGS -I$x_includes" + fi + + # It would also be nice to do this for all -L options, not just this one. + if test -n "$x_libraries"; then + X_LIBS="$X_LIBS -L$x_libraries" + # For Solaris; some versions of Sun CC require a space after -R and + # others require no space. Words are not sufficient . . . . + case "`(uname -sr) 2>/dev/null`" in + "SunOS 5"*) + echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6 +echo "configure:1929: checking whether -R must be followed by a space" >&5 + ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries" + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_R_nospace=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_R_nospace=no +fi +rm -f conftest* + if test $ac_R_nospace = yes; then + echo "$ac_t""no" 1>&6 + X_LIBS="$X_LIBS -R$x_libraries" + else + LIBS="$ac_xsave_LIBS -R $x_libraries" + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_R_space=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_R_space=no +fi +rm -f conftest* + if test $ac_R_space = yes; then + echo "$ac_t""yes" 1>&6 + X_LIBS="$X_LIBS -R $x_libraries" + else + echo "$ac_t""neither works" 1>&6 + fi + fi + LIBS="$ac_xsave_LIBS" + esac + fi + + # Check for system-dependent libraries X programs must link with. + # Do this before checking for the system-independent R6 libraries + # (-lICE), since we may need -lsocket or whatever for X linking. + + if test "$ISC" = yes; then + X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet" + else + # Martyn.Johnson@cl.cam.ac.uk says this is needed for Ultrix, if the X + # libraries were built with DECnet support. And karl@cs.umb.edu says + # the Alpha needs dnet_stub (dnet does not exist). + echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6 +echo "configure:1994: checking for dnet_ntoa in -ldnet" >&5 +ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldnet $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" +else + echo "$ac_t""no" 1>&6 +fi + + if test $ac_cv_lib_dnet_dnet_ntoa = no; then + echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6 +echo "configure:2035: checking for dnet_ntoa in -ldnet_stub" >&5 +ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldnet_stub $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub" +else + echo "$ac_t""no" 1>&6 +fi + + fi + + # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT, + # to get the SysV transport functions. + # chad@anasazi.com says the Pyramis MIS-ES running DC/OSx (SVR4) + # needs -lnsl. + # The nsl library prevents programs from opening the X display + # on Irix 5.2, according to dickey@clark.net. + echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 +echo "configure:2083: checking for gethostbyname" >&5 +if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+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 gethostbyname(); + +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_gethostbyname) || defined (__stub___gethostbyname) +choke me +#else +gethostbyname(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2111: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_gethostbyname=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_gethostbyname=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +fi + + if test $ac_cv_func_gethostbyname = no; then + echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 +echo "configure:2132: checking for gethostbyname in -lnsl" >&5 +ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lnsl $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl" +else + echo "$ac_t""no" 1>&6 +fi + + fi + + # lieder@skyler.mavd.honeywell.com says without -lsocket, + # socket/setsockopt and other routines are undefined under SCO ODT + # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary + # on later versions), says simon@lia.di.epfl.ch: it contains + # gethostby* variants that don't use the nameserver (or something). + # -lsocket must be given before -lnsl if both are needed. + # We assume that if connect needs -lnsl, so does gethostbyname. + echo $ac_n "checking for connect""... $ac_c" 1>&6 +echo "configure:2181: checking for connect" >&5 +if eval "test \"`echo '$''{'ac_cv_func_connect'+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 connect(); + +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_connect) || defined (__stub___connect) +choke me +#else +connect(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2209: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_connect=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_connect=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'connect`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +fi + + if test $ac_cv_func_connect = no; then + echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 +echo "configure:2230: checking for connect in -lsocket" >&5 +ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lsocket $X_EXTRA_LIBS $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS" +else + echo "$ac_t""no" 1>&6 +fi + + fi + + # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. + echo $ac_n "checking for remove""... $ac_c" 1>&6 +echo "configure:2273: checking for remove" >&5 +if eval "test \"`echo '$''{'ac_cv_func_remove'+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 remove(); + +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_remove) || defined (__stub___remove) +choke me +#else +remove(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2301: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_remove=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_remove=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'remove`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +fi + + if test $ac_cv_func_remove = no; then + echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 +echo "configure:2322: checking for remove in -lposix" >&5 +ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lposix $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix" +else + echo "$ac_t""no" 1>&6 +fi + + fi + + # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. + echo $ac_n "checking for shmat""... $ac_c" 1>&6 +echo "configure:2365: checking for shmat" >&5 +if eval "test \"`echo '$''{'ac_cv_func_shmat'+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 shmat(); + +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_shmat) || defined (__stub___shmat) +choke me +#else +shmat(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2393: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_shmat=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_shmat=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'shmat`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +fi + + if test $ac_cv_func_shmat = no; then + echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 +echo "configure:2414: checking for shmat in -lipc" >&5 +ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lipc $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc" +else + echo "$ac_t""no" 1>&6 +fi + + fi + fi + + # Check for libraries that X11R6 Xt/Xaw programs need. + ac_save_LDFLAGS="$LDFLAGS" + test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries" + # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to + # check for ICE first), but we must link in the order -lSM -lICE or + # we get undefined symbols. So assume we have SM if we have ICE. + # These have to be linked with before -lX11, unlike the other + # libraries we check for below, so use a different variable. + # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. + echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6 +echo "configure:2466: checking for IceConnectionNumber in -lICE" >&5 +ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lICE $X_EXTRA_LIBS $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE" +else + echo "$ac_t""no" 1>&6 +fi + + LDFLAGS="$ac_save_LDFLAGS" + +fi + + +XML_CFLAGS=`$XML_CONFIG --cflags` + +LIBS="$LIBS $X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS" +CFLAGS="$CFLAGS $X_CFLAGS $XML_CFLAGS" +CXXFLAGS="$CXXFLAGS $X_CFLAGS $XML_CFLAGS" + +echo $ac_n "checking for XOpenDisplay in -lX11""... $ac_c" 1>&6 +echo "configure:2517: checking for XOpenDisplay in -lX11" >&5 +ac_lib_var=`echo X11'_'XOpenDisplay | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lX11 $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo X11 | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + +echo $ac_n "checking for XpmCreatePixmapFromData in -lXpm""... $ac_c" 1>&6 +echo "configure:2564: checking for XpmCreatePixmapFromData in -lXpm" >&5 +ac_lib_var=`echo Xpm'_'XpmCreatePixmapFromData | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lXpm $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo Xpm | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + +echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6 +echo "configure:2611: checking for pthread_create in -lpthread" >&5 +ac_lib_var=`echo pthread'_'pthread_create | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lpthread $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo pthread | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + +echo $ac_n "checking for xmlParseFile in -lxml""... $ac_c" 1>&6 +echo "configure:2658: checking for xmlParseFile in -lxml" >&5 +ac_lib_var=`echo xml'_'xmlParseFile | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lxml $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo xml | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + + +ac_header_dirent=no +for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 +echo "configure:2710: checking for $ac_hdr that defines DIR" >&5 +if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include <$ac_hdr> +int main() { +DIR *dirp = 0; +; return 0; } +EOF +if { (eval echo configure:2723: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + eval "ac_cv_header_dirent_$ac_safe=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_dirent_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done +# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. +if test $ac_header_dirent = dirent.h; then +echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 +echo "configure:2748: checking for opendir in -ldir" >&5 +ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldir $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LIBS="$LIBS -ldir" +else + echo "$ac_t""no" 1>&6 +fi + +else +echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 +echo "configure:2789: checking for opendir in -lx" >&5 +ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lx $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LIBS="$LIBS -lx" +else + echo "$ac_t""no" 1>&6 +fi + +fi + +echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 +echo "configure:2831: 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:2844: \"$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:2911: \"$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 + +for ac_hdr in unistd.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:2938: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2948: \"$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* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + + +echo $ac_n "checking for working const""... $ac_c" 1>&6 +echo "configure:2976: checking for working const" >&5 +if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <j = 5; +} +{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; +} + +; return 0; } +EOF +if { (eval echo configure:3030: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_const=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_c_const=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_c_const" 1>&6 +if test $ac_cv_c_const = no; then + cat >> confdefs.h <<\EOF +#define const +EOF + +fi + + +for ac_func in strtod strtol strtoul +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:3054: 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:3082: \"$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 + + +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 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# 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 src/Makefile demos/Makefile" | 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%@CXX@%$CXX%g +s%@CPP@%$CPP%g +s%@LEX@%$LEX%g +s%@LEXLIB@%$LEXLIB%g +s%@LEX_OUTPUT_ROOT@%$LEX_OUTPUT_ROOT%g +s%@LN_S@%$LN_S%g +s%@RANLIB@%$RANLIB%g +s%@YACC@%$YACC%g +s%@AWK@%$AWK%g +s%@XML_CONFIG@%$XML_CONFIG%g +s%@X_CFLAGS@%$X_CFLAGS%g +s%@X_PRE_LIBS@%$X_PRE_LIBS%g +s%@X_LIBS@%$X_LIBS%g +s%@X_EXTRA_LIBS@%$X_EXTRA_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* + +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF + +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..a470fcd --- /dev/null +++ b/configure.in @@ -0,0 +1,44 @@ +dnl Process this file with autoconf to produce a configure script. +AC_INIT(src/xappl.h) +AM_INIT_AUTOMAKE(AXE, 0.1) + + +dnl Checks for programs. +AC_PROG_CC +AC_PROG_CXX +AC_PROG_CPP +AM_PROG_LEX +AC_PROG_INSTALL +AC_PROG_LN_S +AC_PROG_RANLIB +AC_PROG_YACC +AC_PROG_AWK + +AC_PATH_PROG(XML_CONFIG,xml-config,no) + +dnl Checks for libraries. +AC_PATH_XTRA + +XML_CFLAGS=`$XML_CONFIG --cflags` + +LIBS="$LIBS $X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS" +CFLAGS="$CFLAGS $X_CFLAGS $XML_CFLAGS" +CXXFLAGS="$CXXFLAGS $X_CFLAGS $XML_CFLAGS" + +AC_CHECK_LIB(X11, XOpenDisplay) +AC_CHECK_LIB(Xpm, XpmCreatePixmapFromData) +AC_CHECK_LIB(pthread, pthread_create) +AC_CHECK_LIB(xml, xmlParseFile) + +dnl Checks for header files. +AC_HEADER_DIRENT +AC_HEADER_STDC +AC_CHECK_HEADERS(unistd.h) + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST + +dnl Checks for library functions. +AC_CHECK_FUNCS(strtod strtol strtoul) + +AC_OUTPUT(Makefile src/Makefile demos/Makefile) diff --git a/demos/Makefile.am b/demos/Makefile.am new file mode 100644 index 0000000..e718fef --- /dev/null +++ b/demos/Makefile.am @@ -0,0 +1,16 @@ + +## Process this file with automake to produce Makefile.in +includedir = $(prefix)/include/AXE + +noinst_PROGRAMS = acltest testaxe metronome doodle1 doodle2 doodle3 + +INCLUDES = -I../src + +LDADD = ../src/libAXE.a @LIBS@ + +acltest_SOURCES = acltest.cpp +testaxe_SOURCES = testaxe.cpp +metronome_SOURCES = metronome.cpp +doodle1_SOURCES = doodle1.cpp +doodle2_SOURCES = doodle2.cpp +doodle3_SOURCES = doodle3.cpp diff --git a/demos/Makefile.in b/demos/Makefile.in new file mode 100644 index 0000000..ce5b701 --- /dev/null +++ b/demos/Makefile.in @@ -0,0 +1,375 @@ +# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999, 2001 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@ +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 = : +AWK = @AWK@ +CC = @CC@ +CPP = @CPP@ +CXX = @CXX@ +LEX = @LEX@ +LN_S = @LN_S@ +MAKEINFO = @MAKEINFO@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +VERSION = @VERSION@ +XML_CONFIG = @XML_CONFIG@ +YACC = @YACC@ + +includedir = $(prefix)/include/AXE + +noinst_PROGRAMS = acltest testaxe metronome doodle1 doodle2 doodle3 + +INCLUDES = -I../src + +LDADD = ../src/libAXE.a @LIBS@ + +acltest_SOURCES = acltest.cpp +testaxe_SOURCES = testaxe.cpp +metronome_SOURCES = metronome.cpp +doodle1_SOURCES = doodle1.cpp +doodle2_SOURCES = doodle2.cpp +doodle3_SOURCES = doodle3.cpp +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_CLEAN_FILES = +PROGRAMS = $(noinst_PROGRAMS) + + +DEFS = @DEFS@ -I. -I$(srcdir) +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +X_CFLAGS = @X_CFLAGS@ +X_LIBS = @X_LIBS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +acltest_OBJECTS = acltest.o +acltest_LDADD = $(LDADD) +acltest_DEPENDENCIES = ../src/libAXE.a +acltest_LDFLAGS = +testaxe_OBJECTS = testaxe.o +testaxe_LDADD = $(LDADD) +testaxe_DEPENDENCIES = ../src/libAXE.a +testaxe_LDFLAGS = +metronome_OBJECTS = metronome.o +metronome_LDADD = $(LDADD) +metronome_DEPENDENCIES = ../src/libAXE.a +metronome_LDFLAGS = +doodle1_OBJECTS = doodle1.o +doodle1_LDADD = $(LDADD) +doodle1_DEPENDENCIES = ../src/libAXE.a +doodle1_LDFLAGS = +doodle2_OBJECTS = doodle2.o +doodle2_LDADD = $(LDADD) +doodle2_DEPENDENCIES = ../src/libAXE.a +doodle2_LDFLAGS = +doodle3_OBJECTS = doodle3.o +doodle3_LDADD = $(LDADD) +doodle3_DEPENDENCIES = ../src/libAXE.a +doodle3_LDFLAGS = +CXXFLAGS = @CXXFLAGS@ +CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ +DIST_COMMON = Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +DEP_FILES = .deps/acltest.P .deps/doodle1.P .deps/doodle2.P \ +.deps/doodle3.P .deps/metronome.P .deps/testaxe.P +SOURCES = $(acltest_SOURCES) $(testaxe_SOURCES) $(metronome_SOURCES) $(doodle1_SOURCES) $(doodle2_SOURCES) $(doodle3_SOURCES) +OBJECTS = $(acltest_OBJECTS) $(testaxe_OBJECTS) $(metronome_OBJECTS) $(doodle1_OBJECTS) $(doodle2_OBJECTS) $(doodle3_OBJECTS) + +all: all-redirect +.SUFFIXES: +.SUFFIXES: .S .c .cpp .o .s +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu demos/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + + +mostlyclean-noinstPROGRAMS: + +clean-noinstPROGRAMS: + -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) + +distclean-noinstPROGRAMS: + +maintainer-clean-noinstPROGRAMS: + +.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: + +acltest: $(acltest_OBJECTS) $(acltest_DEPENDENCIES) + @rm -f acltest + $(CXXLINK) $(acltest_LDFLAGS) $(acltest_OBJECTS) $(acltest_LDADD) $(LIBS) + +testaxe: $(testaxe_OBJECTS) $(testaxe_DEPENDENCIES) + @rm -f testaxe + $(CXXLINK) $(testaxe_LDFLAGS) $(testaxe_OBJECTS) $(testaxe_LDADD) $(LIBS) + +metronome: $(metronome_OBJECTS) $(metronome_DEPENDENCIES) + @rm -f metronome + $(CXXLINK) $(metronome_LDFLAGS) $(metronome_OBJECTS) $(metronome_LDADD) $(LIBS) + +doodle1: $(doodle1_OBJECTS) $(doodle1_DEPENDENCIES) + @rm -f doodle1 + $(CXXLINK) $(doodle1_LDFLAGS) $(doodle1_OBJECTS) $(doodle1_LDADD) $(LIBS) + +doodle2: $(doodle2_OBJECTS) $(doodle2_DEPENDENCIES) + @rm -f doodle2 + $(CXXLINK) $(doodle2_LDFLAGS) $(doodle2_OBJECTS) $(doodle2_LDADD) $(LIBS) + +doodle3: $(doodle3_OBJECTS) $(doodle3_DEPENDENCIES) + @rm -f doodle3 + $(CXXLINK) $(doodle3_LDFLAGS) $(doodle3_OBJECTS) $(doodle3_LDADD) $(LIBS) +.cpp.o: + $(CXXCOMPILE) -c $< + +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) $(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)$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = demos + +distdir: $(DISTFILES) + here=`cd $(top_builddir) && pwd`; \ + top_distdir=`cd $(top_distdir) && pwd`; \ + distdir=`cd $(distdir) && pwd`; \ + cd $(top_srcdir) \ + && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu demos/Makefile + @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 + +DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) + +-include $(DEP_FILES) + +mostlyclean-depend: + +clean-depend: + +distclean-depend: + -rm -rf .deps + +maintainer-clean-depend: + +%.o: %.c + @echo '$(COMPILE) -c $<'; \ + $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-cp .deps/$(*F).pp .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm .deps/$(*F).pp + +%.lo: %.c + @echo '$(LTCOMPILE) -c $<'; \ + $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ + < .deps/$(*F).pp > .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm -f .deps/$(*F).pp + +%.o: %.cpp + @echo '$(CXXCOMPILE) -c $<'; \ + $(CXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-cp .deps/$(*F).pp .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm .deps/$(*F).pp + +%.lo: %.cpp + @echo '$(LTCXXCOMPILE) -c $<'; \ + $(LTCXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ + < .deps/$(*F).pp > .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm -f .deps/$(*F).pp +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: all-am +check: check-am +installcheck-am: +installcheck: installcheck-am +install-exec-am: +install-exec: install-exec-am + +install-data-am: +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: +uninstall: uninstall-am +all-am: Makefile $(PROGRAMS) +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + + +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-noinstPROGRAMS mostlyclean-compile \ + mostlyclean-tags mostlyclean-depend mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-noinstPROGRAMS clean-compile clean-tags clean-depend \ + clean-generic mostlyclean-am + +clean: clean-am + +distclean-am: distclean-noinstPROGRAMS distclean-compile distclean-tags \ + distclean-depend distclean-generic clean-am + +distclean: distclean-am + +maintainer-clean-am: maintainer-clean-noinstPROGRAMS \ + maintainer-clean-compile maintainer-clean-tags \ + maintainer-clean-depend 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 + +.PHONY: mostlyclean-noinstPROGRAMS distclean-noinstPROGRAMS \ +clean-noinstPROGRAMS maintainer-clean-noinstPROGRAMS \ +mostlyclean-compile distclean-compile clean-compile \ +maintainer-clean-compile tags mostlyclean-tags distclean-tags \ +clean-tags maintainer-clean-tags distdir mostlyclean-depend \ +distclean-depend clean-depend maintainer-clean-depend info-am info \ +dvi-am dvi check check-am installcheck-am installcheck 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/demos/acltest.cpp b/demos/acltest.cpp new file mode 100644 index 0000000..7121166 --- /dev/null +++ b/demos/acltest.cpp @@ -0,0 +1,177 @@ +/************************************************************************** +** (c) Copyright 1999, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : acltest.cpp +** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : Test routine for non-X classes +** +** EXPORTED OBJECTS : +** LOCAL OBJECTS : +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Feb 06, 1998 +** LAST UPDATE : Oct 16, 1999 +**************************************************************************/ + +/***************************** + $Log: acltest.cpp,v $ + Revision 1.1 2002-07-25 08:01:18 arjen + First checkin, AXE release 0.2 + +*****************************/ + +static const char *RCSID = "$Id: acltest.cpp,v 1.1 2002-07-25 08:01:18 arjen Exp $"; + +#include "String.h" +#include "integer.h" +#include "complex/complex.h" +#include "date.h" + +int main() +{ + String hello = "Hello there"; + String points, pattern; + + cout << hello << ",length= " << ~hello << "\n"; + cout << "4th character = " << hello[3] << " (Changed to L)\n"; + hello[3] = 'L'; + + if ((char *)points) + cout << "Points is not empty\n"; + if (!points) + cout << "Points is empty\n"; + points = "123456"; + + if ((char *)points) + cout << "after assignment: Points is not empty\n"; + if (!points) + cout << "after assignment: points is empty\n"; + + hello += points + String("!??"); + cout << "Catenated: " << hello << ",length= " << ~hello << "\n"; + + cout << "Substring(10,3) = " << String(hello(10,3)) << "\n"; + + hello(10,3) = points; + cout << "hello(10,3)=points ->hello = " << hello << "\n"; + cout << "Substring(8,9) = " << String(hello(8,9)) << "\n"; + + cout << "Converted to upper case: " << hello.upper() << "\n"; + cout << "Converted to lower case: " << hello.lower() << "\n"; + + hello(8,9) = "__"; + cout << "hello(8,9)=__ ->hello = " << hello << "\n"; + hello(8,7) = ""; + cout << "Removing with hello(8,7) = \"\": " << hello << "\n"; + hello(8,0) = "ere "; + cout << "Inserting with hello(8,0) = \"ere \": " << hello << "\n"; + hello(5, ~hello-5) = ""; + cout << "Truncating with hello(5, ~hello-5) = \"\": " << hello << "\n"; + + cout << "String shifting:\n"; + String x("abcdefgh"); + String y; + y = x << 3; + cout << x << " << 3 = " << y << "\n"; + y = x >> 3; + cout << x << " >> 3 = " << y << "\n"; + + cout << "\nInput a string:\n"; + cin >> hello; + cout << hello << "\n\n"; + cout << "\nAnd another one:\n"; + cin >> pattern; + cout << pattern << "\n\n"; + cout << "Second string found at position " << pattern.in(hello); + cout << " of first string.\n"; + + cout << "Construct a string from an int: "; + String num(3737); + cout << num << "\n"; + + cout << "***********************\nInteger Test\n*********************\n"; + integer a(2000000000), b(2048); + integer c; + + cout << "a = " << a << ", b = " << b << "\n"; + cout << "c = " << c << "\n"; + c = b; + cout << "c = b : c = " << c << "\n"; + + cout << "***********************\nComplex Number Test\n*********************\n"; + +#if 0 + complex z1, z2, z3; + z1 = complex(1,0); + z2 = complex(0,1); + z3 = z1 + z2; + cout << z1 << " + " << z2 << " = " << z3 << "\n"; + z3 = z1 - z2; + cout << z1 << " - " << z2 << " = " << z3 << "\n"; + z3 = z1 * z2; + cout << z1 << " * " << z2 << " = " << z3 << "\n"; + z3 = z1 / z2; + cout << z1 << " / " << z2 << " = " << z3 << "\n"; +#endif + + cout << "***********************\nDate Test\n*********************\n"; + date d1, d2(22,7,1964); + + cout << "Default constructor: " << d1 << ", with (d,m,y): " << d2 << "\n"; + cout << "Enter a date: \n"; + + String datestring; + + cin >> datestring; + d2 = date(datestring); + + cout << datestring << " parses into (DD-MM-YYYY): " << d2 << "\n"; + datestring = d2.format(); + cout << "Formatted date: " << datestring << "\n"; + + d1 = today(); + + cout << "Size of a date is " << sizeof(d1) << "\n"; + + cout << "365 days after " << d2 << " is " << d2 + 365 << "\n"; + date d3(0,0,0); + d3 += 365; + cout << "365 days was converted to " << d3 << "\n"; + cout << "Added to the date you entered: " << d2 + d3 << "\n"; + + cout << d2 << " == " << d1 << " is " << (d2 == d1) << "\n"; + cout << d2 << " != " << d1 << " is " << (d2 != d1) << "\n"; + cout << d2 << " >= " << d1 << " is " << (d2 >= d1) << "\n"; + cout << d2 << " <= " << d1 << " is " << (d2 <= d1) << "\n"; + cout << d2 << " > " << d1 << " is " << (d2 > d1) << "\n"; + cout << d2 << " < " << d1 << " is " << (d2 < d1) << "\n"; + + cout << "difference is " << d2 - d1 << " days.\n\n"; + + cout << "***********************\nTime Test\n*********************\n"; + + hour t1, t2; + + cout << "Default constructor: " << t1 << "\n"; + t1 = hour(10, 50, 30); + cout << "With 10,50,30: " << t1 << "\n"; + cout << "Enter a time: \n"; + + cin >> datestring; + t2 = hour(datestring); + + cout << datestring << " parses into (HH:MM:SS): " << t2 << "\n"; + + cout << "t1 + t2 = " << t1 + t2 << "\n"; + cout << "t1 - t2 = " << t1 - t2 << "\n"; + cout << "t2 - t1 = " << t2 - t1 << "\n"; + + return 0; +} diff --git a/demos/andromeda.xpm b/demos/andromeda.xpm new file mode 100644 index 0000000..e6854bc --- /dev/null +++ b/demos/andromeda.xpm @@ -0,0 +1,54 @@ +/* XPM */ +static char * andromeda_xpm[] = { +"96 48 3 1", +" c None", +". c #FFFFFF", +"+ c #000000", +"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++...................+++++++++++++++++++..++++++++++++++++++++++++++++", +"+++++++++++++++++++++++............................+++++++++++++++++++...+++++++++++++++++++++++", +"++++++++++++++++++++..................................+++++++++++++++++++...++++++++++++++++++++", +"+++++++++++++++++........................................++++++++++++++++++....+++++++++++++++++", +"+++++++++++++++++.........................................++++++++++++++++++...+++++++++++++++++", +"+++++++++++++++.............................................++++++++++++++++++...+++++++++++++++", +"+++++++++++++................................................++++++++++++++++++....+++++++++++++", +"++++++++++++...................................................+++++++++++++++++....++++++++++++", +"+++++++++++....................................................++++++++++++++++++....+++++++++++", +"++++++++++.................++++++++.............................++++++++++++++++++....++++++++++", +"+++++++++.............+++++++++++................................++++++++++++++++++....+++++++++", +"+++++++++.........+++++++++++++...................................+++++++++++++++++....+++++++++", +"++++++++........++++++++++++++....................................++++++++++++++++++....++++++++", +"++++++++.......+++++++++++++++.....................................+++++++++++++++++....++++++++", +"++++++++.....++++++++++++++++......................................+++++++++++++++++....++++++++", +"+++++++.....+++++++++++++++++......................................+++++++++++++++++.....+++++++", +"+++++++....++++++++++++++++++......................................++++++++++++++++++....+++++++", +"+++++++....++++++++++++++++++......................................++++++++++++++++++....+++++++", +"+++++++....++++++++++++++++++......................................++++++++++++++++++....+++++++", +"+++++++.....+++++++++++++++++......................................+++++++++++++++++.....+++++++", +"++++++++....+++++++++++++++++......................................++++++++++++++++.....++++++++", +"++++++++....+++++++++++++++++.....................................+++++++++++++++.......++++++++", +"++++++++....++++++++++++++++++...................................++++++++++++++.........++++++++", +"+++++++++....+++++++++++++++++...................................+++++++++++++.........+++++++++", +"+++++++++....++++++++++++++++++................................+++++++++++.............+++++++++", +"++++++++++....++++++++++++++++++.............................++++++++.................++++++++++", +"+++++++++++....++++++++++++++++++....................................................+++++++++++", +"++++++++++++....++++++++++++++++++..................................................++++++++++++", +"+++++++++++++....++++++++++++++++++................................................+++++++++++++", +"+++++++++++++++...++++++++++++++++++.............................................+++++++++++++++", +"+++++++++++++++++...++++++++++++++++++.........................................+++++++++++++++++", +"+++++++++++++++++++...++++++++++++++++++.....................................+++++++++++++++++++", +"++++++++++++++++++++...+++++++++++++++++++..................................++++++++++++++++++++", +"+++++++++++++++++++++++...+++++++++++++++++++............................+++++++++++++++++++++++", +"++++++++++++++++++++++++++++..+++++++++++++++++++...................++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"}; diff --git a/demos/doodle1.cpp b/demos/doodle1.cpp new file mode 100644 index 0000000..da00c69 --- /dev/null +++ b/demos/doodle1.cpp @@ -0,0 +1,50 @@ +/************************************************************************** +** (c) Copyright 2002, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : doodle1.cpp +** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : Doodle is an exmaple application to demonstrate +** the functions in AXE as a tutorial. +** The first phase shows the absolute minimum to +** make an AXE application. All it does is create a +** main window. You have 'ctrl-C' to quit. +** +** EXPORTED OBJECTS : +** LOCAL OBJECTS : +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Feb 27, 2002 +**************************************************************************/ + +/***************************** + $Log: doodle1.cpp,v $ + Revision 1.1 2002-07-25 08:01:18 arjen + First checkin, AXE release 0.2 + +*****************************/ + +static const char *RCSID = "$Id: doodle1.cpp,v 1.1 2002-07-25 08:01:18 arjen Exp $"; + +#include + +class doodle: public xapplication +{ + managed_window *main_frame; + + virtual void SetupResources(void); +}; + +doodle DoodleApp; + +void doodle::SetupResources() +{ + main_frame = new managed_window("Doodling with AXE"); + main_frame->Map(); +} diff --git a/demos/doodle2.cpp b/demos/doodle2.cpp new file mode 100644 index 0000000..14460e7 --- /dev/null +++ b/demos/doodle2.cpp @@ -0,0 +1,75 @@ +/************************************************************************** +** (c) Copyright 2002, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : doodle2.cpp +** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : Doodle is an exmaple application to demonstrate +** the functions in AXE as a tutorial. +** The second phase shows how to draw graphics in a +** window and the event handling mechanism. +** +** EXPORTED OBJECTS : +** LOCAL OBJECTS : +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Mar 01, 2002 +**************************************************************************/ + +/***************************** + $Log: doodle2.cpp,v $ + Revision 1.1 2002-07-25 08:01:18 arjen + First checkin, AXE release 0.2 + +*****************************/ + +static const char *RCSID = "$Id: doodle2.cpp,v 1.1 2002-07-25 08:01:18 arjen Exp $"; + +#include + +class doodle_view : public window +{ +public: + + doodle_view(window *parent) : window (*parent, 10, 30, 300, 220) + { + SelectInput(ExposureMask, 1); + Background(color("lightyellow")); + } + + virtual int EV_Expose(XExposeEvent); +}; + +class doodle: public xapplication +{ + managed_window *main_frame; + doodle_view *draw_frame; + + virtual void SetupResources(void); +}; + +doodle DoodleApp; + +void doodle::SetupResources() +{ + main_frame = new managed_window("Doodling with AXE"); + main_frame->Map(); + + draw_frame = new doodle_view(main_frame); + draw_frame->Map(); +} + +int doodle_view::EV_Expose(XExposeEvent ev) +{ + gc graphic("black"); + + DrawRectangle(graphic, 50, 70, 200, 100); + + return 1; +} diff --git a/demos/doodle3.cpp b/demos/doodle3.cpp new file mode 100644 index 0000000..8c176b1 --- /dev/null +++ b/demos/doodle3.cpp @@ -0,0 +1,93 @@ +/************************************************************************** +** (c) Copyright 2002, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : doodle2.cpp +** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : Doodle is an exmaple application to demonstrate +** the functions in AXE as a tutorial. +** The second phase shows how to draw graphics in a +** window and the event handling mechanism. +** +** EXPORTED OBJECTS : +** LOCAL OBJECTS : +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Mar 01, 2002 +**************************************************************************/ + +/***************************** + $Log: doodle3.cpp,v $ + Revision 1.1 2002-07-25 08:01:18 arjen + First checkin, AXE release 0.2 + +*****************************/ + +static const char *RCSID = "$Id: doodle3.cpp,v 1.1 2002-07-25 08:01:18 arjen Exp $"; + +#include + +class doodle_view : public window +{ +public: + + doodle_view(window *parent) : window (*parent, 10, 30, 300, 220) + { + SelectInput(ExposureMask, 1); + SelectInput(KeyPressMask, 1); + Background(color("lightyellow")); + } + + virtual int EV_Expose(XExposeEvent); + virtual int EV_KeyPress(XKeyEvent ev); +}; + +class doodle: public xapplication +{ + managed_window *main_frame; + doodle_view *draw_frame; + + virtual void SetupResources(void); +}; + +doodle DoodleApp; + +void doodle::SetupResources() +{ + main_frame = new managed_window("Doodling with AXE"); + main_frame->Map(); + + draw_frame = new doodle_view(main_frame); + draw_frame->Map(); +} + +int doodle_view::EV_Expose(XExposeEvent ev) +{ + gc graphic("black"); + + DrawRectangle(graphic, 50, 70, 200, 100); + + return 1; +} + +int doodle_view::EV_KeyPress(XKeyEvent ev) +{ + KeySym key; + + key = XLookupKeysym(&ev, ev.state & 1); + + if (key == 'q') + { + return 0; + } + else + { + return 1; + } +} diff --git a/demos/testaxe.cpp b/demos/testaxe.cpp new file mode 100644 index 0000000..4c8fc11 --- /dev/null +++ b/demos/testaxe.cpp @@ -0,0 +1,254 @@ + +#include "menu.h" +#include "filedialog.h" +#include "icon.h" +#include "configuration.h" + +#include + +#define CMD_QUIT 1 +#define CMD_OPEN 2 +#define CMD_SAVE 3 + +#define CMD_ABOUT 9 +#define FILE_OPEN 10 + +class testaxeconf: public configuration +{ +}; + +popup_menu *edit_menu; + +struct cmd_map_entry +{ + int code; + int (*handler)(void); +}; + +class aboutbox : public managed_window +{ + icon *logo; + command_button *ok; + +public: + + aboutbox() : managed_window("About AXE") + { + Background(Black); + logo = new icon(*this, 10, 40, "andromeda.xpm"); + ok = new command_button(*this, 300, 50, "OK", 0); + Resize(400, 128); + SelectInput(ExposureMask, 1); + } + + virtual int EV_Expose(XExposeEvent ev) + { + DrawString(white_gc, 100, 30, "Andromeda X Windows Encapsulation"); + DrawString(white_gc, 120, 90, "Version 0.2 - July 30, 2001"); + return 1; + } + + int DoCommand(int code) + { + Unmap(); + return 1; + } +}; + +class xapp: public xapplication +{ + managed_window *main_frame; + menu_item *save_item; + file_dialog *FileDialog; + aboutbox *About; + + testaxeconf config; + + virtual void SetupResources(void); + + virtual int DoCommand(int code); + +public: + + int OnOpen(void); + + int OnSave(void); + + int OnQuit(void) { printf("OnQuit\n"); return 0; } + +}; + +xapp Application; + + +int xapp::OnOpen(void) +{ + FileDialog->Realize(); + return 1; +} + +int xapp::OnSave(void) +{ + FileDialog->Realize(); + return 1; +} + +/* The pinguin icon as a static array */ + +#include "pinguin.xpm" + +void xapp::SetupResources(void) +{ + window *menu; + frame *fr; + scrollbar *scr; + edit *edt; + menu_item *item; + popup_menu *popup; + + config.read("testaxe"); + + About = new aboutbox; + FileDialog = new file_dialog(FILE_OPEN); + + main_frame = new managed_window; + main_frame->Command_WhenClosed(CMD_QUIT); + main_frame->Background(color(config.find_parameter("colors", "background"))); + + fr = new button(*main_frame, 20, 30, "Up"); + + fr = new toggle_button(*main_frame, 20, 100, "Down"); + + fr = new frame(*main_frame, 180, 30, "Left"); + fr->TextAlign(Left, Middle); + + fr = new frame(*main_frame, 180, 70, "Center"); + fr->TextAlign(Center, Middle); + fr->Strength(0); + + fr = new frame(*main_frame, 180, 110, "Right"); + fr->TextAlign(Right, Middle); + + fr = new frame(*main_frame, 180, 150, "Top"); + fr->TextAlign(Center, Top); + + fr = new frame(*main_frame, 180, 190, "Middle"); + fr->TextAlign(Center, Middle); + fr->Strength(0); + + fr = new frame(*main_frame, 180, 230, "Bottom"); + fr->TextAlign(Center, Bottom); + fr->WindowGravity(SouthEastGravity); + + scr = new scrollbar(*main_frame, 200, 130, 30); + scr->SetSizes(1000, 200); + scr->Realize(); + + edt = new edit(*main_frame, 20, 140, "This is editable text"); + edt = new edit(*main_frame, 20, 170, "And another text field"); + + menu = new menu_bar(*main_frame); + + item = new menu_label(*menu, "Help"); + popup = new popup_menu; + item->Popup(popup); + item = new menu_label(*popup, "About...", CMD_ABOUT); + item->Map(); + + item = new menu_label(*menu, "View"); + + popup = new popup_menu; + item->Popup(popup); + + item = new menu_label(*popup, "Status"); + item->Map(); + + item = new menu_label(*popup, "Tools"); + item->Map(); + + item = new menu_label(*menu, "Edit"); + + popup = new popup_menu; + item->Popup(popup); + edit_menu = popup; + + item = new menu_label(*popup, "Paste"); + item->Map(); + + item = new menu_label(*popup, "Copy"); + item->Map(); + + item = new menu_label(*popup, "Cut"); + item->Map(); + + item = new menu_label(*menu, "File"); + + popup = new popup_menu; + item->Popup(popup); + + item = new menu_label(*popup, "Quit", CMD_QUIT); + item->Map(); + + item = new menu_separator(*popup); + item->Map(); + + save_item = new menu_label(*popup, "Save", CMD_SAVE); + save_item->Map(); + save_item->Enable(0); + + item = new menu_label(*popup, "Open...", CMD_OPEN); + item->Map(); + + item = new menu_label(*popup, "New ->"); + item->Map(); + + popup = new popup_menu; + item->Popup(popup); + + item = new menu_label(*popup, "Type B"); + item->Map(); + + item = new menu_label(*popup, "Type A"); + item->Map(); + + icon *logo; + logo = new icon(*main_frame, 10, 200, pinguin_xpm); + main_frame->Realize(); + menu->Realize(); + + pixmap pinguin(pinguin_xpm); + + main_frame->DrawPixmap(text_normal_gc, 270, 100, pinguin); +} + +int xapp::DoCommand(int code) +{ + printf("Command : %d\n", code); + + switch (code) + { + case CMD_QUIT: + return 0; + + case CMD_OPEN: + OnOpen(); + return 1; + + case FILE_OPEN: + cout << "Opening " << FileDialog->PathName() << "\n"; + save_item->Enable(1); + return 1; + + case CMD_SAVE: + OnSave(); + save_item->Enable(0); + return 1; + + case CMD_ABOUT: + About->Realize(); + return 1; + + default: + return 1; + } +} diff --git a/demos/timesheet.cpp b/demos/timesheet.cpp new file mode 100644 index 0000000..169f340 --- /dev/null +++ b/demos/timesheet.cpp @@ -0,0 +1,119 @@ +#include "date.h" + +class activity +{ + String description; + hour spent_in_month[12]; + +public: + + activity(String desc) + { + description = desc; + } + + int operator!=(String &s); + + void addtime(hour spent, unsigned month); + + void print(void); +}; + +struct act_lst +{ + activity *act; + act_lst *next; + +}; + +main() +{ + + act_lst *timesheet, *a; + act_lst *Total; + + timesheet = new act_lst; + timesheet->act = new activity("TOTAL"); + timesheet->next = 0; + Total = timesheet; + + date d1, d2; + hour t1, t2; + String action1, action2, datestring; + + cin >> datestring; + cin >> action1; + d1 = date(datestring); + t1 = hour(datestring); + + while (cin) + { + cin >> datestring; + d2 = date(datestring); + t2 = hour(datestring); + cin >> action2; + + // process the activity from nr 1 to nr 2. + + if (!action1) + { + // No action: ends the previous action. + } + else + { + // Find the action in the list. If not found add a new activity. + + for (a = timesheet; a && *a->act != action1; a=a->next); + if (!a) + { + a = new act_lst; + a->act = new activity(action1); + a->next = timesheet; + timesheet = a; + } + + if (d2 != d1) + { + cerr << "More than a day at " << datestring << "\n"; + } + a->act->addtime(t2 - t1, d1.Month()); + Total->act->addtime(t2 - t1, d1.Month()); + + } + // shift the log entry one place. + + d1 = d2; + t1 = t2; + action1 = action2; + } + + cout << "Activity\tJan\tFeb\tMar\tApr\tMay\tJun\tJul\tAug\tSep\tOct\tNov\tDec\tTOTAL\n\n"; + + for (a = timesheet; a; a = a->next) + { + a->act->print(); + } +} + +int activity::operator!=(String &s) +{ + return description != s; +} + +void activity::addtime(hour spent, unsigned month) +{ + spent_in_month[month - 1] += spent; +} + +void activity::print(void) +{ + hour total; + + cout << description << "\t"; + for (int i=0; i<12; i++) + { + cout << spent_in_month[i] << "\t"; + total += spent_in_month[i]; + } + cout << total << "\t" << description << "\n"; +} diff --git a/doc/button.html b/doc/button.html new file mode 100644 index 0000000..05ae838 --- /dev/null +++ b/doc/button.html @@ -0,0 +1,43 @@ + + +button - ANDROMEDA X-windows Encapsulation + + + +

class button

+
+

NAME

+

button - Base class for clickable buttons

+

SYNOPSIS

+

class button : public frame

+

DESCRIPTION

+

A button adds input actions to a frame. When a button contains a label, it +will center the label's text in its window. An extra indicator (like a LED) +may also be included in a button. When clicked with the left mouse button, the +button performs some action. At least, it provides visible feedback to the +user. When a mouse button is pressed on a button, its 3D effect is reversed. +When the mouse button is released, the 3D effect returns to its original +state. Further actions depends on the type of button.

+

Variaties of buttons:

+
    +
  • touch button: performs an action, immediately when it is pressed. A +release has no effect. The action of a touch button should not remove the +button from the screen. If it does, the release event will be sent to an other window. +

    A touch button has a virtual function: click(). This function is called on +a ButtonPress event.

    +
  • command button: send a command to the application when clicked. It +perfroms its action when pressed AND released. +
  • toggle button: toggles on or off when clicked. It adds a state and an +indicator to the touch button. The state of the toggle button reverses when +pressed. The indicator shows the current state. +

    A toggle button overrides the touch button's function click() and overrides +the frame's virtual function redraw(). click() reverses the state of the +button. redraw() draws the indicator, which depends on the state.

    +
  • radio button: when pressed, turns itself on and its sibling buttons off. +The indicator shows the state of the radio button. The parent window of a +group of radio buttons can determine the index of the radio button that is 'On'. +
+

SEE ALSO

+

DIAGNOSTICS

+ + diff --git a/doc/class.xsl b/doc/class.xsl new file mode 100644 index 0000000..3fddca9 --- /dev/null +++ b/doc/class.xsl @@ -0,0 +1,63 @@ + + + + + + + + + + Class Specification of <xsl:value-of select='@name'/> + + +

Class Specification of

+
+

NAME

+

-

+ + + + +
+ + + + + +

SYNOPSIS

+ +
+ + +

DESCRIPTION

+ +
+ + +

DESCRIPTION

+ +
+ + + + + + + + + + +
METHODS
+ +
+ + +

-

+ +
+ +
+ + + + diff --git a/doc/class_diagram.html b/doc/class_diagram.html new file mode 100644 index 0000000..b7fba79 --- /dev/null +++ b/doc/class_diagram.html @@ -0,0 +1,22 @@ + + + + +

+ +

+ + + + + + + + + + + + + + + diff --git a/doc/class_diagram.obj b/doc/class_diagram.obj new file mode 100644 index 0000000..96a23b0 --- /dev/null +++ b/doc/class_diagram.obj @@ -0,0 +1,374 @@ +%TGIF 3.0-p12 +state(0,33,100.000,0,448,0,8,1,8,2,2,0,0,0,0,1,1,'Helvetica',0,10,0,0,0,10,0,0,1,1,0,16,0,0,1,1,1,0,1088,1408,0,0,2880). +% +% @(#)$Header: /cvsroot/lib/AXE/doc/class_diagram.obj,v 1.1 2002-07-25 08:01:22 arjen Exp $ +% %W% +% +unit("1 pixel/pixel"). +color_info(9,65535,0,[ + "yellow", 65535, 65535, 0, 65535, 65535, 0, 1, + "red", 65535, 0, 0, 65535, 0, 0, 1, + "green", 0, 65535, 0, 0, 65535, 0, 1, + "blue", 0, 0, 65535, 0, 0, 65535, 1, + "magenta", 65535, 0, 65535, 65535, 0, 65535, 1, + "cyan", 0, 65535, 65535, 0, 65535, 65535, 1, + "white", 65535, 65535, 65535, 65535, 65535, 65535, 1, + "black", 0, 0, 0, 0, 0, 0, 1, + "#FFF", 62414, 62414, 62414, 61440, 61440, 61440, 1 +]). +page(1,"",1). +group([ +text('black',368,138,'Helvetica',0,10,1,1,0,1,42,13,9,0,11,2,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "xw_hash"]), +box('black',320,128,416,160,0,1,1,10,0,0,0,0,0,'1',[ +]) +], +8,0,0,[ +]). +group([ +text('black',560,138,'Helvetica',0,10,1,1,0,1,33,13,15,0,11,2,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "xw_list"]), +box('black',512,128,608,160,0,1,1,16,0,0,0,0,0,'1',[ +]) +], +14,0,0,[ +]). +polygon('black',5,[ + 224,144,240,136,256,144,240,152,224,144],0,1,1,0,20,0,0,0,0,0,'1', + "00",[ +]). +poly('black',2,[ + 256,144,320,144],0,1,1,21,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +polygon('black',5,[ + 416,144,432,136,448,144,432,152,416,144],0,1,1,0,23,0,0,0,0,0,'1', + "00",[ +]). +oval('black',496,136,512,152,1,1,1,24,0,0,0,0,0,'1',[ +]). +poly('black',2,[ + 448,144,504,144],0,1,1,26,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +group([ +text('black',752,234,'Helvetica',0,10,1,1,0,1,35,13,37,0,11,2,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "win_list"]), +box('black',704,224,800,256,0,1,1,38,0,0,0,0,0,'1',[ +]) +], +36,0,0,[ +]). +polygon('black',5,[ + 608,240,624,232,640,240,624,248,608,240],0,1,1,0,42,0,0,0,0,0,'1', + "00",[ +]). +poly('black',2,[ + 640,240,704,240],0,1,1,43,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +oval('black',576,208,592,224,1,1,1,44,0,0,0,0,0,'1',[ +]). +poly('black',4,[ + 584,216,584,192,744,192,744,224],0,1,1,45,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +poly('black',2,[ + 536,160,536,224],0,1,1,46,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +polygon('black',4,[ + 560,304,576,320,544,320,560,304],0,1,1,0,47,0,0,0,0,0,'1', + "0",[ +]). +poly('black',2,[ + 560,256,560,304],0,1,1,49,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +text('black',680,224,'Helvetica',0,10,1,1,0,1,36,13,50,0,11,2,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "children"]). +polygon('black',4,[ + 176,408,192,424,160,424,176,408],0,1,1,0,64,0,0,0,0,0,'1', + "0",[ +]). +poly('black',2,[ + 176,384,176,408],0,1,1,65,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +poly('black',3,[ + 176,424,112,424,112,448],0,1,1,66,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +poly('black',3,[ + 176,424,240,424,240,448],0,1,1,67,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +polygon('black',4,[ + 424,408,440,424,408,424,424,408],0,1,1,0,77,0,0,0,0,0,'1', + "0",[ +]). +poly('black',2,[ + 424,384,424,408],0,1,1,78,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +poly('black',3,[ + 424,424,360,424,360,448],0,1,1,79,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +poly('black',3,[ + 424,424,488,424,488,448],0,1,1,80,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +poly('black',3,[ + 560,320,176,320,176,352],0,1,1,81,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +poly('black',3,[ + 560,320,424,320,424,352],0,1,1,82,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +oval('black',224,360,240,376,0,1,1,98,0,0,0,0,0,'1',[ +]). +poly('black',2,[ + 240,368,376,368],0,1,1,101,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +text('black',336,352,'Helvetica',0,10,1,1,0,1,29,13,102,0,11,2,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "popup"]). +group([ +text('black',800,554,'Helvetica',0,10,1,1,0,1,39,13,120,0,11,2,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "scrollbar"]), +box('black',752,544,848,576,0,1,1,121,0,0,0,0,0,'1',[ +]) +], +119,0,0,[ +]). +group([ +text('black',664,554,'Helvetica',0,10,1,1,0,1,24,13,123,0,11,2,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "slider"]), +box('black',616,544,712,576,0,1,1,124,0,0,0,0,0,'1',[ +]) +], +122,0,0,[ +]). +poly('black',3,[ + 560,320,624,320,624,448],0,1,1,125,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +poly('black',3,[ + 560,320,824,320,824,352],0,1,1,126,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +polygon('black',4,[ + 624,504,640,520,608,520,624,504],0,1,1,0,140,0,0,0,0,0,'1', + "0",[ +]). +poly('black',2,[ + 624,480,624,504],0,1,1,141,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +poly('black',3,[ + 624,520,520,520,520,544],0,1,1,142,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +poly('black',3,[ + 624,520,664,520,664,544],0,1,1,143,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +poly('black',3,[ + 624,520,800,520,800,544],0,1,1,144,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +group([ +text('black',464,650,'Helvetica',0,10,1,1,0,1,57,13,148,0,11,2,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "touchbutton"]), +box('black',416,640,512,672,0,1,1,149,0,0,0,0,0,'1',[ +]) +], +147,0,0,[ +]). +group([ +text('black',464,730,'Helvetica',0,10,1,1,0,1,60,13,151,0,11,2,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "togglebutton"]), +box('black',416,720,512,752,0,1,1,152,0,0,0,0,0,'1',[ +]) +], +150,0,0,[ +]). +group([ +text('black',464,810,'Helvetica',0,10,1,1,0,1,54,13,154,0,11,2,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "radiobutton"]), +box('black',416,800,512,832,0,1,1,155,0,0,0,0,0,'1',[ +]) +], +153,0,0,[ +]). +group([ +text('black',600,650,'Helvetica',0,10,1,1,0,1,75,13,157,0,11,2,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "commandbutton"]), +box('black',552,640,648,672,0,1,1,158,0,0,0,0,0,'1',[ +]) +], +156,0,0,[ +]). +polygon('black',4,[ + 520,600,536,616,504,616,520,600],0,1,1,0,159,0,0,0,0,0,'1', + "0",[ +]). +poly('black',2,[ + 520,576,520,600],0,1,1,172,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +poly('black',3,[ + 520,616,464,616,464,640],0,1,1,173,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +poly('black',3,[ + 520,616,600,616,600,640],0,1,1,174,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +polygon('black',4,[ + 464,688,480,704,448,704,464,688],0,1,1,0,175,0,0,0,0,0,'1', + "0",[ +]). +polygon('black',4,[ + 464,768,480,784,448,784,464,768],0,1,1,0,176,0,0,0,0,0,'1', + "0",[ +]). +poly('black',2,[ + 464,672,464,688],0,1,1,177,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +poly('black',2,[ + 464,704,464,720],0,1,1,178,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +poly('black',2,[ + 464,752,464,768],0,1,1,179,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +poly('black',2,[ + 464,784,464,800],0,1,1,180,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +group([ +text('black',176,138,'Helvetica',0,10,1,1,0,1,55,13,0,0,11,2,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "xapplication"]), +box('black',128,128,224,160,0,1,1,4,0,0,0,0,0,'1',[ +]) +], +7,0,0,[ +attr("href=", "xapplication.html", 0, 1, 0, +text('black',176,160,'Helvetica',0,10,1,1,0,1,102,13,181,0,11,2,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "href=xapplication.html"])) +]). +group([ +text('black',560,234,'Helvetica',0,10,1,1,0,1,36,13,31,0,11,2,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "window"]), +box('black',512,224,608,256,0,1,1,32,0,0,0,0,0,'1',[ +]) +], +30,0,0,[ +attr("href=", "window.html", 0, 1, 0, +text('black',560,256,'Helvetica',0,10,1,1,0,1,83,13,183,0,11,2,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "href=window.html"])) +]). +group([ +text('black',824,362,'Helvetica',0,10,1,1,0,1,17,13,108,0,11,2,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "edit"]), +box('black',776,352,872,384,0,1,1,109,0,0,0,0,0,'1',[ +]) +], +107,0,0,[ +attr("href=", "edit.html", 0, 1, 0, +text('black',816,384,'Helvetica',0,10,1,1,0,1,64,13,201,0,11,2,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "href=edit.html"])) +]). +group([ +text('black',424,362,'Helvetica',0,10,1,1,0,1,49,13,69,0,11,2,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "menu_item"]), +box('black',376,352,472,384,0,1,1,70,0,0,0,0,0,'1',[ +]) +], +68,0,0,[ +attr("href=", "menu_item.html", 0, 1, 0, +text('black',440,384,'Helvetica',0,10,1,1,0,1,96,13,187,0,11,2,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "href=menu_item.html"])) +]). +group([ +text('black',176,362,'Helvetica',0,10,1,1,0,1,73,13,53,0,11,2,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "menu_container"]), +box('black',128,352,224,384,0,1,1,54,0,0,0,0,0,'1',[ +]) +], +52,0,0,[ +attr("href=", "menu_container.html", 0, 1, 0, +text('black',176,384,'Helvetica',0,10,1,1,0,1,120,13,185,0,11,2,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "href=menu_container.html"])) +]). +group([ +text('black',240,458,'Helvetica',0,10,1,1,0,1,59,13,62,0,11,2,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "popup_menu"]), +box('black',192,448,288,480,0,1,1,63,0,0,0,0,0,'1',[ +]) +], +61,0,0,[ +attr("href=", "popup_menu.html", 0, 1, 0, +text('black',240,480,'Helvetica',0,10,1,1,0,1,106,13,195,0,11,2,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "href=popup_menu.html"])) +]). +group([ +text('black',112,458,'Helvetica',0,10,1,1,0,1,45,13,59,0,11,2,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "menu_bar"]), +box('black',64,448,160,480,0,1,1,60,0,0,0,0,0,'1',[ +]) +], +58,0,0,[ +attr("href=", "menu_bar.html", 0, 1, 0, +text('black',112,480,'Helvetica',0,10,1,1,0,1,92,13,193,0,11,2,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "href=menu_bar.html"])) +]). +group([ +text('black',360,458,'Helvetica',0,10,1,1,0,1,50,13,72,0,11,2,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "menu_label"]), +box('black',312,448,408,480,0,1,1,73,0,0,0,0,0,'1',[ +]) +], +71,0,0,[ +attr("href=", "menu_label.html", 0, 1, 0, +text('black',360,480,'Helvetica',0,10,1,1,0,1,97,13,189,0,11,2,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "href=menu_label.html"])) +]). +group([ +text('black',488,458,'Helvetica',0,10,1,1,0,1,74,13,75,0,11,2,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "menu_separator"]), +box('black',440,448,536,480,0,1,1,76,0,0,0,0,0,'1',[ +]) +], +74,0,0,[ +attr("href=", "menu_separator.html", 0, 1, 0, +text('black',488,480,'Helvetica',0,10,1,1,0,1,121,13,191,0,11,2,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "href=menu_separator.html"])) +]). +group([ +text('black',624,458,'Helvetica',0,10,1,1,0,1,26,13,105,0,11,2,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "frame"]), +box('black',576,448,672,480,0,1,1,106,0,0,0,0,0,'1',[ +]) +], +104,0,0,[ +attr("href=", "frame.html", 0, 1, 0, +text('black',624,480,'Helvetica',0,10,1,1,0,1,73,13,197,0,11,2,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "href=frame.html"])) +]). +group([ +text('black',520,554,'Helvetica',0,10,1,1,0,1,31,13,117,0,11,2,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "button"]), +box('black',472,544,568,576,0,1,1,118,0,0,0,0,0,'1',[ +]) +], +116,0,0,[ +attr("href=", "button.html", 0, 1, 0, +text('black',520,576,'Helvetica',0,10,1,1,0,1,78,13,199,0,11,2,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "href=button.html"])) +]). diff --git a/doc/color.html b/doc/color.html new file mode 100644 index 0000000..a328cfc --- /dev/null +++ b/doc/color.html @@ -0,0 +1,40 @@ + + +color - ANDROMEDA X-windows Encapsulation + + + +

class color

+
+ +

NAME

+color - Color allocation in X +

SYNOPSIS

+#include "color.h" +

+class color + +

DESCRIPTION

+ + + + + + + + + + + + + +
Operators
operator unsigned long + Convert color to a pixel value + +
Member functions
colorcolor contructors and destructors
AllocAllocate a new color
+ +

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/color.xml b/doc/color.xml new file mode 100644 index 0000000..1b73cd5 --- /dev/null +++ b/doc/color.xml @@ -0,0 +1,55 @@ + + + + +Color allocation in X + + +#include <AXE/color.h> + +class color + + + + + +The color class encapsulates the Color +resource in X. + + + + + + Convert color to a pixel value + + + + color contructors and destructors + + + + title:Allocate a new color + + + + + + + + + + + + + + + Allocate a new Color resource in the X server. + + + + + +

SEE ALSO

+

DIAGNOSTICS

+ +
diff --git a/doc/color_alloc.html b/doc/color_alloc.html new file mode 100644 index 0000000..c9185c7 --- /dev/null +++ b/doc/color_alloc.html @@ -0,0 +1,25 @@ + + +Alloc - ANDROMEDA X-windows Encapsulation + + + +

color::Alloc

+
+ +

NAME

+Alloc - allocate a new color +

SYNOPSIS

+ +#include "color.h" +

+void color::Alloc(unsigned red, unsigned green, unsigned blue) +

+void color::Alloc(char *colorname) + +

DESCRIPTION

+

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/color_color.html b/doc/color_color.html new file mode 100644 index 0000000..d443d2f --- /dev/null +++ b/doc/color_color.html @@ -0,0 +1,27 @@ + + +color - ANDROMEDA X-windows Encapsulation + + + +

color::color

+
+ +

NAME

+color - color constructors and destructors +

SYNOPSIS

+ +#include "color.h" +

+color::color() +

+color::color(unsigned red, unsigned green, unsigned blue) +

+color::color(char * colorname) + +

DESCRIPTION

+

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/color_op_UL.html b/doc/color_op_UL.html new file mode 100644 index 0000000..0d02541 --- /dev/null +++ b/doc/color_op_UL.html @@ -0,0 +1,23 @@ + + +operator unsigned long - ANDROMEDA X-windows Encapsulation + + + +

color::operator unsigned long

+
+ +

NAME

+operator unsigned long - color type conversion +

SYNOPSIS

+ +#include "color.h" +

+color::operator unsigned long() + +

DESCRIPTION

+

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/communication.obj b/doc/communication.obj new file mode 100644 index 0000000..3868c58 --- /dev/null +++ b/doc/communication.obj @@ -0,0 +1,48 @@ +%TGIF 3.0-p12 +state(0,33,100.000,0,0,0,8,1,7,2,2,1,2,1,0,1,1,'Helvetica',0,14,0,0,0,10,0,0,1,1,0,16,0,0,1,1,1,0,1088,1408,0,0,2880). +% +% @(#)$Header: /cvsroot/lib/AXE/doc/communication.obj,v 1.1 2002-07-25 08:01:22 arjen Exp $ +% %W% +% +unit("1 pixel/pixel"). +color_info(8,65535,0,[ + "yellow", 65535, 65535, 0, 65535, 65535, 0, 1, + "red", 65535, 0, 0, 65535, 0, 0, 1, + "green", 0, 65535, 0, 0, 65535, 0, 1, + "blue", 0, 0, 65535, 0, 0, 65535, 1, + "magenta", 65535, 0, 65535, 65535, 0, 65535, 1, + "cyan", 0, 65535, 65535, 0, 65535, 65535, 1, + "white", 65535, 65535, 65535, 65535, 65535, 65535, 1, + "black", 0, 0, 0, 0, 0, 0, 1 +]). +page(1,"",1). +rcbox('black',320,64,448,128,0,2,1,0,16,22,0,0,0,0,'2',[ +]). +rcbox('black',320,192,448,256,0,2,1,0,16,23,0,0,0,0,'2',[ +]). +rcbox('black',320,320,448,384,0,2,1,0,16,24,0,0,0,0,'2',[ +]). +text('black',384,86,'Helvetica',0,14,1,1,0,1,78,17,85,0,14,3,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "Workstation"]). +text('black',384,214,'Helvetica',0,14,1,1,0,1,52,17,89,0,14,3,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "Window"]). +text('black',384,342,'Helvetica',0,14,1,1,0,1,72,17,91,0,14,3,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "Application"]). +poly('black',2,[ + 384,128,384,192],1,2,1,93,0,0,0,0,10,4,0,0,0,'2','10','4', + "0",[ +]). +poly('black',2,[ + 384,256,384,320],1,2,1,94,0,0,0,0,10,4,0,0,0,'2','10','4', + "0",[ +]). +arc('black',0,2,1,0,424,192,464,224,440,250,440,198,0,80,64,-8064,16128,113,0,1,10,4,0,0,0,'2','10','4',[ +]). +text('black',408,144,'Helvetica',0,14,1,1,0,1,36,17,122,0,14,3,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "event"]). +text('black',536,208,'Helvetica',0,14,1,1,0,1,59,17,124,0,14,3,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "message"]). +text('black',424,280,'Helvetica',0,14,1,1,0,1,62,17,126,0,14,3,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "command"]). +text('black',400,424,'Helvetica-Bold',1,14,1,1,0,1,199,17,128,0,14,3,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "Communication mechanisms"]). diff --git a/doc/cursor.html b/doc/cursor.html new file mode 100644 index 0000000..d4f1e27 --- /dev/null +++ b/doc/cursor.html @@ -0,0 +1,37 @@ + + +cursor - ANDROMEDA X-windows Encapsulation + + + +

class cursor

+
+ +

NAME

+cursor - Cursor shapes +

SYNOPSIS

+#include "cursor.h" +

+class cursor + +

DESCRIPTION

+ + + + + + + + + + +
Operators
operator Cursor + Convert to X resource ID. + +
Member functions
cursorcursor contructors and destructors
+ +

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/cursor_cursor.html b/doc/cursor_cursor.html new file mode 100644 index 0000000..4d95695 --- /dev/null +++ b/doc/cursor_cursor.html @@ -0,0 +1,27 @@ + + +cursor - ANDROMEDA X-windows Encapsulation + + + +

cursor::cursor

+
+ +

NAME

+cursor - cursor constructors and destructors +

SYNOPSIS

+ +#include "cursor.h" +

+cursor::cursor() +

+cursor::cursor(unsigned int shape) +

+cursor::~cursor() + +

DESCRIPTION

+

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/cursor_op_Cursor.html b/doc/cursor_op_Cursor.html new file mode 100644 index 0000000..4650689 --- /dev/null +++ b/doc/cursor_op_Cursor.html @@ -0,0 +1,23 @@ + + +operator Cursor - ANDROMEDA X-windows Encapsulation + + + +

cursor::operator Cursor

+
+ +

NAME

+operator Cursor - cursor type conversion +

SYNOPSIS

+ +#include "cursor.h" +

+cursor::operator Cursor() + +

DESCRIPTION

+

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/display.html b/doc/display.html new file mode 100644 index 0000000..b0d42b4 --- /dev/null +++ b/doc/display.html @@ -0,0 +1,59 @@ + + + display - X display connection + + + +

display class

+ +
+

NAME

+ +

display - X display connection

+ +

SYNOPSIS

+ +class display + +

DESCRIPTION

+ +A display object maintains the connection to the X workstation. The +library contains one such object, stddpy which is connected to the default +display. + + + + + + + + + + + + + + + + + + + + + + + +
Operators
operator >> + Read an event from the display connection +
operator Display * + Convert to an X Display pointer + +
Member functions
displaydisplay contructors and destructors
RootDetermine default root window
WhiteDetermine the white pixel value
BlackDetermine the black pixel value
ColMapDetermine default color map
+ + +

SEE ALSO

+ +

DIAGNOSTICS

+ + + diff --git a/doc/display_Black.html b/doc/display_Black.html new file mode 100644 index 0000000..689e543 --- /dev/null +++ b/doc/display_Black.html @@ -0,0 +1,23 @@ + + +Black - ANDROMEDA X-windows Encapsulation + + + +

display::Black

+
+ +

NAME

+Black - Determine the black pixel value +

SYNOPSIS

+#include "display.h" +

+unsigned long display::Black(); + +

DESCRIPTION

+ +

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/display_ColMap.html b/doc/display_ColMap.html new file mode 100644 index 0000000..c67f9f0 --- /dev/null +++ b/doc/display_ColMap.html @@ -0,0 +1,23 @@ + + +ColMap - ANDROMEDA X-windows Encapsulation + + + +

display::ColMap

+
+ +

NAME

+ColMap - Determine the default color map +

SYNOPSIS

+#include "display.h" +

+ColorMap display::ColMap(); + +

DESCRIPTION

+ +

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/display_Root.html b/doc/display_Root.html new file mode 100644 index 0000000..22ff31b --- /dev/null +++ b/doc/display_Root.html @@ -0,0 +1,25 @@ + + +Root - ANDROMEDA X-windows Encapsulation + + + +

display::Root

+
+ +

NAME

+Root - Determine default root window +

SYNOPSIS

+#include "display.h" +

+Window display::Root(); + +

DESCRIPTION

+ +Returns the resource ID of the root window, not a window object. + +

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/display_White.html b/doc/display_White.html new file mode 100644 index 0000000..e9add94 --- /dev/null +++ b/doc/display_White.html @@ -0,0 +1,23 @@ + + +White - ANDROMEDA X-windows Encapsulation + + + +

display::White

+
+ +

NAME

+White - Determine the white pixel value +

SYNOPSIS

+#include "display.h" +

+unsigned long display::White(); + +

DESCRIPTION

+ +

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/display_display.html b/doc/display_display.html new file mode 100644 index 0000000..ea2f80b --- /dev/null +++ b/doc/display_display.html @@ -0,0 +1,27 @@ + + +display - ANDROMEDA X-windows Encapsulation + + + +

display::display

+
+ +

NAME

+display - display constructors and destructor +

SYNOPSIS

+#include "display.h" +

+display::display(); +

+display::display(char *name); +

+display::~display(); + +

DESCRIPTION

+ +

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/display_op_Display.html b/doc/display_op_Display.html new file mode 100644 index 0000000..4261d4a --- /dev/null +++ b/doc/display_op_Display.html @@ -0,0 +1,24 @@ + + +operator Display * - ANDROMEDA X-windows Encapsulation + + + +

display::operator Display *

+
+ +

NAME

+operator Display * - convert to an X Display pointer +

SYNOPSIS

+#include "display.h" +

+display::operator Display *(); + +

DESCRIPTION

+ +

SEE ALSO

+ +

DIAGNOSTICS

+ + + diff --git a/doc/display_op_RSHFT.html b/doc/display_op_RSHFT.html new file mode 100644 index 0000000..0ab9502 --- /dev/null +++ b/doc/display_op_RSHFT.html @@ -0,0 +1,26 @@ + + +operator >> - ANDROMEDA X-windows Encapsulation + + + +

display::operator >>

+
+ +

NAME

+operator >> - read an event form the display +

SYNOPSIS

+#include "display.h" +

+display & display::operator >>(XEvent &event); + +

DESCRIPTION

+ +

SEE ALSO

+ +DispatchEvent + +

DIAGNOSTICS

+ + + diff --git a/doc/edit.html b/doc/edit.html new file mode 100644 index 0000000..e10d853 --- /dev/null +++ b/doc/edit.html @@ -0,0 +1,127 @@ + + +edit - ANDROMEDA X-windows Encapsulation + + + + +

class edit

+
+

NAME

+

edit - Edit a single line of text

+

SYNOPSIS

+

class edit : public window

+

DESCRIPTION

+

An edit object contains a single line of text that can be edited. A +text cursor is drawn in the text to mark the position in which characters +typed from the keyboard will be inserted. The cursor can be moved by using the +left and right cursor keys or by pressing the mouse button in the text. The +window in which the text is displayed does not need to be large enough to +display the whole line of text. If the text exceeds the size of the window, +only a part of the text is visible at a time. The user can scroll the text +horizontally by moving the text cursor with the cursor keys.

+

Handled events

+

Buttonpress sets the focus to the edit window. The X server will +send a FocusIn event as a result of the SetFocus

+

Mouse click deselects any selection but does not change the cut buffer. +

+

Button release is the end of a click or the end of a drag.

+

MotionNotify signifies a drag (only with button 1 pressed).

+

Four events, EnterNotify, LeaveNotify, FocusIn and FocusOut, are tracked to +tell if the edit object has the keyboard focus. (see Keyboard focus below). +

+

Sent messages

+

EDIT_ENTERED - When the Enter key (normal or keypad) is pressed on the edit +window. This is the default action of the overridable function enter() +

+

EDIT_FOCUSLOST - When the (implicit or explicit) focus is lost. This is the +default action of the overridable function focuslost()

+

+

Edit keys

+

Backspace: remove character before cursor position

+

Delete : remove character after cursor position

+

Return or Enter: send a EDIT_ENTERED message to the parent window +through virtual function enter().

+

Cursor left/right : move cursor. If the cursor would be moved outside the +window, the text is moved one quarter of the window's size to compensate. +

+

Keyboard focus

+

Implicit focus by moving the mouse on the edit window. The focus is +lost when the mouse is moved outside the edit window.

+

Explicit focus by clicking the left mouse button. The focus remains until +set to another window.

+

Four events, EnterNotify, LeaveNotify, FocusIn and FocusOut, are tracked to +tell if the edit object has the keyboard focus. These four events drive +the state diagram shown below:

+

+

+

Copy and Paste

+

Copy by dragging the left mouse button. The selected text is stores in the +X cut buffer.

+

Double-click selects the whole text (not implemented yet)

+

Selection is undone by a keypress or left mouse button. If the key is an +edit key, the selected text is deleted first. Keys that would not normally +change the text do not delete the selected text.

+

Paste at the cursor position by clicking the middle mouse button. The +cursor position is not changed.

+

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

Member Functions

+
+

edit

+
+

constructor and destructor

+
+

operator =

+
+

Set the contents of the text. by assigning a string +

+
+

operator string &

+
+

Get the contents of the text into a string

+
+

SelectAll

+
+

Select the entire string for copy or delete

+
+

ClearSelection

+
+

De-select the selected text

+
+

DeleteSelection

+
+

Delete the selected text from the string

+
+

BUGS

+

Start a drag inside selected text to move the selected text (drag & +drop): Not implemented

+

Double click to select all text: Not implemented

+

+

SEE ALSO

+

DIAGNOSTICS

+

Source Code

+

+ + diff --git a/doc/edit_DeleteSelection.html b/doc/edit_DeleteSelection.html new file mode 100644 index 0000000..378ffc7 --- /dev/null +++ b/doc/edit_DeleteSelection.html @@ -0,0 +1,23 @@ + + +gc - ANDROMEDA X-windows Encapsulation + + + + +

edit::DeleteSelection

+
+

NAME

+

DeleteSelection - Delete the selected text from the string

+

SYNOPSIS

+

#include <AXE/edit.h>

+

int edit::DeleteSelection(void);

+

DESCRIPTION

+

Delete the selected text from the edited string.

+

RETURN VALUE

+

The number of characters deleted from the text. Note that this is zero if +nothing was selected.

+

SEE ALSO

+

DIAGNOSTICS

+ + diff --git a/doc/edit_edit.html b/doc/edit_edit.html new file mode 100644 index 0000000..e925a78 --- /dev/null +++ b/doc/edit_edit.html @@ -0,0 +1,23 @@ + + +gc - ANDROMEDA X-windows Encapsulation + + + +

edit::edit

+
+

NAME

+

edit - edit constructor and destructor

+

SYNOPSIS

+

#include <AXE/edit.h>

+

edit::edit(window &par, int x, int y, const +string &txt);

+

DESCRIPTION

+

Create an edit object as child window of par at the position +( x,y) relative to the parent window. Sets the cursor at the beginneing +of the text string and puts the first part of the text at the left of the window. +

+

SEE ALSO

+

DIAGNOSTICS

+ + diff --git a/doc/edit_focus.obj b/doc/edit_focus.obj new file mode 100644 index 0000000..0cd2b2a --- /dev/null +++ b/doc/edit_focus.obj @@ -0,0 +1,67 @@ +%TGIF 3.0-p12 +state(0,33,100.000,0,0,0,16,1,7,2,2,1,1,1,0,1,0,'Helvetica',0,18,0,0,0,10,0,0,1,1,0,16,0,0,1,1,1,0,1088,1408,0,0,2880). +% +% @(#)$Header: /cvsroot/lib/AXE/doc/edit_focus.obj,v 1.1 2002-07-25 08:01:22 arjen Exp $ +% %W% +% +unit("1 pixel/pixel"). +color_info(11,65535,0,[ + "yellow", 65535, 65535, 0, 65535, 65535, 0, 1, + "red", 65535, 0, 0, 65535, 0, 0, 1, + "green", 0, 65535, 0, 0, 65535, 0, 1, + "blue", 0, 0, 65535, 0, 0, 65535, 1, + "magenta", 65535, 0, 65535, 65535, 0, 65535, 1, + "cyan", 0, 65535, 65535, 0, 65535, 65535, 1, + "white", 65535, 65535, 65535, 65535, 65535, 65535, 1, + "black", 0, 0, 0, 0, 0, 0, 1, + "pink", 65535, 49931, 52011, 65535, 49344, 52171, 1, + "CadetBlue", 23925, 40569, 41609, 24415, 40606, 41120, 1, + "DarkSlateGray", 11442, 19764, 19764, 12079, 20303, 20303, 1 +]). +page(1,"",1). +oval('black',384,128,480,224,0,2,1,4,0,0,0,0,0,'2',[ +]). +text('black',432,168,'Helvetica',0,14,1,1,0,1,67,17,5,0,14,3,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "No_Focus"]). +oval('black',576,320,672,416,0,2,1,8,0,0,0,0,0,'2',[ +]). +text('black',624,360,'Helvetica',0,14,1,1,0,1,45,17,9,0,14,3,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "Explicit"]). +oval('black',192,320,288,416,0,2,1,10,0,0,0,0,0,'2',[ +]). +text('black',240,360,'Helvetica',0,14,1,1,0,1,45,17,11,0,14,3,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "Implicit"]). +poly('black',4,[ + 480,176,528,176,624,288,624,320],1,2,1,14,1,0,0,0,10,4,0,0,0,'2','10','4', + "6",[ +]). +poly('black',4,[ + 576,368,528,368,448,272,448,224],1,2,1,15,1,0,0,0,10,4,0,0,0,'2','10','4', + "6",[ +]). +poly('black',4,[ + 272,400,320,448,560,448,592,400],1,2,1,16,1,0,0,0,10,4,0,0,0,'2','10','4', + "6",[ +]). +poly('black',4,[ + 240,320,240,272,336,176,384,176],1,2,1,17,1,0,0,0,10,4,0,0,0,'2','10','4', + "6",[ +]). +poly('black',4,[ + 416,224,416,272,336,368,288,368],1,2,1,18,1,0,0,0,10,4,0,0,0,'2','10','4', + "6",[ +]). +text('black',256,80,'Helvetica-Bold',1,18,1,0,0,1,366,23,31,0,18,5,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "edit object Keyboard focus state diagram"]). +text('black',224,192,'Helvetica',0,14,2,0,0,1,75,34,35,0,14,3,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "LeaveNotify", + "& focus"]). +text('black',320,272,'Helvetica',0,14,2,0,0,1,69,34,37,0,14,3,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "EnterNotify", + "& focus"]). +text('black',432,336,'Helvetica',0,14,1,0,0,1,64,17,39,0,14,3,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "FocusOut"]). +text('black',528,240,'Helvetica',0,14,1,0,0,1,54,17,41,0,14,3,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "FocusIn"]). +text('black',400,448,'Helvetica',0,14,1,0,0,1,54,17,43,0,14,3,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "FocusIn"]). diff --git a/doc/empty.html b/doc/empty.html new file mode 100644 index 0000000..670ec0a --- /dev/null +++ b/doc/empty.html @@ -0,0 +1,19 @@ + + +name - ANDROMEDA X-windows Encapsulation + + + +

name

+
+ +

NAME

+name - summary +

SYNOPSIS

+name(args); +

DESCRIPTION

+

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/font.html b/doc/font.html new file mode 100644 index 0000000..076b47e --- /dev/null +++ b/doc/font.html @@ -0,0 +1,44 @@ + + +font - Andromeda X windows Encapsulation + + + +

class font

+
+

NAME

+font - X font class +

SYNOPSIS

+class font +

DESCRIPTION

+ +A font describes the sizes and shapes of displayable text characters. + + + + + + + + + + + + + + + + + + + + +
Operations
fontfont contructors and destructors
IDObtain X font id number
LoadLoad a font in the workstation
TextWidthCompute the width of a string
ascentCompute the height of the font above the baseline +
descentCompute the height of the font below the baseline +
+ +

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/font_ID.html b/doc/font_ID.html new file mode 100644 index 0000000..d5671b0 --- /dev/null +++ b/doc/font_ID.html @@ -0,0 +1,19 @@ + + +ID - ANDROMEDA X-windows Encapsulation + + + +

font::ID

+
+ +

NAME

+ID - Obtain X font id number +

SYNOPSIS

+XID font::ID(void); +

DESCRIPTION

+

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/font_ascent.html b/doc/font_ascent.html new file mode 100644 index 0000000..4278652 --- /dev/null +++ b/doc/font_ascent.html @@ -0,0 +1,27 @@ + + +ascent - ANDROMEDA X-windows Encapsulation + + + +

font::ascent

+
+ +

NAME

+ascent - Compute the height of a font above the baseline +

SYNOPSIS

+#include "font.h" +

+int font::ascent(void); +

DESCRIPTION

+ +The total height of a font is its ascent and descent added together. + +

SEE ALSO

+ +descent + +

DIAGNOSTICS

+ + + diff --git a/doc/font_descent.html b/doc/font_descent.html new file mode 100644 index 0000000..1987007 --- /dev/null +++ b/doc/font_descent.html @@ -0,0 +1,27 @@ + + +descent - ANDROMEDA X-windows Encapsulation + + + +

font::descent

+
+ +

NAME

+descent - Compute the height of a font below the baseline +

SYNOPSIS

+#include "font.h" +

+int font::descent(void); +

DESCRIPTION

+ +The total height of a font is its ascent and descent added together. + +

SEE ALSO

+ +ascent + +

DIAGNOSTICS

+ + + diff --git a/doc/font_font.html b/doc/font_font.html new file mode 100644 index 0000000..37c0cf5 --- /dev/null +++ b/doc/font_font.html @@ -0,0 +1,32 @@ + + +font - ANDROMEDA X-windows Encapsulation + + + +

font::font

+
+ +

NAME

+font - font constructors and destructor +

SYNOPSIS

+font::font(); +

+font::font(char *name); +

+font::~font(); + +

DESCRIPTION

+ +The default constructor, font::font() creates a font object but +does not load a Font resource in the X workstation. +

+The second constructor, font::font(char *name) creates a font +object and loads the font name in the workstation. +

+The destructor unloads the font from the workstation. +

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/font_load.html b/doc/font_load.html new file mode 100644 index 0000000..5490c57 --- /dev/null +++ b/doc/font_load.html @@ -0,0 +1,19 @@ + + +Load - ANDROMEDA X-windows Encapsulation + + + +

font::Load

+
+ +

NAME

+Load - Load a font in the workstation +

SYNOPSIS

+void font::Load(char *name); +

DESCRIPTION

+

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/font_textwidth.html b/doc/font_textwidth.html new file mode 100644 index 0000000..6059058 --- /dev/null +++ b/doc/font_textwidth.html @@ -0,0 +1,23 @@ + + +TextWidth - ANDROMEDA X-windows Encapsulation + + + +

font::TextWidth

+
+ +

NAME

+TextWidth - Compute width of a string +

SYNOPSIS

+int font::TextWidth(char *string, int length = 0); +

DESCRIPTION

+ +If length is 0 (the default), the length is the number of +characters in the string. + +

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/frame.html b/doc/frame.html new file mode 100644 index 0000000..919ecf8 --- /dev/null +++ b/doc/frame.html @@ -0,0 +1,32 @@ + + +frame - ANDROMEDA X-windows Encapsulation + + + +

class frame

+
+ +

NAME

+frame - Window with border effect and text placement +

SYNOPSIS

+class frame : public window + +

DESCRIPTION

+ +A frame adds border effects and text alignment to a window. +The border effects can create a three-dimensional appearance to the window. +A single line of text is put in the window, aligned in 9 possible ways. +A frame can be used on its own as a holder for other objects or as a +placeholder for static texts. +A frame is also used as the base class for many other objects such as buttons. +The frame only creates a visual effect. +Derived classes add interaction by overriding the window's event handling +functions. + + +

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/gc.html b/doc/gc.html new file mode 100644 index 0000000..541394d --- /dev/null +++ b/doc/gc.html @@ -0,0 +1,35 @@ + + +gc - ANDROMEDA X-windows Encapsulation + + + +

class gc

+
+ +

NAME

+gc - Graphic Context +

SYNOPSIS

+#include "gc.h" +

+class gc + +

DESCRIPTION

+ + + + + + + + + + +
Operators
operator GCConvert to an X GC +
Member functions
gcgc contructors and destructors
+ +

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/gc_gc.html b/doc/gc_gc.html new file mode 100644 index 0000000..7147a42 --- /dev/null +++ b/doc/gc_gc.html @@ -0,0 +1,16 @@ + + +gc - ANDROMEDA X-windows Encapsulation + + + +

gc::gc

+
+

NAME

+

gc - gc constructor and destructor

+

SYNOPSIS

+

DESCRIPTION

+

SEE ALSO

+

DIAGNOSTICS

+ + diff --git a/doc/gc_op_GC.html b/doc/gc_op_GC.html new file mode 100644 index 0000000..b98282c --- /dev/null +++ b/doc/gc_op_GC.html @@ -0,0 +1,23 @@ + + +operator GC - ANDROMEDA X-windows Encapsulation + + + +

gc::operator GC

+
+ +

NAME

+operator GC - gc type conversion +

SYNOPSIS

+#include "gc.h" +

+gc::operator GC(); + +

DESCRIPTION

+ +

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/index.html b/doc/index.html new file mode 100644 index 0000000..731aefa --- /dev/null +++ b/doc/index.html @@ -0,0 +1,135 @@ + + +ANDROMEDA X-Windows Encapsulation + + + +

AXE - Andromeda X-Windows Encapsulation

+

AXE is an application framework which encapsulates much of the +functionality in X-Windows. The classes in AXE encapsulate the usual resources +in X, like windows, graphic contexts, cursors and fonts. Creating objects of +these classes also creates the corresponding resources on the X workstation. +These objects and their X resources are controlled though member functions of +the classes. Other classes add represent user interface concepts, like menu's +dialog panels, button and scrollbars. Using the classes in AXE, it is easy to +create application programs that use a graphical user interface.

+

The core of an AXE-application is a xapplication +-derived object. There is a single object derived from xapplication + in each application program. This object takes takes of initialization, +event dispatching and cleanup. Unlike traditional C programs, a program +written with AXE does not need to have a main() function. AXE has its +own main() which calls the member functions of the application's +xapplication-derived object.

+

Everything visible on the screen and all user interaction is done by +window objects. Windows are used for drawing +graphics and capturing input from the mouse and keyboard. Some windows can +send commands back to the xapplication object, e.g. when a menu item or +a button is clicked.

+

Windows are organized in a tree-structured hierarchy. At the top of the +hierarchy is the root window. The root window is created by the X server and +cover the whole screen. All application's windows are children of the root +window. An application creates one or more top-level windows, which may +themselves contain many children or subwindows. The top-level windows of an +application are direct children of the root window and are usually managed by +the window manager. These top-level windows of the applications are of the +managed_window class. The xapplication-derived object maintains +a hashtable of all windows that are created by the application.

+

A program written with AXE is driven by three communication mechanisms: +

+
    +
  1. Events. +

    Events originate from the X server and are sent to a window as a result of +input from the mouse or keyboard.

    +

    +
  2. Commands. +

    Commands are notifications from certain windows and are sent to either the +top-level window which currently has the focus or to the application itself. +

    +

    +
  3. Messages. +

    Messages are sent from child windows to their parent window.

    +
+

The figure below shows how these three communication mechanisms are related: +

+

+

Menu

+

Constructing menus involves two class hierarchies, both of which are +derived from the window class. The interaction of menus is implemented +in menu_item objects. A menu_item is a selectable +object that can either send a command to the application or show a submenu. +Collections of menu items are contained in a menu_container + objects, like a menu_bar or a popup_menu. Both container +have equivalent auto-sizing behaviour but a menu_bar is a long-stretched +window on the edge of a parent window and a popup_menu is a direct child of +the root window. The similarity lies in the fact that both the menu_bar and +the popup_menu rearrange their child windows (usually menu items) to make them +fit nicely in the container window.

+

Menu Bar

+

A menu_bar is a window that sits at the edge of it parent window and +acts as a container for other windows. It puts all its child windows next to +each other and makes itself fit exactly in its parent window. The size of a +menu_bar is dictated by the parent window on one side and the child windows on +the other side.

+

Menu bars come in two flavors: horizontal and vertical. A horizontal menu +bar has a larger width than height. A vertical menu bar has a large height and +a relatively smaller width. Depending on the flavor of the menu bar it will +span its parent window horizontally or vertically. A horizontal menu bar +matches its width with the parent window; a vertical menu bar changes its +height to fit in its parent window.

+

A menu bar rearranges its child windows so they appear next to eachother. +Child windows are spread left to right in a horizontal menu bar and top to +bottom in a vertical menu bar.

+

In the direction that does not span the parent of the menu bar, all sizes +of the menu bar's children and the menu bar itself are set to the same value. +So the menu bar spans its parent in one direction and the menu bar's children +span the menu bar in the other direction. In that direction the size of the +menu bar and its child windows is determined by the largest child window. +

+

A menu bar may be user-dockable, i.e. click and drag in the background of +the menu_bar can move the menu bar to an other edge of its parent window. +

+

Popup Menu

+

A popup_menu is another container for menu_item objects. It +is an unmanaged child of the root window and is made visible as a result of +the selection of another menu item. A popup_menu rearranges its child +windows similarly to a menu_bar but its size does not depend on a +parent window.

+

Dialog

+

A dialog is a managed_window used for obtaining input from +the user. A dialog contains various user interface objects like buttons, +edits, static texts and scrollbars

+

Button

+

Alphabethical list of classes

+

Below is an alphabethical list of all classes in AXE. The Class +Diagram shows how these classes are related.

+ +

+

The xapplication or display object may contain 'standard' GC's which can be +used by all windows.

+

Graphic output happens in a device context which is a combination of a +drawable and a GC, but can also relate to another output device, like +printers, plotters or meta-files.

+ + diff --git a/doc/makefile b/doc/makefile new file mode 100644 index 0000000..aaf9f5d --- /dev/null +++ b/doc/makefile @@ -0,0 +1,19 @@ + +.SUFFIXES: .obj .eps .png + +.obj.png: + tgif -print -png $< + +.obj.eps: + tgif -print -eps -color $< + +.png.eps: + pngtopnm $< |pnmtops -noturn >$@ + +IMAGES = class_diagram.png communication.png edit_focus.png scroll.png + +all: $(IMAGES) + +clean: + rm -f *.aux *.log *.dvi + rm -f $(IMAGES) diff --git a/doc/menu_bar.html b/doc/menu_bar.html new file mode 100644 index 0000000..63d053e --- /dev/null +++ b/doc/menu_bar.html @@ -0,0 +1,35 @@ + + +menu_bar - ANDROMEDA X-windows Encapsulation + + + +

class menu_bar

+
+ +

NAME

+menu_bar - +

SYNOPSIS

+#include "menu.h" +

+class menu_bar : public menu_container + +

DESCRIPTION

+ + + + + + + + +
Member functions
menu_barmenu_bar contructors and destructors
+ +

SEE ALSO

+ +menu_container + +

DIAGNOSTICS

+ + + diff --git a/doc/menu_cont_HideSubmenus.html b/doc/menu_cont_HideSubmenus.html new file mode 100644 index 0000000..8396c32 --- /dev/null +++ b/doc/menu_cont_HideSubmenus.html @@ -0,0 +1,23 @@ + + +HideSubmenus - ANDROMEDA X-windows Encapsulation + + + +

menu_container::HideSubmenus

+
+ +

NAME

+HideSubmenus - Hide all submenus recursively +

SYNOPSIS

+#include "menu.h" +

+void menu_container::HideSubmenus(void); + +

DESCRIPTION

+ +

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/menu_cont_PositionSubmenu.html b/doc/menu_cont_PositionSubmenu.html new file mode 100644 index 0000000..fc9371c --- /dev/null +++ b/doc/menu_cont_PositionSubmenu.html @@ -0,0 +1,23 @@ + + +PositionSubmenu - ANDROMEDA X-windows Encapsulation + + + +

menu_container::PositionSubmenu

+
+ +

NAME

+PositionSubmenu - menu_container constructors and destructor +

SYNOPSIS

+#include "menu.h" +

+void menu_container::PositionSubmenu(int &x, int &y, unsigned w, unsigned h); + +

DESCRIPTION

+ +

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/menu_cont_RearrangeItems.html b/doc/menu_cont_RearrangeItems.html new file mode 100644 index 0000000..ec2df54 --- /dev/null +++ b/doc/menu_cont_RearrangeItems.html @@ -0,0 +1,24 @@ + + +RearrangeItems - ANDROMEDA X-windows Encapsulation + + + +

menu_container::RearrangeItems

+
+ +

NAME

+RearrangeItems - Place the menu items next to eachother +

SYNOPSIS

+#include "menu.h" +

+void menu_container::RearrangeItems(unsigned &overall_width, + unsigned &overall_height); + +

DESCRIPTION

+ +

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/menu_cont_Show.html b/doc/menu_cont_Show.html new file mode 100644 index 0000000..516d3d9 --- /dev/null +++ b/doc/menu_cont_Show.html @@ -0,0 +1,23 @@ + + +Show - ANDROMEDA X-windows Encapsulation + + + +

menu_container::Show

+
+ +

NAME

+Show - Make the menu container visible. +

SYNOPSIS

+#include "menu.h" +

+void menu_container::Show(menu_item *by, int x, int y); + +

DESCRIPTION

+ +

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/menu_cont_menu_cont.html b/doc/menu_cont_menu_cont.html new file mode 100644 index 0000000..39d7c0e --- /dev/null +++ b/doc/menu_cont_menu_cont.html @@ -0,0 +1,23 @@ + + +menu_container - ANDROMEDA X-windows Encapsulation + + + +

menu_container::menu_container

+
+ +

NAME

+menu_container - menu_container constructors and destructor +

SYNOPSIS

+menu_container::menu_container(); +

+menu_container::menu_container(window &parent); + +

DESCRIPTION

+ +

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/menu_container.html b/doc/menu_container.html new file mode 100644 index 0000000..b68f4b0 --- /dev/null +++ b/doc/menu_container.html @@ -0,0 +1,51 @@ + + +menu_container - ANDROMEDA X-windows Encapsulation + + + +

class menu_container

+
+ +

NAME

+menu_container - Container window for menu items +

SYNOPSIS

+#include "menu.h" +

+class menu_container : public window + +

DESCRIPTION

+ +A menu_container is a window that contains subwindows in the +form of menu_item objects. +It is the job of the menu_container to line-up its menu items. + + + + + + + + + + + + +
Member functions
menu_containermenu_container contructors and destructors
RearrangeItemsPlace the menu items next to eachother +
PositionSubmenu + Calculate the position of a submenu. +
HideSubmenus + Hide all submenus recursively +
Show + Make the menu container visible. +
+ +

SEE ALSO

+ +window , +menu_item + +

DIAGNOSTICS

+ + + diff --git a/doc/menu_item.html b/doc/menu_item.html new file mode 100644 index 0000000..75a8e85 --- /dev/null +++ b/doc/menu_item.html @@ -0,0 +1,84 @@ + + +menu_item - ANDROMEDA X-windows Encapsulation + + + +

class menu_item

+
+ +

NAME

+menu_item - Base class for items in a menu container +

SYNOPSIS

+#include "menu.h" +

+class menu_item : public window + +

DESCRIPTION

+ +A menu_container is a window that contains subwindows in the +form of menu_item objects. +It is the job of the menu_container to line-up its menu items. +The menu items handle all action in the menu system. +A menu_item reacts when it is entered by the pointer by +highlighting itself, usually changing the background color. +When the pointer leaves a menu_item, the highlight +vanishes and the menu_item returns to its original state. + +

+ +A menu_item may relate to an other +menu_container in the form of a popup_menu. +The popup_menu is not a child window of the +menu_item but is an independent window; an unmanaged +direct child of the root window. +The popup menu pops up, i.e. becomes visible when the pointer enters +the menu item. +Once a popup menu is visible, it stays visible until the pointer enters another +menu item in the same menu container or when a mouse button is clicked. +So when a menu item is highlighted, it tells its sibling menu items +to remove their popup menus. +Removing a submenu means the menu items in the submenu must also remove +their submenus recursively. + +

+ +The third action of a menu_item when the pointer enters +its window, is grabbing the pointer. +This prevents windows which are not part of the menu system from reacting +to the mouse buttons. +The menu system remains active until the button is clicked. +After the mouse button is released, all popup menus are removed and the +pointer grab is cancelled. + +

+ +The pointer grab may be released inside a menu item or outside a menu item. +Only when the button click happens inside a menu item that does not +have a popup menu will the menu item send a comamnd back to the application. + + + + + + + + + + + + +
Member functions
menu_itemmenu_item contructors and destructors
HideSubmenuHide the submenus related to this item +
ShowSubmenu + Show the submenu related to this item +
Popup + Relate the item to a submenu +
Enable + Enable or disable a menu item +
+ +

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/menu_item_Enable.html b/doc/menu_item_Enable.html new file mode 100644 index 0000000..55a2bf5 --- /dev/null +++ b/doc/menu_item_Enable.html @@ -0,0 +1,23 @@ + + +Enable - ANDROMEDA X-windows Encapsulation + + + +

menu_item::Enable

+
+ +

NAME

+Enable - Enable or disable a menu item +

SYNOPSIS

+#include "menu.h" +

+void menu_item::Enable(int e); + +

DESCRIPTION

+ +

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/menu_item_HideSubmenu.html b/doc/menu_item_HideSubmenu.html new file mode 100644 index 0000000..67309dd --- /dev/null +++ b/doc/menu_item_HideSubmenu.html @@ -0,0 +1,23 @@ + + +HideSubmenu - ANDROMEDA X-windows Encapsulation + + + +

menu_item::HideSubmenu

+
+ +

NAME

+HideSubmenu - Hide the submenus related to this item +

SYNOPSIS

+#include "menu.h" +

+void menu_item::HideSubmenu(void); + +

DESCRIPTION

+ +

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/menu_item_Popup.html b/doc/menu_item_Popup.html new file mode 100644 index 0000000..59cca01 --- /dev/null +++ b/doc/menu_item_Popup.html @@ -0,0 +1,23 @@ + + +Popup - ANDROMEDA X-windows Encapsulation + + + +

menu_item::Popup

+
+ +

NAME

+Popup - Relate the item to a submenu +

SYNOPSIS

+#include "menu.h" +

+void menu_item::Popup(menu_container *pop); + +

DESCRIPTION

+ +

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/menu_item_ShowSubmenu.html b/doc/menu_item_ShowSubmenu.html new file mode 100644 index 0000000..4775271 --- /dev/null +++ b/doc/menu_item_ShowSubmenu.html @@ -0,0 +1,23 @@ + + +ShowSubmenu - ANDROMEDA X-windows Encapsulation + + + +

menu_item::ShowSubmenu

+
+ +

NAME

+ShowSubmenu - Show the submenu related to this item +

SYNOPSIS

+#include "menu.h" +

+void menu_item::ShowSubmenu(int x, int y); + +

DESCRIPTION

+ +

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/menu_item_menu_item.html b/doc/menu_item_menu_item.html new file mode 100644 index 0000000..c7b0551 --- /dev/null +++ b/doc/menu_item_menu_item.html @@ -0,0 +1,23 @@ + + +menu_item - ANDROMEDA X-windows Encapsulation + + + +

menu_item::menu_item

+
+ +

NAME

+menu_item - menu_item constructors and destructor +

SYNOPSIS

+#include "menu.h" +

+menu_item::menu_item(window &bar, int cc, int en = 1); + +

DESCRIPTION

+ +

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/menu_label.html b/doc/menu_label.html new file mode 100644 index 0000000..6413373 --- /dev/null +++ b/doc/menu_label.html @@ -0,0 +1,35 @@ + + +menu_label - ANDROMEDA X-windows Encapsulation + + + +

class menu_label

+
+ +

NAME

+menu_label - +

SYNOPSIS

+#include "menu.h" +

+class menu_label : public menu_item + +

DESCRIPTION

+ + + + + + + + +
Member functions
menu_labelmenu_label contructors and destructors
+ +

SEE ALSO

+ +menu_item + +

DIAGNOSTICS

+ + + diff --git a/doc/menu_separator.html b/doc/menu_separator.html new file mode 100644 index 0000000..bc34722 --- /dev/null +++ b/doc/menu_separator.html @@ -0,0 +1,35 @@ + + +menu_separator - ANDROMEDA X-windows Encapsulation + + + +

class menu_separator

+
+ +

NAME

+menu_separator - +

SYNOPSIS

+#include "menu.h" +

+class menu_separator : public menu_item + +

DESCRIPTION

+ + + + + + + + +
Member functions
menu_separatormenu_separator contructors and destructors
+ +

SEE ALSO

+ +menu_item + +

DIAGNOSTICS

+ + + diff --git a/doc/modules.obj b/doc/modules.obj new file mode 100644 index 0000000..5deaa1a --- /dev/null +++ b/doc/modules.obj @@ -0,0 +1,188 @@ +%TGIF 3.0-p12 +state(0,33,100.000,64,192,0,8,1,7,1,1,0,0,1,0,1,1,'Helvetica',0,14,0,0,0,10,0,0,1,0,0,16,0,0,1,1,1,0,1088,1408,0,0,2880). +% +% @(#)$Header: /cvsroot/lib/AXE/doc/modules.obj,v 1.1 2002-07-25 08:01:23 arjen Exp $ +% %W% +% +unit("1 pixel/pixel"). +color_info(8,65535,0,[ + "yellow", 65535, 65535, 0, 65535, 65535, 0, 1, + "red", 65535, 0, 0, 65535, 0, 0, 1, + "green", 0, 65535, 0, 0, 65535, 0, 1, + "blue", 0, 0, 65535, 0, 0, 65535, 1, + "magenta", 65535, 0, 65535, 65535, 0, 65535, 1, + "cyan", 0, 65535, 65535, 0, 65535, 65535, 1, + "white", 65535, 65535, 65535, 65535, 65535, 65535, 1, + "black", 0, 0, 0, 0, 0, 0, 1 +]). +page(1,"",1). +group([ +box('black',344,368,472,432,0,2,1,22,0,0,0,0,0,'2',[ +]), +text('black',408,392,'Helvetica',0,14,1,1,0,1,35,17,23,0,14,3,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "frame"]) +], +28,0,0,[ +]). +group([ +box('black',136,496,264,560,0,2,1,30,0,0,0,0,0,'2',[ +]), +text('black',200,520,'Helvetica',0,14,1,1,0,1,34,17,31,0,14,3,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "xappl"]) +], +29,0,0,[ +]). +text('black',152,24,'Helvetica',0,18,1,1,0,1,170,22,40,0,18,4,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "AXE module diagram"]). +group([ +box('black',408,496,536,560,0,2,1,63,0,0,0,0,0,'2',[ +]), +text('black',472,520,'Helvetica',0,14,1,1,0,1,54,17,64,0,14,3,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "xwindow"]) +], +62,0,0,[ +]). +group([ +box('black',80,656,208,720,0,2,1,73,0,0,0,0,0,'2',[ +]), +text('black',144,680,'Helvetica',0,14,1,1,0,1,32,17,74,0,14,3,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "color"]) +], +72,0,0,[ +]). +group([ +box('black',248,656,376,720,0,2,1,76,0,0,0,0,0,'2',[ +]), +text('black',312,680,'Helvetica',0,14,1,1,0,1,42,17,77,0,14,3,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "cursor"]) +], +75,0,0,[ +]). +group([ +box('black',416,656,544,720,0,2,1,79,0,0,0,0,0,'2',[ +]), +text('black',480,680,'Helvetica',0,14,1,1,0,1,23,17,80,0,14,3,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "font"]) +], +78,0,0,[ +]). +group([ +box('black',576,656,704,720,0,2,1,82,0,0,0,0,0,'2',[ +]), +text('black',640,680,'Helvetica',0,14,1,1,0,1,16,17,83,0,14,3,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "gc"]) +], +81,0,0,[ +]). +group([ +box('black',744,656,872,720,0,2,1,85,0,0,0,0,0,'2',[ +]), +text('black',808,680,'Helvetica',0,14,1,1,0,1,45,17,86,0,14,3,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "pattern"]) +], +84,0,0,[ +]). +group([ +box('black',320,776,448,840,0,2,1,88,0,0,0,0,0,'2',[ +]), +text('black',384,800,'Helvetica',0,14,1,1,0,1,45,17,89,0,14,3,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "display"]) +], +87,0,0,[ +]). +poly('black',4,[ + 472,560,472,600,144,600,144,656],1,1,1,110,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +poly('black',4,[ + 472,560,472,600,312,600,312,656],1,1,1,111,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +poly('black',4,[ + 472,560,472,600,480,600,480,656],1,1,1,112,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +poly('black',4,[ + 472,560,472,600,400,600,400,776],1,1,1,116,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +poly('black',4,[ + 472,560,472,600,648,600,648,656],1,1,1,117,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +poly('black',4,[ + 472,560,472,600,808,600,808,656],1,1,1,118,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +poly('black',2,[ + 264,528,408,528],3,1,1,119,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +group([ +box('black',176,368,304,432,0,2,1,123,0,0,0,0,0,'2',[ +]), +text('black',240,392,'Helvetica',0,14,1,1,0,1,35,17,124,0,14,3,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "menu"]) +], +122,0,0,[ +]). +group([ +box('black',536,368,664,432,0,2,1,126,0,0,0,0,0,'2',[ +]), +text('black',600,392,'Helvetica',0,14,1,1,0,1,23,17,127,0,14,3,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "edit"]) +], +125,0,0,[ +]). +poly('black',4,[ + 232,432,232,464,472,464,472,496],1,1,1,128,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +poly('black',4,[ + 600,432,600,464,472,464,472,496],1,1,1,130,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +group([ +box('black',264,224,392,288,0,2,1,138,0,0,0,0,0,'2',[ +]), +text('black',328,248,'Helvetica',0,14,1,1,0,1,40,17,139,0,14,3,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "button"]) +], +137,0,0,[ +]). +group([ +box('black',456,224,584,288,0,2,1,141,0,0,0,0,0,'2',[ +]), +text('black',520,248,'Helvetica',0,14,1,1,0,1,35,17,142,0,14,3,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "scroll"]) +], +140,0,0,[ +]). +poly('black',4,[ + 328,288,328,328,408,328,408,368],1,1,1,143,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +poly('black',4,[ + 520,288,520,328,408,328,408,368],1,1,1,144,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +group([ +box('black',496,776,624,840,0,2,1,154,0,0,0,0,0,'2',[ +]), +text('black',560,800,'Helvetica',0,14,1,1,0,1,59,17,155,0,14,3,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "geometry"]) +], +153,0,0,[ +]). +poly('black',4,[ + 472,560,472,576,560,576,560,776],1,1,1,159,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +poly('black',4,[ + 408,432,408,464,472,464,472,496],1,1,1,172,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +poly('black',2,[ + 200,560,200,600],1,1,1,217,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). diff --git a/doc/point.html b/doc/point.html new file mode 100644 index 0000000..2ca5a00 --- /dev/null +++ b/doc/point.html @@ -0,0 +1,32 @@ + + +point - ANDROMEDA X-windows Encapsulation + + + +

class point

+
+ +

NAME

+point - A position in two-dimensional space + +

SYNOPSIS

+#include "geometry.h" +

+class point + +

DESCRIPTION

+ + + +
Member Functions + +
point + Construct a point object +
+ +

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/popup_menu.html b/doc/popup_menu.html new file mode 100644 index 0000000..bc36492 --- /dev/null +++ b/doc/popup_menu.html @@ -0,0 +1,35 @@ + + +popup_menu - ANDROMEDA X-windows Encapsulation + + + +

class popup_menu

+
+ +

NAME

+popup_menu - +

SYNOPSIS

+#include "menu.h" +

+class popup_menu : public menu_container + +

DESCRIPTION

+ + + + + + + + +
Member functions
popup_menupopup_menu contructors and destructors
+ +

SEE ALSO

+ +menu_container + +

DIAGNOSTICS

+ + + diff --git a/doc/rectangle.html b/doc/rectangle.html new file mode 100644 index 0000000..80090c1 --- /dev/null +++ b/doc/rectangle.html @@ -0,0 +1,32 @@ + + +rectangle - ANDROMEDA X-windows Encapsulation + + + +

class rectangle

+
+ +

NAME

+rectangle - A rectangular area + +

SYNOPSIS

+#include "geometry.h" +

+class rectangle + +

DESCRIPTION

+ + + +
Member Functions + +
rectangle + Construct a rectangle object +
+ +

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/scroll.obj b/doc/scroll.obj new file mode 100644 index 0000000..9bc94e9 --- /dev/null +++ b/doc/scroll.obj @@ -0,0 +1,270 @@ +%TGIF 3.0-p12 +state(0,33,100.000,0,0,0,8,0,7,1,1,0,0,3,0,1,1,'Helvetica',0,14,0,0,0,10,0,0,1,1,0,16,0,0,1,1,1,0,1088,1408,0,0,2880). +% +% @(#)$Header: /cvsroot/lib/AXE/doc/scroll.obj,v 1.1 2002-07-25 08:01:23 arjen Exp $ +% %W% +% +unit("1 pixel/pixel"). +color_info(12,65535,0,[ + "yellow", 65535, 65535, 0, 65535, 65535, 0, 1, + "red", 65535, 0, 0, 65535, 0, 0, 1, + "green", 0, 65535, 0, 0, 65535, 0, 1, + "blue", 0, 0, 65535, 0, 0, 65535, 1, + "magenta", 65535, 0, 65535, 65535, 0, 65535, 1, + "cyan", 0, 65535, 65535, 0, 65535, 65535, 1, + "white", 65535, 65535, 65535, 65535, 65535, 65535, 1, + "black", 0, 0, 0, 0, 0, 0, 1, + "#EEF2FF", 61374, 62414, 65535, 60928, 61952, 65280, 1, + "#718191", 29126, 33287, 37448, 28928, 33024, 37120, 1, + "#B2C2D2", 45770, 49931, 54092, 45568, 49664, 53760, 1, + "#FFFFFF", 65535, 65535, 65535, 65280, 65280, 65280, 1 +]). +page(1,"",1). +xpm('yellow',128,160,160,358,0,5,1,0,22,0,32,206,0,0,0,0,1,0,[ + 128,160,128,160,160,366,1000,0,0,961,0,0],[ + "`", "#000000", 0, 0, 0, + "a", "#EEF2FF", 9365, 9523, 10000, + "b", "#718191", 4444, 5079, 5714, + "c", "#B2C2D2", 6984, 7618, 8253, + "d", "#FFFFFF", 10000, 10000, 10000],[ + "dddddddddddddddddddddddddddddddd", + "dddddddddddddddddddddddddddddddd", + "dddddd``````````````````dddddddd", + "dddddd`bbbbbbbbbbbbbbbb`dddddddd", + "dddddd`bbbbbbbbbbbbbbba`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd``````````````````dddddddd", + "dddddd``aaaaaaaaaaaaaa``dddddddd", + "dddddd``aaaaaaaaaaaaab``dddddddd", + "dddddd``aacccccccccccb``dddddddd", + "dddddd``aacccccccccccb``dddddddd", + "dddddd``aacccccccccccb``dddddddd", + "dddddd``aacccccccccccb``dddddddd", + "dddddd``aacccccccccccb``dddddddd", + "dddddd``aacccccccccccb``dddddddd", + "dddddd``aacccccccccccb``dddddddd", + "dddddd``aacccccccccccb``dddddddd", + "dddddd``aacccccccccccb``dddddddd", + "dddddd``aacccccccccccb``dddddddd", + "dddddd``aacccccccccccb``dddddddd", + "dddddd``aacccccccccccb``dddddddd", + "dddddd``aacccccccccccb``dddddddd", + "dddddd``aacccccccccccb``dddddddd", + "dddddd``aacccccccccccb``dddddddd", + "dddddd``aacccccccccccb``dddddddd", + "dddddd``aacccccccccccb``dddddddd", + "dddddd``aacccccccccccb``dddddddd", + "dddddd``aacccccccccccb``dddddddd", + "dddddd``aacccccccccccb``dddddddd", + "dddddd``aacccccccccccb``dddddddd", + "dddddd``aacccccccccccb``dddddddd", + "dddddd``aacccccccccccb``dddddddd", + "dddddd``aacccccccccccb``dddddddd", + "dddddd``aacccccccccccb``dddddddd", + "dddddd``aacccccccccccb``dddddddd", + "dddddd``aacccccccccccb``dddddddd", + "dddddd``aacccccccccccb``dddddddd", + "dddddd``aacccccccccccb``dddddddd", + "dddddd``aacccccccccccb``dddddddd", + "dddddd``aacccccccccccb``dddddddd", + "dddddd``aacccccccccccb``dddddddd", + "dddddd``aacccccccccccb``dddddddd", + "dddddd``aacccccccccccb``dddddddd", + "dddddd``aacccccccccccb``dddddddd", + "dddddd``aacccccccccccb``dddddddd", + "dddddd``aacccccccccccb``dddddddd", + "dddddd``abbbbbbbbbbbbb``dddddddd", + "dddddd``````````````````dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`bbccccccccccccca`dddddddd", + "dddddd`baaaaaaaaaaaaaaa`dddddddd", + "dddddd``````````````````dddddddd", + "dddddddddddddddddddddddddddddddd", + "dddddddddddddddddddddddddddddddd"],[ +]). +poly('black',2,[ + 288,162,288,355],3,1,1,25,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +poly('black',2,[ + 152,356,320,356],0,1,1,32,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +poly('black',2,[ + 152,162,320,162],0,1,1,35,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +poly('black',2,[ + 152,246,224,246],0,1,1,40,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +poly('black',2,[ + 152,285,224,285],0,1,1,41,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +poly('black',2,[ + 192,162,192,245],3,1,1,46,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +poly('black',2,[ + 192,246,192,284],3,1,1,47,0,0,0,0,8,3,0,0,0,'1','8','3', + "0",[ +]). +text('black',232,184,'Helvetica',0,14,1,1,0,1,50,17,48,0,14,3,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "position"]). +text('black',328,240,'Helvetica',0,14,1,1,0,1,55,17,50,0,14,3,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "bar_size"]). +text('black',237,255,'Helvetica',0,14,1,1,0,1,69,17,52,0,14,3,0,0,0,0,0,2,0,0,0,0,"",0,0,0,[ + "slider_size"]). diff --git a/doc/scrollbar.html b/doc/scrollbar.html new file mode 100644 index 0000000..d46a19c --- /dev/null +++ b/doc/scrollbar.html @@ -0,0 +1,85 @@ + + +scrollbar - ANDROMEDA X-windows Encapsulation + + + +

class scrollbar

+
+ +

NAME

+scrollbar - Scrollbar + +

SYNOPSIS

+#include "scroll.h" +

+class scrollbar : public frame + +

DESCRIPTION

+ +A scrollbar is a construction of two windows. +The scrollbar itself and the slider that moves within the scrollbar. +The slider can be moved within the scrollbar by dragging the slider +with the mouse, or by clicking in the scrollbar on either side of +the slider. +Whenever the slider is moved, the scrollbar sends a +SCROLL_POSITIONED message to its parent window. + +

+ +Usually, a scrollbar is used together with a window which visualizes +data that is too large for that window. +The scrollbar enables the user to scroll the data through the window. +The slider within the scrollbar represents the portion of the data +which is visible in that window. +The figure below shows how the dimensions of the scrollbar are defined: +

+ +

+ +Two sizes are involved in positioning the slider in the scrollbar: + +

    +
  1. +The bar_size, the total size of the scrollbar itself. +This represents the total size of the data that is visualized. + +
  2. +The slider_size, the size of the slider. +This represents the size of the portion of the data which is visible +inside the window. +
+ +The position of the slider inside the scrollbar represents the top or the +left edge of the visible part of the data, relative to the total size +of the data. +The position of the slider is limited by the sizes of both the scrollbar +and the slider. +The position of the slider is limited to the range [0, bar_size - slider_size]. + +

+ +The sizes of the scrollbar and the slider, as well as the position of the +slider are defined in logical coordinates, rather than the actual +number of pixels of the scrollbar itself. +The logical coordinates correspond to the data that is actually being viewed. +This may be a number of pixels, but may also be the number of items +in a list or the number of lines in a text document. +The scrollbar object maps these logical coordinates to physical coordinates +on the workstation's screen. +Since the bar_size represents the total size of the data being viewed, +this size dictates the ratio for the other sizes. + + + +
Member Functions + +
scrollbar + Construct a scrollbar object +
+ +

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/size.html b/doc/size.html new file mode 100644 index 0000000..13a4363 --- /dev/null +++ b/doc/size.html @@ -0,0 +1,32 @@ + + +size - ANDROMEDA X-windows Encapsulation + + + +

class size

+
+ +

NAME

+size - A two-dimensional size: width and height + +

SYNOPSIS

+#include "geometry.h" +

+class size + +

DESCRIPTION

+ + + +
Member Functions + +
size + Construct a size object +
+ +

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/stipple.html b/doc/stipple.html new file mode 100644 index 0000000..cc7dcf0 --- /dev/null +++ b/doc/stipple.html @@ -0,0 +1,40 @@ + + +stipple - ANDROMEDA X-windows Encapsulation + + + +

class stipple

+
+ +

NAME

+stipple - +

SYNOPSIS

+#include "pattern.h" +

+class stipple + +

DESCRIPTION

+ + + + + + + + + + + + +
Operators
operator PixmapConvert to an X Pixmap resource + +
Member functions
stipplestipple contructors and destructors
+ +

SEE ALSO

+ + +

DIAGNOSTICS

+ + + diff --git a/doc/stipple_op_Pixmap.html b/doc/stipple_op_Pixmap.html new file mode 100644 index 0000000..b3cb57c --- /dev/null +++ b/doc/stipple_op_Pixmap.html @@ -0,0 +1,21 @@ + + +operator Pixmap - ANDROMEDA X-windows Encapsulation + + + +

stipple::operator Pixmap

+
+ +

NAME

+operator Pixmap - stipple type converion +

SYNOPSIS

+stipple::operator Pixmap(); + +

DESCRIPTION

+ +

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/stipple_stipple.html b/doc/stipple_stipple.html new file mode 100644 index 0000000..c6d510f --- /dev/null +++ b/doc/stipple_stipple.html @@ -0,0 +1,25 @@ + + +stipple - ANDROMEDA X-windows Encapsulation + + + +

stipple::stipple

+
+ +

NAME

+stipple - stipple constructors and destructor +

SYNOPSIS

+stipple::stipple(); +

+stipple::stipple(char *data, unsigned int w, unsigned int h); +

+stipple::~stipple(); + +

DESCRIPTION

+ +

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/tutor2.1.png b/doc/tutor2.1.png new file mode 100644 index 0000000..f181591 Binary files /dev/null and b/doc/tutor2.1.png differ diff --git a/doc/tutor2.2.png b/doc/tutor2.2.png new file mode 100644 index 0000000..d2edc9e Binary files /dev/null and b/doc/tutor2.2.png differ diff --git a/doc/tutorial.xml b/doc/tutorial.xml new file mode 100644 index 0000000..752beee --- /dev/null +++ b/doc/tutorial.xml @@ -0,0 +1,515 @@ + + + + + + + +AXE Tutorial + + + + +Introduction + +The Andromeda X-Windows Encapsulation (AXE) is a C++ class +library which encapsulates the X Windows library (Xlib). +Classical programming with Xlib is rather cumbersome to say the least. +The Xlib calls are rather complicated and often require many parameters +that can more easily be stored in objects. +Also, the classical event loop present in most X applications is something +you don't want to reinvent every time. +That sort of thing is better left to a framework which provides you +with more easy way to deal with events from the X server. + + + +The intention of AXE is to make programming for X a lot +easier. +It was first developed to teach programming in C++ to students and let +them do some graphics without being confronted by the X library. +Over the past years it has grown into a framwork that not only encapsulates +the resources in the X server, like windows, colors and graphic context, +but provides some mechanisms that handle low-level communication with +the X server, user interface classes, multithreading and utility classes. +Although functionality of AXE overlaps with some other +user interface libraries such as gtk+ or Qt, +the first goal of AXE is not to be a user interface +library. +Some of the design goals in AXE are not met yet, but +they include features such as dynamically loading of the user interface, +a strong set of graphical object functions, image processing, high-level +graphics objects and lots more. + + + +To get you started with AXE, this tutorial takes you through +a sample application in which some the features of AXE +are touched upon. +The sample application is a doodle program, where the user can freely +draw pictures with the mouse. +The pictures are stored as simple polylines with a few attributes. +Writing the doodle program will show you how to build an AXE +application and create the most basic functions for an application. +In this tutorial, I assume you have sucessfully downloaded and installed +AXE. + + + + + +A minimal AXE application + + +In this chapter we'll start writing the very minimum to get an AXE +application going. +All we do is make a top-level window, draw something in that window +and add a button to quit the application. + + +
+The start: class xapplication + + +Assuming you installed AXE, you can start creating the +doodle program. +The first thing you need in each and every AXE application +is to create an application class, derived from the class +xapplication and declare a static object of that class. +In the example below, our application class is called doodle +and the static object is DoodleApp: + + + +#include <AXE/xappl.h> + +class doodle: public xapplication +{ +}; + +doodle DoodleApp; + + + +Note that you need to include the header file AXE/xappl.h +which contains the definition of the xapplication class. +Also note that, other than in classical C or C++ programs, you do not +have a main() function. +This is taken care of by the AXE library. + +Next, compile and link the application: + + +g++ -c doodle1.cpp +g++ -o doodle1 doodle1.o -lAXE -L/usr/X11R6/lib -lX11 -lXpm + + +Start the doodle program and you'll see that nothing happes. +All this program does is connect to the X server and wait for +events that will never come. +To do someting visible, we have to create a window and map in on +the screen. +The main() function in AXE calls virtual +functions in the static application object, which you can override +in your own application class to get some useful work done. +One of the first functions it calls after makeing the connection with +the X display is SetupResources. +We will now override this function and create a top-level window for +doodle (see demos/doodle1.cpp): + + +#include <AXE/xappl.h> + +class doodle: public xapplication +{ + managed_window *main_frame; + + virtual void SetupResources(void); +}; + +doodle DoodleApp; + +void doodle::SetupResources() +{ + main_frame = new managed_window("Doodling with AXE"); + main_frame->Map(); +} + + +We added two items to our doodle class: + +The managed_window pointer to our top-level window: + main_frame + +The overridden fuunction from the base class: + SetupResources() + + + +In the SetupResources() function, we create the actual +window as a managed_window object. +A managed_window is a window like any other window, except +that is a direct child of the server's root window and as such is +managed by the window manager. +The window manager will put all kinds of decorations on our top-level +window like a title bar, a close button, a menu button, a border for +resizing and that sort of stuff. +Your mileage may vary, depending on the window manager you use. +We pass the title of our application to the constructor of the +managed_window, so we'll know what window we're looking at: + + + main_frame = new managed_window("Doodling with AXE"); + + +The window is created but is not visible yet. +To show the window on the screen, we have to Map the +window with the member function Map(). +When you start the program, it will show the empty window with our +'Doodling with AXE' title in the titlebar: + + + + + +You can do most of the usual things a window manager lets you do with +the doodle window. +You can minimize and restore or resize and move the window, provided +your window manager implements those functions. +The one thing you can not do is close the window. +The only way to stop doodle1 is to press ctrl-C in the terminal you +started the program. +This is because we do not handle the proper events to let the +window manager close our application. +As a matter of fact we do not handle any events at all, but we'll +get to that in the next section. + + +
+ +
+Drawing in the window + + +For drawing graphics in X Windows, we need two things. +First of all the window to draw in, of course. Second, we need a +Graphics Context. +A graphics context is a resource in X Windows that defines how graphical +primitives are drawn. It holds all the properties such as backround and +foreground color, line size and dashing, the font for text strings and +much more. +The window part of drawing is easy. +We just created a window for doodle and all graphical drawing functions +are simply member functions of the window class. +The graphics context is encapsulated with the gc class. +For our first example we will create a gc object with a foreground +color of black. +This means that everything we draw in the window is black on a white background +(assuming the default background of the window is white). +To start drawing graphics, we add two lines to our SetupResources() +member funtion: + + + gc graphic("black"); + main_frame->DrawRectangle(graphic, 50, 70, 200, 100); + + + +The parameters to DrawRectangle() are: the graphics context, the X and +Y coordinates of the top left corner and the size (width and height) of the rectangle. +So, this example draws a rectangle that has a top left corner 50 pixels to the right +of the left side of our window and 70 pixels down from the top side of our window. +The rectangle is 200 pixels wide and 100 pixels high. + + + +Getting a picture in a window is not so hard in itself. +However, drawing once and immediately after creating the window is not enough +in any practical application. +Try some window operations on your fresh drawing after doodle puts the window +on the screen. +You can resize the window or move windows from other applications over the doodle +window and you'll see the rectangle disappear just as easily as you created it. +That is because the X server does not remember what you drew in the window. +At the moment you call the DrawRectangle() function, the X server +renders the pixels to make the area on the screen look like a rectangle and then +immediately forgets the request to draw the rectangle. +When the doodle window becomes visible again after having been obscured for a while +or when the contents of the window are supposed to change for any other reason, +all the X server can do is clear the area of the window. +It is left to the application to redraw the contents of the window. + + + +Fortunately, the X server lets you know when somthing interesting happens to +your windows and when you are supposed to react. +It does this by sending events to the application that owns +the window where the event takes place. +The X server sends lots of events for all sorts of reasons. +Events are sent to your application for example when the user clicks a mouse button, +moves the mouse, hits a key on the keyboard or makes parts of your +window visible. +For each type of event, there is a virtual function in the window class. +If you want to handle any of those events from the X server, you have to +override an event handling function in a class you derive from the window +base class. +In our doodle application, we will make a new class and a new window. +The new window is created as a child window of our top level window and we will +draw pictures only in this child window. +Generally, it is not a good idea to do all kinds of drawing in the top level +window. +Any real application uses many windows for various kinds of user interaction +and the top level window is used only to organize all these sub windows and +interact with the window manager. +So, here we go with our own class derived from window, which we will +call a doodle_view: + + + +class doodle_view : public window +{ +public: + + doodle_view(window *parent) : window (*parent, 10, 30, 300, 220) + { + SelectInput(ExposureMask, 1); + Background(color("lightyellow")); + } + + virtual int EV_Expose(XExposeEvent); +}; + + + +We define two member functions for our doodle_view class: The contructor +function doodle_view() and the overridden event handler for +Expose events, EV_Expose(). +In the constructor, we pass the parent window to the contructor of the base class, +window and add the default geometry of our subwindow. +The geometry for a subwindow is very similar to drawing a rectangle. +The four numbers are the X and Y coordinate of the top left corner, the width +and the height of the subwindow, relative to the parent window. +Inside the contructor, we tell AXE that we want to handle +Expose events by calling SelectInput(). +The first parameter of SelectInput() is a bitmask of the events +we want to select. +The binary values and their names for the mask are the same as the ones defined +for the X library. +The second parameter is a boolean value which is '1' if you want to turn selection +of the events on and '0' of you want these events to be turned off. +We also add a little color to the subwindow, so it stands out more clearly +in the parent window. +The parent window specifies in which window we want to put our subwindow. +In doodle, we create the subwindow as a child of the top level window we created earlier. +A pointer to the subwindow is created inside the doodle class: + + + +class doodle: public xapplication +{ + managed_window *main_frame; + doodle_view *draw_frame; + + + + +The actual creation of the subwindow is put in the SetupResources() +member funtion of the doodle class, right after the creation +of the top level window: + + +void doodle::SetupResources() +{ + main_frame = new managed_window("Doodling with AXE"); + main_frame->Map(); + + draw_frame = new doodle_view(main_frame); + draw_frame->Map(); +} + + +Note that we have to Map the subwindow, just like the top level +window to make it visible. + + + +Finally, we have to implement the event handler function of the Expose +event handler, EV_Expose(). +As you may have noticed, the DrawRectangle() is removed from the +SetupResources() function. +We now wait for an expose event from the X server to do the actual drawing. +Every time our window becomes 'exposed' the X server sends an Expose +event, to which we react by redrawing our rectangle in the window. +Here is the implementation of the Expose event handler: + + + +int doodle_view::EV_Expose(XExposeEvent ev) +{ + gc graphic("black"); + + DrawRectangle(graphic, 50, 70, 200, 100); + + return 1; +} + + +Here you see the gc object and the DrawRectangle() +again, nearly the same as we previously had in the SetupResources() +function of the doodle class. +There is one difference: The pointer to the window (main_frame-> +in our previous example) is removed from the function call. +This is because we are now inside a member funtion of the doodle_view +class and our window is passed implicitly as the this pointer +of the object itself. + + + +The complete source code of the second doodle example is in the file +demos/doodle2.cpp of the AXE distribution. +If you compile and run doodle2, it should look like this: + + + + + +You can now move the window all over the screen, resize it, move other windows +over the doodle window and the rectangle we draw in the little yellow window +should stay intact. + + +
+ +
+Quitting the application + + +Up until now, we do not have a decent way to quit the doodle application. +You have to kill doodle by sending it a signal, like hitting ctrl-C on your +keyboard. +It's about time to remedy that situation. +There are many ways to close an application, like hitting a specific key +('q' for quit might be a good one), clicking on the close button provided +by the window manager or providing a 'Quit' button or menu item in the +application itself. +We will explore all of these possibilities in later chapters. +For now, to keep things simple, we will use the keyboard to quit doodle. + + + +When the user hits a key while the focus is on the doodle window, the X server +sends a KeyPress event to our application. +This KeyPress event is dispatched by AXE to the +window on which the key was pressed, just as Expose events are +dispatched to the appropriate window. +In AXE, you can use any event to quit your application program. +All you need to do is return the value 0 (zero) from the event handler function. +You may have noticed in the previous section that the EV_Expose() +handler function returned the value 1 (one). +This return value tells the AXE library not the quit the program +after the event is handled. +If you return 0 (zero) from an event handler function, AXE will +destroy all your windows, close the display connection with the X server +and quit the application. + + + +So, to quit doodle on a key stroke, we select KeyPress events +next to Expose events in our subwindow and override the +EV_KeyPress() event handler function. +To select KeyPress events, we add another SelectInput() +in our doodle_view contructor: + + + doodle_view(window *parent) : window (*parent, 10, 30, 300, 220) + { + SelectInput(ExposureMask, 1); + SelectInput(KeyPressMask, 1); + Background(color("lightyellow")); + } + + +Next, also in the doodle_view class declaration, we add the +declaration of the member function to handle the KeyPress events: + + + virtual int EV_KeyPress(XKeyEvent ev); + + +The implementation of the event handler is very trivial. +Just return the value 0 (zero) and doodle will close down when any key +is pressed in the light yellow window: + + +int doodle_view::EV_KeyPress(XKeyEvent ev) +{ + return 0; +} + + +Having any key at all, even the Ctrl or the CapsLock key, quit doodle is a bit +cruel, don;t you think. +So, let's restrain the quitting to just the lower case 'q' key. +When we get an event from the X server in one of our event handling functions, +all kinds of information about that event is passed in the ev +parameter. +Until now, we silently ignored the ev parameter but is this +case we need it to find out which key was actually pressed. +There is no special provision in AXE to do this. +There are Xlib functions that do the job just fine. +The one Xlib function we use here is XLookupKeysym(), which extracts +information from the XKeyEvent structure and returns +a standardized code (a KeySym) of the key that was actually pressed. +For most 'ordinary' keys, the KeySym value is the same as the ASCII +value. +We can use the 'q' key simply by checking the KeySym for the +value 'q': + + +int doodle_view::EV_KeyPress(XKeyEvent ev) +{ + KeySym key; + + key = XLookupKeysym(&ev, ev.state & 1); + + if (key == 'q') + { + return 0; + } + else + { + return 1; + } +} + + +With this extra check, you can hit any key you want on doodle, but +only the 'q' key makes doodle leave the desktop. +You can find the complete source of this example in demos/doodle3.cpp. + + +
+ +
+ + +
+ +
+ + diff --git a/doc/window.html b/doc/window.html new file mode 100644 index 0000000..22e867e --- /dev/null +++ b/doc/window.html @@ -0,0 +1,193 @@ + + +window - Andromeda X windows Encapsulation + + + + +

class window

+
+

NAME

+

window - X window class

+

SYNOPSIS

+

class window

+

DESCRIPTION

+

The window is the base class of all objects that are visible on the screen. +

+

Handled events

+

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

Member functions

+
+

window

+
+

window contructors and destructors

+
+

ID

+
+

Obtain X window id number

+
+

Map

+
+

Map a window on the screen

+
+

Unmap

+
+

Unmap a window from the screen

+
+

Size

+
+

Query the size of a window

+
+

Resize

+
+

Change the size of a window

+
+

Move

+
+

Move a window to another position

+
+

Background

+
+

Set a window's background

+
+

Clear

+
+

Clear the interior of a window

+
+

SelectInput

+
+

Turn input events on or off

+
+

GrabPointer

+
+

Start an active pointer grab

+
+

UngrabPointer

+
+

Finish an active pointer grab

+
+

ParentMessage

+
+

Send a message to the parent window

+
+

Overridable member functions

+
+

EV_Expose

+
+

Handle an Expose event

+
+

EV_KeyPress

+
+

Handle a KeyPress event

+
+

EV_KeyRelease

+
+

Handle a KeyRelease event

+
+

EV_ButtonPress

+
+

Handle a ButtonPress event

+
+

EV_ButtonRelease

+
+

Handle a ButtonRelease event

+
+

EV_EnterNotify

+
+

Handle an EnterNotify event

+
+

EV_LeaveNotify

+
+

Handle a LeaveNotify event

+
+

EV_ConfigureNotify

+
+

Handle a ConfigureNotify event

+
+

ParentResized

+
+

React to the resizing of the parent window

+
+

ChildMessage

+
+

Receive a message from a subwindow

+
+

SEE ALSO

+

DIAGNOSTICS

+ + diff --git a/doc/window_ID.html b/doc/window_ID.html new file mode 100644 index 0000000..6532b33 --- /dev/null +++ b/doc/window_ID.html @@ -0,0 +1,19 @@ + + +ID - ANDROMEDA X-windows Encapsulation + + + +

window::ID

+
+ +

NAME

+ID - Obtain X window id number +

SYNOPSIS

+XID window::ID(void); +

DESCRIPTION

+

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/window_background.html b/doc/window_background.html new file mode 100644 index 0000000..6238d34 --- /dev/null +++ b/doc/window_background.html @@ -0,0 +1,22 @@ + + +Background - ANDROMEDA X-windows Encapsulation + + + +

window::Background

+
+ +

NAME

+Background - Set a window's background +

SYNOPSIS

+void window::Background(unsigned long pixel); +

DESCRIPTION

+ +Set the background color of a window to a specific pixel value. + +

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/window_childmessage.html b/doc/window_childmessage.html new file mode 100644 index 0000000..4f6d4ce --- /dev/null +++ b/doc/window_childmessage.html @@ -0,0 +1,55 @@ + + +ChildMessage - ANDROMEDA X-windows Encapsulation + + + +

window::ChildMessage

+
+ +

NAME

+ChildMessage - Receive a message from a subwindow +

SYNOPSIS

+#include "xwindow.h" +
+virtual void window::ChildMessage(w_msg &message); +

DESCRIPTION

+ +A window may send a message to its parent when something important happens +in the window. +Examples of situations where such messages are being sent are: + +
    +
  • A menu item is selected +
  • The text in an edit window is changed +
  • The slider in a scrollbar is repositioned. +
  • An item in a list is selected. +
  • A radio button is clicked. +
+ +In all these cases the parent window must be notified because other +windows may be affected by the event. +For example, when a slider in a scrollbar is repositioned, the contents +of the window next to the scrollbar must be adjusted accordingly. +

+A w_msg is a simple structure: + +

+
+struct w_msg
+{
+   int    id;
+   long   timestamp;
+   window *from;
+};
+
+
+ +

SEE ALSO

+ +ParentMessage + +

DIAGNOSTICS

+ + + diff --git a/doc/window_clear.html b/doc/window_clear.html new file mode 100644 index 0000000..9a2cee3 --- /dev/null +++ b/doc/window_clear.html @@ -0,0 +1,22 @@ + + +Clear - ANDROMEDA X-windows Encapsulation + + + +

window::Clear

+
+ +

NAME

+Clear - Clear a window's interior +

SYNOPSIS

+void window::Clear(void); +

DESCRIPTION

+ + + +

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/window_ev_buttonpress.html b/doc/window_ev_buttonpress.html new file mode 100644 index 0000000..2b9c893 --- /dev/null +++ b/doc/window_ev_buttonpress.html @@ -0,0 +1,19 @@ + + +EV_ButtonPress - ANDROMEDA X-windows Encapsulation + + + +

window::EV_ButtonPress

+
+ +

NAME

+EV_ButtonPress - Handle a ButtonPress event +

SYNOPSIS

+virtual int window::EV_ButtonPress(XButtonEvent ev); +

DESCRIPTION

+

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/window_ev_buttonrelease.html b/doc/window_ev_buttonrelease.html new file mode 100644 index 0000000..7cbe8c7 --- /dev/null +++ b/doc/window_ev_buttonrelease.html @@ -0,0 +1,19 @@ + + +EV_ButtonRelease - ANDROMEDA X-windows Encapsulation + + + +

window::EV_ButtonRelease

+
+ +

NAME

+EV_ButtonRelease - Handle a ButtonRelease event +

SYNOPSIS

+virtual int window::EV_ButtonRelease(XButtonEvent ev); +

DESCRIPTION

+

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/window_ev_configurenotify.html b/doc/window_ev_configurenotify.html new file mode 100644 index 0000000..82cd95b --- /dev/null +++ b/doc/window_ev_configurenotify.html @@ -0,0 +1,19 @@ + + +EV_ConfigureNotify - ANDROMEDA X-windows Encapsulation + + + +

window::EV_ConfigureNotify

+
+ +

NAME

+EV_ConfigureNotify - Handle a ConfigureNotify event +

SYNOPSIS

+virtual int window::EV_ConfigureNotify(XConfigureEvent ev); +

DESCRIPTION

+

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/window_ev_enternotify.html b/doc/window_ev_enternotify.html new file mode 100644 index 0000000..b65a659 --- /dev/null +++ b/doc/window_ev_enternotify.html @@ -0,0 +1,19 @@ + + +EV_EnterNotify - ANDROMEDA X-windows Encapsulation + + + +

window::EV_EnterNotify

+
+ +

NAME

+EV_EnterNotify - Handle a EnterNotify event +

SYNOPSIS

+virtual int window::EV_EnterNotify(XCrossingEvent ev); +

DESCRIPTION

+

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/window_ev_expose.html b/doc/window_ev_expose.html new file mode 100644 index 0000000..b3b8e4f --- /dev/null +++ b/doc/window_ev_expose.html @@ -0,0 +1,23 @@ + + +EV_Expose - ANDROMEDA X-windows Encapsulation + + + +

window::EV_Expose

+
+ +

NAME

+EV_Expose - Handle an Expose event +

SYNOPSIS

+virtual int window::EV_Expose(XExposeEvent ev); +

DESCRIPTION

+ +The workstation sends an Expose event to the window when part or all of +the window becomes visible. + +

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/window_ev_keypress.html b/doc/window_ev_keypress.html new file mode 100644 index 0000000..40e88c9 --- /dev/null +++ b/doc/window_ev_keypress.html @@ -0,0 +1,19 @@ + + +EV_KeyPress - ANDROMEDA X-windows Encapsulation + + + +

window::EV_KeyPress

+
+ +

NAME

+EV_KeyPress - Handle a KeyPress event +

SYNOPSIS

+virtual int window::EV_KeyPress(XKeyEvent ev); +

DESCRIPTION

+

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/window_ev_keyrelease.html b/doc/window_ev_keyrelease.html new file mode 100644 index 0000000..50654ef --- /dev/null +++ b/doc/window_ev_keyrelease.html @@ -0,0 +1,19 @@ + + +EV_KeyRelease - ANDROMEDA X-windows Encapsulation + + + +

window::EV_KeyRelease

+
+ +

NAME

+EV_KeyRelease - Handle a KeyRelease event +

SYNOPSIS

+virtual int window::EV_KeyRelease(XKeyEvent ev); +

DESCRIPTION

+

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/window_ev_leavenotify.html b/doc/window_ev_leavenotify.html new file mode 100644 index 0000000..11f042a --- /dev/null +++ b/doc/window_ev_leavenotify.html @@ -0,0 +1,19 @@ + + +EV_LeaveNotify - ANDROMEDA X-windows Encapsulation + + + +

window::EV_LeaveNotify

+
+ +

NAME

+EV_LeaveNotify - Handle a LeaveNotify event +

SYNOPSIS

+virtual int window::EV_LeaveNotify(XCrossingEvent ev); +

DESCRIPTION

+

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/window_grabpointer.html b/doc/window_grabpointer.html new file mode 100644 index 0000000..f8a8968 --- /dev/null +++ b/doc/window_grabpointer.html @@ -0,0 +1,21 @@ + + +GrabPointer - ANDROMEDA X-windows Encapsulation + + + +

window::GrabPointer

+
+ +

NAME

+GrabPointer - Start an active pointer grab +

SYNOPSIS

+#include "xwindow.h" +

+int window::GrabPointer(Cursor curs); +

DESCRIPTION

+

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/window_map.html b/doc/window_map.html new file mode 100644 index 0000000..d3cd387 --- /dev/null +++ b/doc/window_map.html @@ -0,0 +1,19 @@ + + +Map - ANDROMEDA X-windows Encapsulation + + + +

window::Map

+
+ +

NAME

+Map - Map a window on the screen +

SYNOPSIS

+void window::Map(void); +

DESCRIPTION

+

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/window_move.html b/doc/window_move.html new file mode 100644 index 0000000..0984b11 --- /dev/null +++ b/doc/window_move.html @@ -0,0 +1,19 @@ + + +Move - ANDROMEDA X-windows Encapsulation + + + +

window::Move

+
+ +

NAME

+Move - Map a window on the screen +

SYNOPSIS

+void window::Move(int x, int y); +

DESCRIPTION

+

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/window_parentmessage.html b/doc/window_parentmessage.html new file mode 100644 index 0000000..e4d118a --- /dev/null +++ b/doc/window_parentmessage.html @@ -0,0 +1,28 @@ + + +ParentMessage - ANDROMEDA X-windows Encapsulation + + + +

window::ParentMessage

+
+ +

NAME

+ParentMessage - Send a message to the parent window +

SYNOPSIS

+#include "xwindow.h" +
+void window::ParentMessage(int id, long timestamp); +

DESCRIPTION

+ +The timestamp is taken from the event that caused the message in the first +place. +A parent window may use the timestamp e.g. to detect double-clicks. + +

SEE ALSO

+ +ChildMessage +

DIAGNOSTICS

+ + + diff --git a/doc/window_parentresized.html b/doc/window_parentresized.html new file mode 100644 index 0000000..eef6c3b --- /dev/null +++ b/doc/window_parentresized.html @@ -0,0 +1,19 @@ + + +ParentResized - ANDROMEDA X-windows Encapsulation + + + +

window::ParentResized

+
+ +

NAME

+ParentResized - React to resizing of the parent window. +

SYNOPSIS

+virtual int window::ParentResized(int w, int h); +

DESCRIPTION

+

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/window_resize.html b/doc/window_resize.html new file mode 100644 index 0000000..6b3040c --- /dev/null +++ b/doc/window_resize.html @@ -0,0 +1,26 @@ + + +Resize - ANDROMEDA X-windows Encapsulation + + + +

window::Resize

+
+ +

NAME

+Resize - Change the size of a window +

SYNOPSIS

+#include "xwindow.h" +

+void window::Resize(unsigned width, unsigned height);
+void window::Resize(size sz); + +

DESCRIPTION

+

SEE ALSO

+ +Size + +

DIAGNOSTICS

+ + + diff --git a/doc/window_selectinput.html b/doc/window_selectinput.html new file mode 100644 index 0000000..a71e1d5 --- /dev/null +++ b/doc/window_selectinput.html @@ -0,0 +1,34 @@ + + +SelectInput - ANDROMEDA X-windows Encapsulation + + + +

window::SelectInput

+
+ +

NAME

+SelectInput - Selection of input events +

SYNOPSIS

+#include "xwindow.h" +

+long window::SelectInput(long events, int on); +

+long window::SelectInput(void); + +

DESCRIPTION

+ +Depending on on, specific events are turned on or off. + +

+ +events is a bitwise OR of event masks. + +

SEE ALSO

+ +DispatchEvent + +

DIAGNOSTICS

+ + + diff --git a/doc/window_size.html b/doc/window_size.html new file mode 100644 index 0000000..460b1f3 --- /dev/null +++ b/doc/window_size.html @@ -0,0 +1,27 @@ + + +Size - ANDROMEDA X-windows Encapsulation + + + +

window::Size

+
+ +

NAME

+Size - Query the size of a window +

SYNOPSIS

+ +#include "xwindow.h" +

+void window::Size(unsigned &width, unsigned &height);
+size window::Size(void); + +

DESCRIPTION

+

SEE ALSO

+ +Resize + +

DIAGNOSTICS

+ + + diff --git a/doc/window_ungrabpointer.html b/doc/window_ungrabpointer.html new file mode 100644 index 0000000..8fbcd69 --- /dev/null +++ b/doc/window_ungrabpointer.html @@ -0,0 +1,21 @@ + + +UngrabPointer - ANDROMEDA X-windows Encapsulation + + + +

window::UngrabPointer

+
+ +

NAME

+UngrabPointer - Finish an active pointer grab +

SYNOPSIS

+#include "xwindow.h" +

+int window::UngrabPointer(void); +

DESCRIPTION

+

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/window_unmap.html b/doc/window_unmap.html new file mode 100644 index 0000000..754dc87 --- /dev/null +++ b/doc/window_unmap.html @@ -0,0 +1,19 @@ + + +Unmap - ANDROMEDA X-windows Encapsulation + + + +

window::Unmap

+
+ +

NAME

+Unmap - Unmap a window from the screen +

SYNOPSIS

+void window::Unmap(void); +

DESCRIPTION

+

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/window_window.html b/doc/window_window.html new file mode 100644 index 0000000..90ecc4d --- /dev/null +++ b/doc/window_window.html @@ -0,0 +1,30 @@ + + +window - ANDROMEDA X-windows Encapsulation + + + +

window::window

+
+ +

NAME

+window - window constructors and destructor +

SYNOPSIS

+window::window(int x=0, int y=0, unsigned w=320, unsigned h=256, int bw=4); +

+window::window(window &parent, int x=0, int y=0, + unsigned int w=100, unsigned int h=100, int bw = 1); +

+window::~window() + +

DESCRIPTION

+ +The first form of the constructor creates a window as a child of the +root window. The second form of the constructor creates a sub-window +of another window: its parent. + +

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/xappl_Pgrab.html b/doc/xappl_Pgrab.html new file mode 100644 index 0000000..e025068 --- /dev/null +++ b/doc/xappl_Pgrab.html @@ -0,0 +1,22 @@ + + +Pgrab - ANDROMEDA X-windows Encapsulation + + + +

xapplication::Pgrab

+
+ +

NAME

+Pgrab - Set the window that grabs the pointer +

SYNOPSIS

+void xapplication::Pgrab(window *w_ptr); + +

DESCRIPTION

+ + +

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/xappl_add_window.html b/doc/xappl_add_window.html new file mode 100644 index 0000000..81e8e89 --- /dev/null +++ b/doc/xappl_add_window.html @@ -0,0 +1,22 @@ + + +add_window - ANDROMEDA X-windows Encapsulation + + + +

xapplication::add_window

+
+ +

NAME

+add_window - Add a window to the application's list of windows +

SYNOPSIS

+void xapplication::add_window(XID w_id, window *w_ptr); + +

DESCRIPTION

+ + +

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/xappl_cleanup.html b/doc/xappl_cleanup.html new file mode 100644 index 0000000..131fc3e --- /dev/null +++ b/doc/xappl_cleanup.html @@ -0,0 +1,19 @@ + + +Cleanup - ANDROMEDA X-windows Encapsulation + + + +

xapplication::Cleanup

+
+ +

NAME

+Cleanup - Cleanup the application when it exits. +

SYNOPSIS

+void xapplication::Cleanup(void); +

DESCRIPTION

+

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/xappl_dispatchevent.html b/doc/xappl_dispatchevent.html new file mode 100644 index 0000000..cefee36 --- /dev/null +++ b/doc/xappl_dispatchevent.html @@ -0,0 +1,89 @@ + + +DispatchEvent - ANDROMEDA X-windows Encapsulation + + + +

xapplication::DispatchEvent

+
+

NAME

+DispatchEvent - Dispatch an X event to the receiving window + +

SYNOPSIS

+int xapplication::DispatchEvent(XEvent ev) + +

DESCRIPTION

+ +This is the central control function in every X windows application. +It is called by main to handle all events from the X +workstation. +After the application is initialized, main just sits in a +loop where it reads an event from the workstation and passes the +event to DispatchEvent. + +

+ +DispatchEvent searches the list of all windows that +are used by the application to find the window object +which should receive the event. +The appropriate event-handling function of the target window is then +called to handle the event. +The table below lists events defined in X windows, the mask needed to +solicit the event and the handler function which is called when the +event occurs. + + +
Event NameEvent nrMaskHandler +
KeyPress 2 KeyPressMask + EV_KeyPress +
KeyRelease 3 KeyReleaseMask + EV_KeyRelease +
ButtonPress 4 ButtonPressMask + EV_ButtonPress +
ButtonRelease 5 ButtonReleaseMask + EV_ButtonRelease +
MotionNotify 6 PointerMotionMask
+ ButtonMotionMask
+ Button[1-5]MotionMask
+
EnterNotify 7 EnterWindowMask + EV_EnterNotify +
LeaveNotify 8 LeaveWindowMask + EV_LeaveNotify +
FocusIn 9 FocusChangeMask +
FocusOut 10 FocusChangeMask +
KeymapNotify 11 KeymapStateMask +
Expose 12 ExposureMask + EV_Expose +
GraphicsExpose 13 +
NoExpose 14 +
VisibilityNotify 15 VisibilityChangeMask +
CreateNotify 16 +
DestroyNotify 17 StructureNotifyMask +
UnmapNotify 18 StructureNotifyMask +
MapNotify 19 StructureNotifyMask +
MapRequest 20 +
ReparentNotify 21 StructureNotifyMask +
ConfigureNotify 22 StructureNotifyMask + EV_ConfigureNotify +
ConfigureRequest 23 +
GravityNotify 24 StructureNotifyMask +
ResizeRequest 25 +
CirculateNotify 26 StructureNotifyMask +
CirculateRequest 27 +
PropertyNotify 28 PropertyChangeMask +
SelectionClear 29 +
SelectionRequest 30 +
SelectionNotify 31 +
ColormapNotify 32 ColormapChangeMask +
ClientMessage 33 +
MappingNotify 34 + +
+

SEE ALSO

+ +window::SelectInput + +

DIAGNOSTICS

+ + + diff --git a/doc/xappl_docommand.html b/doc/xappl_docommand.html new file mode 100644 index 0000000..ae18e55 --- /dev/null +++ b/doc/xappl_docommand.html @@ -0,0 +1,20 @@ + + +DoCommand - ANDROMEDA X-windows Encapsulation + + + +

xapplication::DoCommand

+
+ +

NAME

+DoCommand - +

SYNOPSIS

+ +

DESCRIPTION

+ +

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/xappl_initialize.html b/doc/xappl_initialize.html new file mode 100644 index 0000000..5b50b3c --- /dev/null +++ b/doc/xappl_initialize.html @@ -0,0 +1,24 @@ + + +xapplication::Initialize - ANDROMEDA X-windows Encapsulation + + + +

xapplication::Initialize

+
+ +

NAME

+Initialize - Perform the first Initialization. +

SYNOPSIS

+void xapplication::Initialize(void); + +

DESCRIPTION

+ +Initialize the application object. +Specifically before the command-line arguments can be parsed. + +

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/xappl_parsearguments.html b/doc/xappl_parsearguments.html new file mode 100644 index 0000000..17f7a0b --- /dev/null +++ b/doc/xappl_parsearguments.html @@ -0,0 +1,19 @@ + + +ParseArguments - ANDROMEDA X-windows Encapsulation + + + +

xapplication::ParseArguments

+
+ +

NAME

+ParseArguments - Parse command-line arguments into an application +

SYNOPSIS

+void xapplication::ParseArguments(int argc, char *argv[]); +

DESCRIPTION

+

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/xappl_remove_window.html b/doc/xappl_remove_window.html new file mode 100644 index 0000000..753d437 --- /dev/null +++ b/doc/xappl_remove_window.html @@ -0,0 +1,22 @@ + + +remove_window - ANDROMEDA X-windows Encapsulation + + + +

xapplication::remove_window

+
+ +

NAME

+remove_window - Remove a window from the application's list of windows +

SYNOPSIS

+void xapplication::remove_window(XID w_id); + +

DESCRIPTION

+ + +

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/xappl_setupresources.html b/doc/xappl_setupresources.html new file mode 100644 index 0000000..4146c2b --- /dev/null +++ b/doc/xappl_setupresources.html @@ -0,0 +1,19 @@ + + +SetupResources - ANDROMEDA X-windows Encapsulation + + + +

xapplication::SetupResources

+
+ +

NAME

+SetupResources - Create all visible objects +

SYNOPSIS

+void xapplication::SetupResources(void); +

DESCRIPTION

+

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/xappl_userinit.html b/doc/xappl_userinit.html new file mode 100644 index 0000000..97b1e46 --- /dev/null +++ b/doc/xappl_userinit.html @@ -0,0 +1,19 @@ + + +UserInit - ANDROMEDA X-windows Encapsulation + + + +

xapplication::UserInit

+
+ +

NAME

+UserInit - Perform user-specific initialization +

SYNOPSIS

+void xapplication::UserInit(void); +

DESCRIPTION

+

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/doc/xapplication.html b/doc/xapplication.html new file mode 100644 index 0000000..5d7b711 --- /dev/null +++ b/doc/xapplication.html @@ -0,0 +1,126 @@ + + +xapplication - ANDROMEDA X-winows Encapsulation + + + +

class xapplication

+
+

NAME

+xapplication - X-windows application object +

SYNOPSIS

+class xapplication + +

DESCRIPTION

+ +The xapplication is a base class which implements the main +thread of control in an application: initialization, event loop and +termination. +Each application must derive a subclass from xapplication and +define exactly one static object of this class. +An application does not need a main() function. +AXE has its own main which calls the member functions of the +xapplication object. +The baseclass constructor registers its this pointer in a +global area: xapplication *XApp. + +

+ +The main thread of control for an application is implemented in virtual +functions of xapplication. +The class derived from xapplication may override these +functions to implement application-specific behavior. +The functionality performed in xapplication is : + +

    +
  • Parse command-line argumnets. +
  • Create a main-frame window. +
  • Setup user interface objects, possibly from an external resource. +
  • Perform user-specific initialization, e.g. read the $HOME/.foorc. +
  • Dispatch events. +
  • Cleanup when the application terminates. +
+ +For dispatching events to the windows that should receive them, +the xapplication object maintains a list of all +window objects that are used +by the application. +The list of windows is maintained by the contructor and destructor +of the window class. + +

+ +A window object handles events through virtual functions. +Classes derived from window, like buttons, menu items, +slider and scrollbars implement their specific behavior by overriding +these event-handling functions. +The event dispatcher in the xapplication object passes +an appropriate XEvent structure as a parameter to the event-handling +function of the window. +The event-handling function returns TRUE if the application can +continue, or FALSE if the application should terminate. + +

+ +Some windows may send commands back to the xapplication object. +A menu item, for instance sends a command to the application when it is +clicked. +To send a command to the application, an object (usually a window) +calls the function XApp->DoCommand(code). +This function dispatches the command to a handler function. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Member functions
add_windowAdd a window to the application's list of windows +
remove_windowRemove a window from the application's list of windows +
PgrabSet the window that grabs the pointer +
DispatchEventFind the window object and call its event-handling function
Overridable member functions
InitializeInitialize the application
ParseArgumentsParse the command-line arguments
SetupResourcesCreate all visible objects
UserInitPerform user-specific initialization
DoCommandHandle a command form another object
CleanupCleanup the application when it exits
+ +

SEE ALSO

+

DIAGNOSTICS

+ + + diff --git a/install-sh b/install-sh new file mode 100755 index 0000000..e9de238 --- /dev/null +++ b/install-sh @@ -0,0 +1,251 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + chmodcmd="" + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/missing b/missing new file mode 100755 index 0000000..d46f79f --- /dev/null +++ b/missing @@ -0,0 +1,198 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. +# Copyright (C) 1996, 1997, 2001 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 + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.in; then + configure_ac=configure.ac +else + configure_ac=configure.in +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_ac'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`$configure_ac'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acconfig.h' or \`$configure_ac'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' $configure_ac` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`$configure_ac'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + 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..5e94482 --- /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 2002-07-25 08:01:14 arjen 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/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..c971693 --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,30 @@ + +## Process this file with automake to produce Makefile.in +includedir = $(prefix)/include/AXE + +lib_LIBRARIES = libAXE.a + +libAXE_a_SOURCES = xappl.cpp xwindow.cpp font.cpp menu.cpp frame.cpp \ + filedialog.cpp \ + parsedate.c datelex.c dateyacc.y \ + button.cpp edit.cpp scroll.cpp table.cpp geometry.cpp icon.cpp \ + string.cpp regex.cpp integer.cpp date.cpp hour.cpp amount.cpp out.cpp \ + configuration.cpp + +include_HEADERS = table.h menu.h button.h edit.h scroll.h pixmap.h \ + xappl.h display.h xwindow.h frame.h geometry.h icon.h \ + color.h font.h pattern.h cursor.h gc.h filedialog.h \ + money.h String.h date.h configuration.h + +dateyacc.h : dateyacc.y + bison -d -o dateyacc.c dateyacc.y + +LDADD = libAXE.a @LIBS@ + +## all : testaxe timesheet acltest + +##testaxe : testaxe.o libAXE.a + +## timesheet : timesheet.o libAXE.a + +## acltest : acltest.o libAXE.a diff --git a/src/Makefile.in b/src/Makefile.in new file mode 100644 index 0000000..397f07e --- /dev/null +++ b/src/Makefile.in @@ -0,0 +1,405 @@ +# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999, 2001 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@ +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 = : +AWK = @AWK@ +CC = @CC@ +CPP = @CPP@ +CXX = @CXX@ +LEX = @LEX@ +LN_S = @LN_S@ +MAKEINFO = @MAKEINFO@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +VERSION = @VERSION@ +XML_CONFIG = @XML_CONFIG@ +YACC = @YACC@ + +includedir = $(prefix)/include/AXE + +lib_LIBRARIES = libAXE.a + +libAXE_a_SOURCES = xappl.cpp xwindow.cpp font.cpp menu.cpp frame.cpp \ + filedialog.cpp \ + parsedate.c datelex.c dateyacc.y \ + button.cpp edit.cpp scroll.cpp table.cpp geometry.cpp icon.cpp \ + string.cpp regex.cpp integer.cpp date.cpp hour.cpp amount.cpp out.cpp \ + configuration.cpp + + +include_HEADERS = table.h menu.h button.h edit.h scroll.h pixmap.h \ + xappl.h display.h xwindow.h frame.h geometry.h icon.h \ + color.h font.h pattern.h cursor.h gc.h filedialog.h \ + money.h String.h date.h configuration.h + + +LDADD = libAXE.a @LIBS@ +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_CLEAN_FILES = +LIBRARIES = $(lib_LIBRARIES) + + +DEFS = @DEFS@ -I. -I$(srcdir) +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +X_CFLAGS = @X_CFLAGS@ +X_LIBS = @X_LIBS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +libAXE_a_LIBADD = +libAXE_a_OBJECTS = xappl.o xwindow.o font.o menu.o frame.o filedialog.o \ +parsedate.o datelex.o dateyacc.o button.o edit.o scroll.o table.o \ +geometry.o icon.o string.o regex.o integer.o date.o hour.o amount.o \ +out.o configuration.o +AR = ar +CXXFLAGS = @CXXFLAGS@ +CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ +CFLAGS = @CFLAGS@ +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +HEADERS = $(include_HEADERS) + +DIST_COMMON = ChangeLog Makefile.am Makefile.in dateyacc.c install-sh \ +missing mkinstalldirs + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +DEP_FILES = .deps/amount.P .deps/button.P .deps/configuration.P \ +.deps/date.P .deps/datelex.P .deps/dateyacc.P .deps/edit.P \ +.deps/filedialog.P .deps/font.P .deps/frame.P .deps/geometry.P \ +.deps/hour.P .deps/icon.P .deps/integer.P .deps/menu.P .deps/out.P \ +.deps/parsedate.P .deps/regex.P .deps/scroll.P .deps/string.P \ +.deps/table.P .deps/xappl.P .deps/xwindow.P +SOURCES = $(libAXE_a_SOURCES) +OBJECTS = $(libAXE_a_OBJECTS) + +all: all-redirect +.SUFFIXES: +.SUFFIXES: .S .c .cpp .o .s .y +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + + +mostlyclean-libLIBRARIES: + +clean-libLIBRARIES: + -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES) + +distclean-libLIBRARIES: + +maintainer-clean-libLIBRARIES: + +install-libLIBRARIES: $(lib_LIBRARIES) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(libdir) + @list='$(lib_LIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p"; \ + $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p; \ + else :; fi; \ + done + @$(POST_INSTALL) + @list='$(lib_LIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(RANLIB) $(DESTDIR)$(libdir)/$$p"; \ + $(RANLIB) $(DESTDIR)$(libdir)/$$p; \ + else :; fi; \ + done + +uninstall-libLIBRARIES: + @$(NORMAL_UNINSTALL) + list='$(lib_LIBRARIES)'; for p in $$list; do \ + rm -f $(DESTDIR)$(libdir)/$$p; \ + done + +.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: + +libAXE.a: $(libAXE_a_OBJECTS) $(libAXE_a_DEPENDENCIES) + -rm -f libAXE.a + $(AR) cru libAXE.a $(libAXE_a_OBJECTS) $(libAXE_a_LIBADD) + $(RANLIB) libAXE.a +.cpp.o: + $(CXXCOMPILE) -c $< +.y.c: + $(YACC) $(AM_YFLAGS) $(YFLAGS) $< && mv y.tab.c $*.c + if test -f y.tab.h; then \ + if cmp -s y.tab.h $*.h; then rm -f y.tab.h; else mv y.tab.h $*.h; fi; \ + else :; fi +dateyacc.h: dateyacc.c + + +install-includeHEADERS: $(include_HEADERS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(includedir) + @list='$(include_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \ + echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p"; \ + $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p; \ + done + +uninstall-includeHEADERS: + @$(NORMAL_UNINSTALL) + list='$(include_HEADERS)'; for p in $$list; do \ + rm -f $(DESTDIR)$(includedir)/$$p; \ + done + +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) $(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)$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = src + +distdir: $(DISTFILES) + here=`cd $(top_builddir) && pwd`; \ + top_distdir=`cd $(top_distdir) && pwd`; \ + distdir=`cd $(distdir) && pwd`; \ + cd $(top_srcdir) \ + && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu src/Makefile + @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 + +DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) + +-include $(DEP_FILES) + +mostlyclean-depend: + +clean-depend: + +distclean-depend: + -rm -rf .deps + +maintainer-clean-depend: + +%.o: %.c + @echo '$(COMPILE) -c $<'; \ + $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-cp .deps/$(*F).pp .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm .deps/$(*F).pp + +%.lo: %.c + @echo '$(LTCOMPILE) -c $<'; \ + $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ + < .deps/$(*F).pp > .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm -f .deps/$(*F).pp + +%.o: %.cpp + @echo '$(CXXCOMPILE) -c $<'; \ + $(CXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-cp .deps/$(*F).pp .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm .deps/$(*F).pp + +%.lo: %.cpp + @echo '$(LTCXXCOMPILE) -c $<'; \ + $(LTCXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ + < .deps/$(*F).pp > .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm -f .deps/$(*F).pp +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: all-am +check: check-am +installcheck-am: +installcheck: installcheck-am +install-exec-am: install-libLIBRARIES +install-exec: install-exec-am + +install-data-am: install-includeHEADERS +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: uninstall-libLIBRARIES uninstall-includeHEADERS +uninstall: uninstall-am +all-am: Makefile $(LIBRARIES) $(HEADERS) +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir) + + +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: + -test -z "dateyacchdateyaccc" || rm -f dateyacch dateyaccc +mostlyclean-am: mostlyclean-libLIBRARIES mostlyclean-compile \ + mostlyclean-tags mostlyclean-depend mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-libLIBRARIES clean-compile clean-tags clean-depend \ + clean-generic mostlyclean-am + +clean: clean-am + +distclean-am: distclean-libLIBRARIES distclean-compile distclean-tags \ + distclean-depend distclean-generic clean-am + +distclean: distclean-am + +maintainer-clean-am: maintainer-clean-libLIBRARIES \ + maintainer-clean-compile maintainer-clean-tags \ + maintainer-clean-depend 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 + +.PHONY: mostlyclean-libLIBRARIES distclean-libLIBRARIES \ +clean-libLIBRARIES maintainer-clean-libLIBRARIES uninstall-libLIBRARIES \ +install-libLIBRARIES mostlyclean-compile distclean-compile \ +clean-compile maintainer-clean-compile uninstall-includeHEADERS \ +install-includeHEADERS tags mostlyclean-tags distclean-tags clean-tags \ +maintainer-clean-tags distdir mostlyclean-depend distclean-depend \ +clean-depend maintainer-clean-depend info-am info dvi-am dvi check \ +check-am installcheck-am installcheck 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 + + +dateyacc.h : dateyacc.y + bison -d -o dateyacc.c dateyacc.y + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/String.h b/src/String.h new file mode 100644 index 0000000..a5f9bf7 --- /dev/null +++ b/src/String.h @@ -0,0 +1,348 @@ +/************************************************************************** +** (c) Copyright 1997, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : String.h +** SYSTEM NAME : Andromeda X-Windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : Character String class definition +** +** EXPORTED OBJECTS : class String +** LOCAL OBJECTS : class substring +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Nov 17, 1995 +** LAST UPDATE : Feb 23, 2001 +** MODIFICATIONS : +**************************************************************************/ + +/***************************** + $Log: String.h,v $ + Revision 1.1 2002-07-25 08:01:26 arjen + First checkin, AXE release 0.2 + +*****************************/ + +// static const char RCSID[] = "$Id: String.h,v 1.1 2002-07-25 08:01:26 arjen Exp $"; + +#ifndef STRING_H +#define STRING_H + +#include +#include +#include + +#include + +/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +** NAME : String - Character String class. +** MEMBERS : p -> s : Pointer to the actual String data. +** p -> n : Number of references to this String. +** OPERATORS : = : Assign a String, char *, char to a String. +** +, += : concatenate Strings +** ~ : Length of a String +** [] : Individual character access. +** ! : Empty String test. +** () : Substring selection. +** ostream << : String to output stream. +** istream << : String from input stream. +** ==, !=, <, +** >, <=, >= : String comparison. +** METHODS : +** +** DESCRIPTION : The String class counts the references to a String to +** minimize copying and uses standard C++ character strings +** as constants. +** +** RELATIONS : substring +** SEE ALSO : +** LAST MODIFIED : Aug 27, 1999 +**+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +*/ + + +class String +{ + friend class substring; + friend class regex; + + struct srep + { + char *s; // pointer to data; + int n; // reference count + } *p; + +public: + + String(const char *); // String x = "abc" + String(char); // String x = 'a' + String(); // String x; + String(const String &); // String x = String ... + String(const substring &); // String x = String(s, l) + + String& operator=(const char); + String& operator=(const char *); + String& operator=(const String &); + ~String(); + + /* Numerical conversion */ + + String(long); // String x(12); x = "12" + String(unsigned long); // String x(12); x = "12" + String(int); // String x(12); x = "12" + operator long() + { + return strtol(p->s, 0, 0); + } + + operator unsigned long() + { + return strtoul(p->s, 0, 0); + } + + long dec(void) + { + return strtol(p->s, 0, 10); + } + + long oct(void) + { + return strtol(p->s, 0, 8); + } + + long hex(void) + { + return strtol(p->s, 0, 16); + } + + String(double); + operator double() + { + return strtod(p->s, 0); + } + + /* */ + + char& operator[](int i); // Individual character access + + int operator~() const // Length of the String + { + return strlen(p->s); + } + + operator char*() + { + if (p->s && p->s[0]) + return p->s; + else + return 0; + } + operator const char*() const + { + if (p->s && p->s[0]) + return p->s; + else + return 0; + } + + operator bool() // Test for empty String + { + return p->s != 0 && p->s[0] != '\0'; + } + + /* + * String concatenation. + * char and char* are handled by constructors. + */ + + String& operator+=(const String&); + String& operator+=(const char *); + friend String operator+(const String&, const String&); + friend String operator+(const String&, const char *); + friend String operator+(const char *, const String&); + + /* + * Shifting characters out + * "abcdefgh" <<= 3 = "defgh" + * "abcdefgh" >>= 3 = "abcde" + */ + + friend String operator<<(const String &x, int n); + String & operator<<=(int n); + + friend String operator>>(const String &x, int n); + String & operator>>=(int n); + + /* + * Substring selection + */ + + substring operator()(int start, int len); + + /* + * Input and output + */ + + friend ostream& operator<<(ostream &, const String &); + friend istream& operator>>(istream &, String &); + + /* + * String comparison tests + */ + + friend int operator==(const String& x, const String& y) + { + return strcmp(x.p->s, y.p->s) == 0; + } + + friend int operator!=(const String& x, const String& y) + { + return strcmp(x.p->s, y.p->s) != 0; + } + + friend int operator<=(const String& x, const String& y) + { + return strcmp(x.p->s, y.p->s) <= 0; + } + + friend int operator>=(const String& x, const String& y) + { + return strcmp(x.p->s, y.p->s) >= 0; + } + + friend int operator<(const String& x, const String& y) + { + return strcmp(x.p->s, y.p->s) < 0; + } + + friend int operator>(const String& x, const String& y) + { + return strcmp(x.p->s, y.p->s) > 0; + } + + friend int operator==(const String& x, const char * y) + { + return strcmp(x.p->s, y) == 0; + } + + friend int operator!=(const String& x, const char * y) + { + return strcmp(x.p->s, y) != 0; + } + + friend int operator<=(const String& x, const char * y) + { + return strcmp(x.p->s, y) <= 0; + } + + friend int operator>=(const String& x, const char * y) + { + return strcmp(x.p->s, y) >= 0; + } + + friend int operator<(const String& x, const char * y) + { + return strcmp(x.p->s, y) < 0; + } + + friend int operator>(const String& x, const char * y) + { + return strcmp(x.p->s, y) > 0; + } + + /* + * Modifiers + */ + + String upper(void); + String lower(void); + + /* + * Character searching and Pattern matching + */ + + int index(char c); + int rindex(char c); + + int in(String & x); + + // Regular expression pattern matching + + friend bool operator == (const String &s, const regex &r); + friend bool operator == (const regex &r, const String &s); +}; + /* + * Other operators to think about... + * + * + * Numeric conversion with strtod and strtol and vice-versa, + * so we can do: + * String nr = 123 // nr = "123" + * float x = 2.32; String f = x; // f = "2.32" + * f = "3.145"; + * int i = f; // i = 3 + * + * String matching: + * int index(String&, start=0) // Find position of substring + * + * + * Literature: Bjarne Stroustrup, Section 6.9 + * DDJ October 1991, pg 24 + */ + + +/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +** NAME : substring - Determine part of a String object. +** MEMBERS : str : The String object of which this is a substring +** start : index of the first substring character. +** len : Number of characters in the substring +** OPERATORS : = : Assignment of a String or char * +** METHODS : +** +** DESCRIPTION : This implements substring selection from a String object +** with l-value semantics. +** +** RELATIONS : String +** SEE ALSO : +** LAST MODIFIED : +**+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +*/ + +class substring +{ + friend class String; + + String *str; // Where I am a substring of. + int start, len; + +public: + String& operator=(const String &); + String& operator=(char *s) + { + *this = String(s); + return *str; + } +}; + +/* Regular expression matching */ + +class regex +{ + regex_t expression; + +public: + + regex(const String & reg); + regex(const char * reg); + ~regex(); + + friend bool operator == (const String &s, const regex &r); + friend bool operator == (const regex &r, const String &s); +}; + +#endif /* STRING_H */ diff --git a/src/Xclass.h b/src/Xclass.h new file mode 100644 index 0000000..e1526ed --- /dev/null +++ b/src/Xclass.h @@ -0,0 +1,230 @@ +/* + * C++ X Windows class library + */ + +#include + +class drawable; +class window; + +class point +{ + short _x, _y; + +public: + + point() { _x = 0; _y = 0; } + + point(int x, int y) { _x = x; _y = y; } + + short x() { return _x; } + + short y() { return _y; } + +}; + + +class line +{ + int npoints; + int mode; + point *points; + + friend drawable; + + void drawline(drawable &d); + +public: + + line() + { + npoints = 0; + mode = CoordModeOrigin; + } + + line(short x1, short y1, short x2, short y2) + { + npoints = 2; + mode = CoordModeOrigin; + points = new point[2]; + points[0] = point(x1, y1); + points[1] = point(x2, y2); + } + + line(point p1, point p2) + { + npoints = 2; + mode = CoordModeOrigin; + points = new point[2]; + points[0] = p1; + points[1] = p2; + } + + ~line() + { + if (npoints != 0) + delete [] points; + } + + point &operator[] (int index); + +}; + +class rectangle +{ + short x, y; + unsigned short width, height; + + friend drawable; + +public: + + rectangle() + { + x = 0; + y = 0; + width = 0; + height = 0; + } + + rectangle(int _x, int _y, unsigned int _w, unsigned int _h) + { + x = _x; + y = _y; + width = _w; + height = _h; + } + + // Define a rectangle by its diagonal + + rectangle(point p1, point p2); + +// friend window &operator<< (window &d, rectangle &r); +// friend pixmap &operator<< (pixmap &d, rectangle &r); +}; + +class box +{ + short x, y; + unsigned short width, height; + +public: + + box() + { + x = 0; + y = 0; + width = 0; + height = 0; + } + + box(int _x, int _y, unsigned int _w, unsigned int _h) + { + x = _x; + y = _y; + width = _w; + height = _h; + } + + // Define a box by its diagonal + + box(point p1, point p2); + +// friend window &operator<< (window &d, box &b); +// friend pixmap &operator<< (pixmap &d, box &b); +}; + +class text +{ + short x, y; + String txt; + + friend drawable; + +public: + + text() + { + x = 0; + y = 0; + } + + text(int _x, int _y, String str) + { + x = _x; + y = _y; + txt = str; + } + + text(point p, String s) + { + x = p.x(); + y = p.y(); + txt = s; + } + +// friend window &operator<< (window &d, text &t); +// friend pixmap &operator<< (pixmap &d, text &t); +}; + +class drawable +{ + friend window; + + XID id; // The window or pixmap id in the server. + GC gc; // The graphics context. + +public: + + XID Id() + { + return id; + } + + GC Gc() + { + return gc; + } + + void foreground(unsigned long color) + { + XSetForeground(stddpy.Dpy(), gc, color); + } + + void background(unsigned long color) + { + XSetBackground(stddpy.Dpy(), gc, color); + } + + drawable &operator<< (point &p); + drawable &operator<< (line &l); + + drawable &operator<< (rectangle &r); + drawable &operator<< (text &t); +}; + +class window : public drawable +{ +public: + window(int x=0, int y=0, unsigned int w=100, unsigned int h=100); + window(window &, int x=0, int y=0, unsigned int w=100, unsigned int h=100); + ~window(); + + // Mapping and unmapping + + void operator++() + { + XMapWindow(stddpy.Dpy(), id); + } + + void operator--() + { + XUnmapWindow(stddpy.Dpy(), id); + } + +}; + +class pixmap : public drawable +{ +}; + diff --git a/src/amount.cpp b/src/amount.cpp new file mode 100644 index 0000000..834813f --- /dev/null +++ b/src/amount.cpp @@ -0,0 +1,121 @@ +/************************************************************************** +** (c) Copyright 1999, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : amount.cpp +** SYSTEM NAME : Andromeda X-Windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : Financial classes : amount +** +** EXPORTED OBJECTS : class amount +** LOCAL OBJECTS : +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Aug 26, 1999 +** LAST UPDATE : Aug 26, 1999 +** MODIFICATIONS : +**************************************************************************/ + +/***************************** + $Log: amount.cpp,v $ + Revision 1.1 2002-07-25 08:01:26 arjen + First checkin, AXE release 0.2 + +*****************************/ + +static const char RCSID[] = "$Id: amount.cpp,v 1.1 2002-07-25 08:01:26 arjen Exp $"; + +#include "money.h" + +istream &operator>>(istream &s, amount &a) +{ + long hundreds; + char c; + + s >> hundreds >> c >> a.value; + a.value += hundreds * 100; + + return s; +} + +ostream &operator<<(ostream &s, amount a) +{ + if (a == 0) + { + s << " "; + } + else + { + s.width(8); + s.fill(' '); + s << a / 100; + s << '.'; + s.width(2); + s.fill('0'); + s << a % 100; + //s << form("%8d.%02d",a / 100, a % 100); + } + + return s; +} + +amount::amount(String s) +{ + int dp; // The position of the decimal point + + dp = s.index('.'); + if (dp == -1) + { + dp = s.index(','); + } + if (dp != -1) + { + String whole; + + whole = s(0, dp); + value = whole; + value *= 100; + s <<= dp + 1; + value += (unsigned long)s; + } + else + { + // No decimal point; integer value + + value = s; + value *= 100; + } +} + +amount::operator String() +{ + String s; + + s = String(value / 100) + "." + String(value % 100); + + return s; +} + +String amount::make_string(void) +{ + String s; + String decimals; + + s = String(value / 100) + "."; + decimals = String(value % 100); + if (~decimals == 1) + { + decimals = "0" + decimals; + } + + s += decimals; + + return s; +} + + diff --git a/src/button.cpp b/src/button.cpp new file mode 100644 index 0000000..b6dca8e --- /dev/null +++ b/src/button.cpp @@ -0,0 +1,59 @@ + +/************************************************************************** +** (c) Copyright 1998, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : button.cpp +** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : Implementation of button classes +** +** EXPORTED OBJECTS : +** LOCAL OBJECTS : +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Mar 13, 1998 +** LAST UPDATE : Mar 13, 1998 +** MODIFICATIONS : +**************************************************************************/ + +/***************************** + $Log: button.cpp,v $ + Revision 1.1 2002-07-25 08:01:26 arjen + First checkin, AXE release 0.2 + +*****************************/ + +static const char *RCSID = "$Id: button.cpp,v 1.1 2002-07-25 08:01:26 arjen Exp $"; + +#include "button.h" + +int touch_button::EV_ButtonPress(XButtonEvent ev) +{ + Strength(-Strength()); + click(); + return 1; +} + +void touch_button::click(void) +{ +} + +void toggle_button::click(void) +{ + state = state == State_On ? State_Off : State_On; + redraw(); +} + +void toggle_button::redraw(void) +{ + if (state == State_On) + XFillRectangle(stddpy, ID(), red_gc, 6, 6, 12, 20); + else + XFillRectangle(stddpy, ID(), green_gc, 6, 6, 12, 20); +} diff --git a/src/button.h b/src/button.h new file mode 100644 index 0000000..25d02c8 --- /dev/null +++ b/src/button.h @@ -0,0 +1,134 @@ + +/************************************************************************** +** (c) Copyright 1998, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : button.h +** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : Definition of button classes +** +** EXPORTED OBJECTS : +** LOCAL OBJECTS : +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Mar 07, 1998 +** LAST UPDATE : Mar 13, 1998 +** MODIFICATIONS : +**************************************************************************/ + +/***************************** + $Log: button.h,v $ + Revision 1.1 2002-07-25 08:01:26 arjen + First checkin, AXE release 0.2 + +*****************************/ + +/* static const char *RCSID = "$Id: button.h,v 1.1 2002-07-25 08:01:26 arjen Exp $"; */ + +#include "frame.h" + +/* +/////////////////////////////////////////////////////////////////////////// +// NAME : button +// BASECLASS : frame +// MEMBERS : +// OPERATORS : +// METHODS : +// +// DESCRIPTION : +// +// RELATIONS : +// SEE ALSO : +// LAST MODIFIED : +/////////////////////////////////////////////////////////////////////////// +*/ + +class button : public frame +{ + +public: + + button(window &par, int x, int y,char *label) : frame(par, x, y, label) + { + SelectInput(ButtonReleaseMask|ButtonPressMask, 1); + } + + virtual int EV_ButtonPress(XButtonEvent ev) + { + Strength(-Strength()); + return 1; + } + + virtual int EV_ButtonRelease(XButtonEvent ev) + { + Strength(-Strength()); + return 1; + } +}; + +class touch_button : public button +{ + +public: + + touch_button(window &par, int x, int y, char *label) + : button(par, x, y, label) + { + } + + + virtual int EV_ButtonPress(XButtonEvent ev); + + virtual void click(void); +}; + + +class toggle_button : public touch_button +{ + enum { State_Off, State_On } state; + +public: + + toggle_button(window &par, int x, int y, char *label) + : touch_button(par, x, y, label) + { + state = State_Off; + } + + virtual void click(void); + + virtual void redraw(void); +}; + +class command_button : public button +{ + int command_code; + +public: + + command_button(window &par, int x, int y, char *label, int cc = 0) + : button(par, x, y, label) + { + command_code = cc; + } + + virtual int EV_ButtonPress(XButtonEvent ev) + { + Strength(-Strength()); + return 1; + } + + virtual int EV_ButtonRelease(XButtonEvent ev) + { + Strength(-Strength()); + + return XApp->SendCommand(command_code); + } +}; + diff --git a/src/color.h b/src/color.h new file mode 100644 index 0000000..e0f4852 --- /dev/null +++ b/src/color.h @@ -0,0 +1,103 @@ +/************************************************************************** +** (c) Copyright 1998, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : color.h +** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : Definition of color class +** +** EXPORTED OBJECTS : class color +** LOCAL OBJECTS : +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Feb 24, 1998 +** LAST UPDATE : Feb 24, 1998 +** MODIFICATIONS : +**************************************************************************/ + +/***************************** + $Log: color.h,v $ + Revision 1.1 2002-07-25 08:01:26 arjen + First checkin, AXE release 0.2 + +*****************************/ + +/* static const char *RCSID = "$Id: color.h,v 1.1 2002-07-25 08:01:26 arjen Exp $"; */ + +#include +#include "display.h" + +/* +/////////////////////////////////////////////////////////////////////////// +// NAME : color +// BASECLASS : +// MEMBERS : XColor xcol; +// OPERATORS : +// METHODS : +// +// DESCRIPTION : +// +// RELATIONS : +// SEE ALSO : +// LAST MODIFIED : Feb 24, 1998 +/////////////////////////////////////////////////////////////////////////// +*/ + +class color +{ + XColor xcol; + +public: + + color() + { + xcol.pixel = 0; + } + + color(unsigned red, unsigned green, unsigned blue) + { + xcol.red = red; + xcol.green = green; + xcol.blue = blue; + xcol.flags = DoRed | DoGreen | DoBlue; + + XAllocColor(stddpy, stddpy.ColMap(), &xcol); + } + + color(char *colorname) + { + XColor exact; + + XAllocNamedColor(stddpy, stddpy.ColMap(), colorname, &xcol, &exact); + } + + void Alloc(unsigned red, unsigned green, unsigned blue) + { + xcol.red = red; + xcol.green = green; + xcol.blue = blue; + xcol.flags = DoRed | DoGreen | DoBlue; + + XAllocColor(stddpy, stddpy.ColMap(), &xcol); + } + + void Alloc(char *colorname) + { + XColor exact; + + XAllocNamedColor(stddpy, stddpy.ColMap(), colorname, &xcol, &exact); + } + + operator unsigned long() const + { + return xcol.pixel; + } + +}; + diff --git a/src/configuration.cpp b/src/configuration.cpp new file mode 100644 index 0000000..6c2b7bc --- /dev/null +++ b/src/configuration.cpp @@ -0,0 +1,195 @@ + +/************************************************************************** +** (c) Copyright 2002, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : configuration.cpp +** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : Implementation of configuration class +** +** EXPORTED OBJECTS : +** LOCAL OBJECTS : +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Jul 23, 2002 +** LAST UPDATE : Jul 24, 2002 +** MODIFICATIONS : +**************************************************************************/ + +/***************************** + $Log: configuration.cpp,v $ + Revision 1.1 2002-07-25 08:01:26 arjen + First checkin, AXE release 0.2 + +*****************************/ + +static const char *RCSID = "$Id: configuration.cpp,v 1.1 2002-07-25 08:01:26 arjen Exp $"; + +#include "configuration.h" + +/*========================================================================= +** NAME : configuration::read +** SYNOPSIS : +** PARAMETERS : +** RETURN VALUE : true if any config files were found +** +** DESCRIPTION : +** +** VARS USED : +** VARS CHANGED : +** FUNCTIONS USED : +** SEE ALSO : +** LAST MODIFIED : Jul 24, 2002 +**========================================================================= +*/ + +bool configuration::read(const String name) +{ + String filename; + + app_name = name; + + // Try to read the config files. + + filename = "/etc/" + name + ".conf"; + system = xmlParseFile(filename); + + if (system == NULL) + { + filename = "/usr/local/etc/" + name + ".conf"; + system = xmlParseFile(filename); + } + + filename = getenv("HOME"); + filename += "/."; + filename += name + ".conf"; + user = xmlParseFile(filename); + + // Check the root element, which must be the application name + + xmlNodePtr root; + + if (system != NULL) + { + root = xmlDocGetRootElement(system); + if (app_name != (char *)root->name) + { + cerr << "Wrong config file.\n"; + xmlFreeDoc(system); + system = NULL; + } + } + + if (user != NULL) + { + root = xmlDocGetRootElement(user); + if (app_name != (char *)root->name) + { + cerr << "Wrong config file.\n"; + xmlFreeDoc(user); + user = NULL; + } + } + + return system != NULL || user != NULL; +} + +/*========================================================================= +** NAME : configuration::xmlFindTag +** SYNOPSIS : +** PARAMETERS : +** RETURN VALUE : Pointer to the XML element or NULL +** +** DESCRIPTION : +** +** VARS USED : +** VARS CHANGED : +** FUNCTIONS USED : +** SEE ALSO : +** LAST MODIFIED : Jul 24, 2002 +**========================================================================= +*/ + +xmlNodePtr configuration::xmlFindTag(xmlNodePtr node, const String tag) +{ + xmlNodePtr element = NULL; + + while (element == NULL && node != NULL) + { + if (node->type == XML_ELEMENT_NODE && tag == (char *)node->name) + { + element = node; + } + node = node->next; + } + + return element; +} + +/*========================================================================= +** NAME : configuration::find_parameter +** SYNOPSIS : +** PARAMETERS : +** RETURN VALUE : The content of the parameter or an empty string +** +** DESCRIPTION : +** +** VARS USED : +** VARS CHANGED : +** FUNCTIONS USED : +** SEE ALSO : +** LAST MODIFIED : Jul 24, 2002 +**========================================================================= +*/ + +String configuration::find_parameter(const String section, const String parameter) +{ + xmlNodePtr root_node; + xmlNodePtr section_node; + xmlNodePtr param_node; + + String param_value(""); + + // First, we try to find the parameter in the system-wide config + + if (system) + { + root_node = xmlDocGetRootElement(system); + section_node = xmlFindTag(root_node->childs, section); + if (section_node != NULL) + { + param_node = xmlFindTag(section_node->childs, parameter); + param_node = param_node->childs; + if (param_node != NULL) + { + param_value = (char *)param_node->content; + } + } + } + + // If the parameter is also defined in the user config, it will override + // the system-wide value. + + if (user) + { + root_node = xmlDocGetRootElement(user); + section_node = xmlFindTag(root_node->childs, section); + if (section_node != NULL) + { + param_node = xmlFindTag(section_node->childs, parameter); + param_node = param_node->childs; + if (param_node != NULL) + { + param_value = (char *)param_node->content; + } + } + } + + return param_value; +} diff --git a/src/configuration.h b/src/configuration.h new file mode 100644 index 0000000..f2ea550 --- /dev/null +++ b/src/configuration.h @@ -0,0 +1,93 @@ +/************************************************************************** +** (c) Copyright 2002, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : configuration.h +** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : Definition of configuration class +** +** EXPORTED OBJECTS : class configuration +** LOCAL OBJECTS : +** MODULES USED : String +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Jul 24, 2002 +** LAST UPDATE : +** MODIFICATIONS : +**************************************************************************/ + +/***************************** + $Log: configuration.h,v $ + Revision 1.1 2002-07-25 08:01:26 arjen + First checkin, AXE release 0.2 + +*****************************/ + +/* static const char *RCSID = "$Id: configuration.h,v 1.1 2002-07-25 08:01:26 arjen Exp $"; */ + +#ifndef CONFIGURATION_H +#define CONFIGURATION_H + +#include // usually in /usr/include/gnome-xml, see xml-config + +#include "String.h" + +/* +/////////////////////////////////////////////////////////////////////////// +// NAME : configuration +// BASECLASS : +// MEMBERS : +// OPERATORS : +// METHODS : read +// +// DESCRIPTION : Handle configurational parameters for the application. +// Many applications need some permanently stored configurational +// data. The information is usually stored in two places: A system- +// wide configuration file and a configuration file per user. +// The content of the configuration file is in XML format. +// The configuration base class takes care of finding the configuration +// files, e.g. in /etc/app.conf or in /usr/loca/etc/app.conf, along +// with the configuration file in the user's home directory. +// The config files are parsed with the gnome XML parser and a +// framework is provided to find configurational items. +// +// RELATIONS : +// SEE ALSO : +// LAST MODIFIED : Jul 24, 2002 +/////////////////////////////////////////////////////////////////////////// +*/ + +class configuration +{ + + xmlDocPtr system; // The system-wide config tree + xmlDocPtr user; // User-specific config tree + String app_name; // Name of the application and XML root element + + xmlNodePtr xmlFindTag(xmlNodePtr, const String); + +public: + + configuration() + { + system = NULL; + user = NULL; + app_name = "AXE"; + } + + // Find the config files and parse the XML + + bool read(const String name); + + // Return the value of a config parameter + + String find_parameter(const String section, const String parameter); + +}; + +#endif // CONFIGURATION_H diff --git a/src/cursor.h b/src/cursor.h new file mode 100644 index 0000000..8eeb33f --- /dev/null +++ b/src/cursor.h @@ -0,0 +1,79 @@ +/************************************************************************** +** (c) Copyright 1998, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : cursor.h +** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : Definition of cursor class +** +** EXPORTED OBJECTS : class cursor +** LOCAL OBJECTS : +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Feb 25, 1998 +** LAST UPDATE : Feb 25, 1998 +** MODIFICATIONS : +**************************************************************************/ + +/***************************** + $Log: cursor.h,v $ + Revision 1.1 2002-07-25 08:01:26 arjen + First checkin, AXE release 0.2 + +*****************************/ + +/* static const char *RCSID = "$Id: cursor.h,v 1.1 2002-07-25 08:01:26 arjen Exp $"; */ + +#include +#include +#include "display.h" + +/* +/////////////////////////////////////////////////////////////////////////// +// NAME : cursor +// BASECLASS : +// MEMBERS : Cursor curs +// OPERATORS : +// METHODS : +// +// DESCRIPTION : +// +// RELATIONS : +// SEE ALSO : +// LAST MODIFIED : Feb 25, 1998 +/////////////////////////////////////////////////////////////////////////// +*/ + +class cursor +{ + Cursor curs; + +public: + + cursor() + { + curs = 0; + } + + cursor(unsigned int shape) + { + curs = XCreateFontCursor(stddpy, shape); + } + + ~cursor() + { + XFreeCursor(stddpy, curs); + } + + operator Cursor() + { + return curs; + } +}; + diff --git a/src/date.cpp b/src/date.cpp new file mode 100644 index 0000000..5094fca --- /dev/null +++ b/src/date.cpp @@ -0,0 +1,323 @@ +/************************************************************************** +** (c) Copyright 1999, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : date.cpp +** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : +** +** EXPORTED OBJECTS : +** LOCAL OBJECTS : +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Feb 06, 1998 +** LAST UPDATE : Oct 16, 1999 +**************************************************************************/ + +/***************************** + $Log: date.cpp,v $ + Revision 1.1 2002-07-25 08:01:26 arjen + First checkin, AXE release 0.2 + +*****************************/ + +static const char *RCSID = "$Id: date.cpp,v 1.1 2002-07-25 08:01:26 arjen Exp $"; + +#include +#include +#include "date.h" +#include "parsedate.h" + +static unsigned short mon[] = +{ + 0, + 31, 28, 31, 30, + 31, 30, 31, 31, + 30, 31, 30, 31 +}; + +static char * abr_month_name[] = +{ + "xxx", + "Jan", "Feb", "Mar", "Apr", + "May", "Jun", "Jul", "Aug", + "Sep", "Oct", "Nov", "Dec" +}; + +date::date(String s) +{ + struct parseddate *pd; + + pd = parsedate(s); + year = pd->year; + month = pd->month; + day = pd->day; +} + +int date::Leap(void) +{ + int leap; + + leap = 0; + if (year % 4 == 0) + leap++; // leapyear + if (year % 100 == 0) + leap--; // But not every century + if (year % 400 == 0) + leap++; // except every 4th century + + return leap; +} + +unsigned date::DaysInMonth(void) +{ + unsigned days; + + if (month < 1 || month > 12) + { + days = 0; + } + else + { + days = mon[month]; + + if (month == 2 && Leap()) // Februari + { + days++; + } + } + + return days; +} + +date date::add(date D) +{ + year += D.year; + month += D.month; + while (month > 12) + { + year++; + month -= 12; + } + day += D.day; + while (day > DaysInMonth()) + { + day -= DaysInMonth(); + month++; + if (month > 12) + { + year++; + month -= 12; + } + } + + return *this; +} + +date date::add(unsigned long days) +{ + // Calculate the date days in the future + + days += day; + while (days > DaysInMonth()) + { + days -= DaysInMonth(); + month++; + if (month > 12) + { + year++; + month -= 12; + } + } + day = days; + + return *this; +} + +date date::subtract(unsigned long days) +{ + // Calculate the date days in the past + + while (days != 0) + { + if (days < day) + { + day -= days; + days = 0; + } + else + { + month--; + if (month == 0) + { + year--; + month = 12; + } + days -= day; + day = DaysInMonth(); + } + } + + return *this; +} + +date operator+(date d1, date d2) +{ + d1.add(d2); + return d1; +} + +date operator+(unsigned long l, date d) +{ + d.add(l); + return d; +} + +date operator+(date d, unsigned long l) +{ + d.add(l); + return d; +} + +date operator-(unsigned long l, date d) +{ + d.subtract(l); + return d; +} + +date operator-(date d, unsigned long l) +{ + d.subtract(l); + return d; +} + +date today() +{ + long clock; + struct tm *tp; + + time(&clock); + tp = localtime(&clock); + + return date(tp->tm_mday, tp->tm_mon+1, tp->tm_year+1900); +} + +/*========================================================================= +** NAME : date::julian +** SYNOPSIS : +** PARAMETERS : +** RETURN VALUE : +** +** DESCRIPTION : Return the number of days since the base date of the +** Julian Calendar. +** +** VARS USED : +** VARS CHANGED : +** FUNCTIONS USED : +** SEE ALSO : +** LAST MODIFIED : +** SEE ALSO : +** LAST MODIFIED : +**========================================================================= +*/ + +long date::julian(void) +{ + register long cent; + register int yr, mn, dy; + + yr = year; + mn = month; + dy = day; + + if (mn > 2) + mn -= 3; + else + { + mn += 9; + yr -= 1; + } + + cent = yr / 100; + yr %= 100; + + return (146097 * cent >> 2) + (1461 * yr >> 2) + + (153 * mn + 2) / 5 + dy + 1721119; + +} + +long operator-(date &d1, date &d2) +{ + return d1.julian() - d2.julian(); +} + +ostream &operator<<(ostream &s, const date &d) +{ + s.width(2); + s.fill('0'); + + s << int(d.day) << "-"; + s.width(2); + s.fill('0'); + s << int(d.month) << "-"; + s << d.year; + + return s; +} + +istream &operator>>(istream &s, date &d) +{ + char c; + int D, M, Y; + + s >> D >> c >> M >> c >> Y; + + d.day = D; + d.month = M; + if (Y < 100) + { + if (Y < 70) + Y += 2000; + else + Y += 1900; + } + d.year = Y; + + return s; +} + +String date::MonthName(void) +{ + if (month <= 12) + { + return String(abr_month_name[month]); + } + else + { + return String("xxx"); + } +} + +String date::format(const char *fmt) +{ + String s; + //char buf[40]; + struct tm t; + + t.tm_year = year; + t.tm_mon = month; + t.tm_mday = day; + + s = String(int(day)) + String(" ") + MonthName() + String(" ") + String(year); + //strftime(buf, 40, fmt, &t); + //s = buf; + + return s; +} + diff --git a/src/date.h b/src/date.h new file mode 100644 index 0000000..1a4f6b0 --- /dev/null +++ b/src/date.h @@ -0,0 +1,236 @@ +/************************************************************************** +** (c) Copyright 1999, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : date.h +** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : +** +** EXPORTED OBJECTS : +** LOCAL OBJECTS : +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Feb 06, 1998 +** LAST UPDATE : Oct 16, 1999 +** MODIFICATIONS : +**************************************************************************/ + +/***************************** + $Log: date.h,v $ + Revision 1.1 2002-07-25 08:01:26 arjen + First checkin, AXE release 0.2 + +*****************************/ + +/* static const char *RCSID = "$Id: date.h,v 1.1 2002-07-25 08:01:26 arjen Exp $"; */ + +#ifndef AXE_DATE_H +#define AXE_DATE_H + +#include "String.h" + +class date +{ + unsigned char month, day; + short year; + + long julian(); + date add(date D); + date add(unsigned long days); + + date subtract(unsigned long days); + +public: + + date() + { + month = 0; + day = 0; + year = 0; + } + + date(unsigned d, unsigned m=0, short y=0) + { + day = d; + month = m; + year = y; + } + + date(String s); + + friend date operator+(date, date); + friend date operator+(unsigned long, date); + friend date operator+(date, unsigned long); + + date operator += (date D) + { + return add(D); + } + + date operator += (unsigned long l) + { + return add(l); + } + + friend date operator-(unsigned long, date); + friend date operator-(date, unsigned long); + friend long operator-(date&, date&); + + date operator -= (unsigned long l) + { + return subtract(l); + } + +// long(date); // Calculate nr. of days since... + + int operator==(date d) + { + register int cm; + + cm = this->year - d.year; + cm = (cm != 0) ? cm : this->month - d.month; + cm = (cm != 0) ? cm : this->day - d.day; + + return cm == 0; + } + + int operator!=(date d) + { + register int cm; + + cm = this->year - d.year; + cm = (cm != 0) ? cm : this->month - d.month; + cm = (cm != 0) ? cm : this->day - d.day; + + return cm != 0; + } + + int operator<=(date d) + { + register int cm; + + cm = this->year - d.year; + cm = (cm != 0) ? cm : this->month - d.month; + cm = (cm != 0) ? cm : this->day - d.day; + + return cm <= 0; + } + + int operator>=(date d) + { + register int cm; + + cm = this->year - d.year; + cm = (cm != 0) ? cm : this->month - d.month; + cm = (cm != 0) ? cm : this->day - d.day; + + return cm >= 0; + } + + int operator>(date d) + { + register int cm; + + cm = this->year - d.year; + cm = (cm != 0) ? cm : this->month - d.month; + cm = (cm != 0) ? cm : this->day - d.day; + + return cm > 0; + } + + int operator<(date d) + { + register int cm; + + cm = this->year - d.year; + cm = (cm != 0) ? cm : this->month - d.month; + cm = (cm != 0) ? cm : this->day - d.day; + + return cm < 0; + } + + // Attributes. + + unsigned Day() + { + return day; + } + + unsigned Month() + { + return month; + } + + String MonthName(void); + + int Year() + { + return year; + } + // Operations. + + int Leap(void); + unsigned DaysInMonth(); + +// date operator*(double) +// date& operator*=(double) +// date operator/(double) +// date& operator/=(double) + + friend ostream& operator<<(ostream&, const date&); + friend istream& operator>>(istream&, date&); + + String format(const char *fmt = "%x"); +}; + +date today(void); + +class hour +{ + int hours; + short minutes, seconds; + +public: + + hour() + { + hours = 0; + minutes = 0; + seconds = 0; + } + + hour(int hr, short minute, short sec) + { + hours = hr; + minutes = minute; + seconds = sec; + } + + hour(String s); + + friend hour operator+(hour &, hour &); + hour operator += (hour h); + friend hour operator-(hour &, hour &); + + friend ostream& operator<<(ostream &, const hour &); +}; + +class UTC +{ + hour t; + date d; + +public: + + UTC() + { + } +}; + +#endif /* AXE_DATE_H */ diff --git a/src/datelex.c b/src/datelex.c new file mode 100644 index 0000000..d61cc67 --- /dev/null +++ b/src/datelex.c @@ -0,0 +1,329 @@ +/*$Log: datelex.c,v $ +/*Revision 1.1 2002-07-25 08:01:26 arjen +/*First checkin, AXE release 0.2 +/* + * Revision 1.1 84/09/01 15:01:14 wales + * Initial revision + * + * Copyright (c) 1984 by Richard B. Wales + * + * Purpose: + * + * Lexical analyzer for "parsedate" routine. This lexer was orig- + * inally written in LEX, but rewriting it as an ad-hoc routine + * resulted in an enormous savings in space and a significant + * increase in speed. + * + * Usage: + * + * Called as needed by the YACC parser ("dateyacc.c"). Not intended + * to be called from any other routine. + * + * Notes: + * + * Global contents: + * + * int yylex () + * Returns the token number (from the YACC grammar) of the next + * token in the input string pointed to by the global variable + * "yyinbuf". The global variable "yylval" is set to the lexi- + * cal value (if any) of the token. "yyinbuf" is set to point + * to the first character in the input string which is not a + * part of the token just recognized. + * + * Local contents: + * + * struct wordtable *find_word (word) char *word; + * Returns a pointer to the entry in the "wordtable" array cor- + * responding to the string "word". If "word" is not found, the + * returned value is NULL. + */ + +/* ajs + * ajs Code added 850314 to allow NUM991231 and NUM99991231. + * ajs All added/changed lines contain "ajs" for easy searching. + * ajs */ + +/* AJB, Aug 28 1999: Added month names in Dutch */ + +#ifdef RCSIDENT +static char rcsident[] = "$Header: /cvsroot/lib/AXE/src/datelex.c,v 1.1 2002-07-25 08:01:26 arjen Exp $"; +#endif /* RCSIDENT */ + +#include +#include "dateyacc.h" +#include "parsedate.h" + +/* pointer to the input string */ +char *yyinbuf; + +/* "answer" structure */ +struct parseddate yyans; + +/* Binary-search word table. + * Entries must be sorted in ascending order on "text" value, and the + * total number of entries must be one less than a power of 2. "Filler" + * entries (with "token" values of -1) are inserted at the beginning and + * end of the table to pad it as necessary. + */ +#define WORDTABLE_SIZE 127 /* MUST be one less than power of 2 */ +#define MAX_WORD_LENGTH 20 /* used to weed out overly long words + * in "yylex". Must be at least as long + * as the longest word in "wordtable", + * but may be longer. + */ +struct wordtable + { char *text; + int token; + int lexval; + } wordtable[WORDTABLE_SIZE] = + {/* text token lexval */ + "", -1, 0, + "", -1, 0, + "", -1, 0, + "", -1, 0, + "", -1, 0, + "", -1, 0, + "", -1, 0, + "", -1, 0, + "", -1, 0, + "", -1, 0, + "", -1, 0, + "A", STD_ZONE, 60, /* UTC+1h */ + "ACSST", DST_ZONE, 630, /* Cent. Australia */ + "ACST", STD_ZONE, 570, /* Cent. Australia */ + "ADT", DST_ZONE, -180, /* Atlantic (Canada) */ + "AESST", DST_ZONE, 660, /* E. Australia */ + "AEST", STD_ZONE, 600, /* E. Australia */ + "AM", AMPM, 0, + "APR", MONTH_NAME, 4, + "APRIL", MONTH_NAME, 4, + "AST", STD_ZONE, -240, /* Atlantic (Canada) */ + "AT", 0, 0, /* "at" (throwaway) */ + "AUG", MONTH_NAME, 8, + "AUGUST", MONTH_NAME, 8, + "AWSST", DST_ZONE, 540, /* W. Australia */ + "AWST", STD_ZONE, 480, /* W. Australia */ + "B", STD_ZONE, 120, /* UTC+2h */ + "BST", DST_ZONE, 60, /* Great Britain */ + "C", STD_ZONE, 180, /* UTC+3h */ + "CDT", DST_ZONE, -300, + "CST", STD_ZONE, -360, + "D", STD_ZONE, 240, /* UTC+4h */ + "DEC", MONTH_NAME, 12, + "DECEMBER", MONTH_NAME, 12, + "DST", DST_SUFFIX, 0, + "E", STD_ZONE, 300, /* UTC+5h */ + "EDT", DST_ZONE, -240, + "EET", STD_ZONE, 120, /* Eastern Europe */ + "EETDST", DST_ZONE, 180, /* Eastern Europe */ + "EST", STD_ZONE, -300, + "F", STD_ZONE, 360, /* UTC+6h */ + "FEB", MONTH_NAME, 2, + "FEBRUARY", MONTH_NAME, 2, + "FRI", DAY_NAME, 5, + "FRIDAY", DAY_NAME, 5, + "G", STD_ZONE, 420, /* UTC+7h */ + "GMT", STD_ZONE, 0, + "H", STD_ZONE, 480, /* UTC+8h */ + "HDT", DST_ZONE, -540, /* Hawaii/Alaska */ + "HST", STD_ZONE, -600, /* Hawaii/Alaska */ + "I", STD_ZONE, 540, /* UTC+9h */ + "IST", STD_ZONE, 120, /* Israel */ + "JAN", MONTH_NAME, 1, + "JANUARY", MONTH_NAME, 1, + "JUL", MONTH_NAME, 7, + "JULY", MONTH_NAME, 7, + "JUN", MONTH_NAME, 6, + "JUNE", MONTH_NAME, 6, + "K", STD_ZONE, 600, /* UTC+10h */ + "L", STD_ZONE, 660, /* UTC+11h */ + "M", STD_ZONE, 720, /* UTC+12h */ + "MAR", MONTH_NAME, 3, + "MARCH", MONTH_NAME, 3, + "MAY", MONTH_NAME, 5, + "MDT", DST_ZONE, -360, + "MEI", MONTH_NAME, 5, + "MET", STD_ZONE, 60, /* Central Europe */ + "METDST", DST_ZONE, 120, /* Central Europe */ + "MON", DAY_NAME, 1, + "MONDAY", DAY_NAME, 1, + "MRT", MONTH_NAME, 3, + "MST", STD_ZONE, -420, + "N", STD_ZONE, -60, /* UTC-1h */ + "NDT", DST_ZONE, -150, /* Nfld. (Canada) */ + "NOV", MONTH_NAME, 11, + "NOVEMBER", MONTH_NAME, 11, + "NST", STD_ZONE, -210, /* Nfld. (Canada) */ + "O", STD_ZONE, -120, /* UTC-2h */ + "OCT", MONTH_NAME, 10, + "OCTOBER", MONTH_NAME, 10, + "OKT", MONTH_NAME, 10, + "ON", 0, 0, /* "on" (throwaway) */ + "P", STD_ZONE, -180, /* UTC-3h */ + "PDT", DST_ZONE, -420, + "PM", AMPM, 12, + "PST", STD_ZONE, -480, + "Q", STD_ZONE, -240, /* UTC-4h */ + "R", STD_ZONE, -300, /* UTC-5h */ + "S", STD_ZONE, -360, /* UTC-6h */ + "SAT", DAY_NAME, 6, + "SATURDAY", DAY_NAME, 6, + "SEP", MONTH_NAME, 9, + "SEPT", MONTH_NAME, 9, + "SEPTEMBER", MONTH_NAME, 9, + "SUN", DAY_NAME, 0, + "SUNDAY", DAY_NAME, 0, + "T", STD_ZONE, -420, /* UTC-7h */ + "THU", DAY_NAME, 4, + "THUR", DAY_NAME, 4, + "THURS", DAY_NAME, 4, + "THURSDAY", DAY_NAME, 4, + "TUE", DAY_NAME, 2, + "TUES", DAY_NAME, 2, + "TUESDAY", DAY_NAME, 2, + "U", STD_ZONE, -480, /* UTC-8h */ + "UT", STD_ZONE, 0, + "UTC", STD_ZONE, 0, + "V", STD_ZONE, -540, /* UTC-9h */ + "W", STD_ZONE, -600, /* UTC-10h */ + "WED", DAY_NAME, 3, + "WEDNESDAY", DAY_NAME, 3, + "WEDS", DAY_NAME, 3, + "WET", STD_ZONE, 0, /* Western Europe */ + "WETDST", DST_ZONE, 60, /* Western Europe */ + "X", STD_ZONE, -660, /* UTC-11h */ + "Y", STD_ZONE, -720, /* UTC-12h */ + "YDT", DST_ZONE, -480, /* Yukon */ + "YST", STD_ZONE, -540, /* Yukon */ + "Z", STD_ZONE, 0, /* UTC */ + "\177", -1, 0, + "\177", -1, 0, + "\177", -1, 0, + "\177", -1, 0, + "\177", -1, 0, + "\177", -1, 0, + "\177", -1, 0, + "\177", -1, 0, + }; +static struct wordtable *find_word(); + +/* int yylex () + * Return the next token for the YACC parser. + */ +int +yylex () +{ static char buffer[MAX_WORD_LENGTH+1]; + register char *c, *d; + register struct wordtable *wt; + register int num, ndgts; + + restart: + /* We will return here if an invalid input token is detected. */ + c = buffer; d = yyinbuf; + + /* Skip over blanks, tabs, commas, and parentheses. */ + do { *c = *d++; } + while (*c == ' ' || *c == '\t' || *c == ',' + || *c == '(' || *c == ')'); + + /* A zero (null) byte signals the end of the input. */ + if (*c == 0) + { yyinbuf = --d; /* stay put on the null */ + return 0; + } + + /* Process a word (looking it up in "wordtable"). */ + if ((*c >= 'A' && *c <= 'Z') || (*c >= 'a' && *c <= 'z')) + { if (*c >= 'a' && *c <= 'z') *c += 'A' - 'a'; + while (c < buffer + MAX_WORD_LENGTH + && ((*d >= 'A' && *d <= 'Z') + || (*d >= 'a' && *d <= 'z'))) + { *++c = *d++; + if (*c >= 'a' && *c <= 'z') *c += 'A' - 'a'; + } + if ((*d >= 'A' && *d <= 'Z') || (*d >= 'a' && *d <= 'z')) + { /* Word is too long (over MAX_WORD_LENGTH characters). */ + do { d++; } while ((*d >= 'A' && *d <= 'Z') + || (*d >= 'a' && *d <= 'z')); + yyinbuf = d; + goto error; + } + *++c = 0; yyinbuf = d; + if ((wt = find_word (buffer)) == NULL) goto error; + if (wt->token == 0) goto restart; /* ignore this word */ + yylval.IntVal = wt->lexval; + return wt->token; + } + + /* Process a number. */ + if (*c >= '0' && *c <= '9') + { num = *c - '0'; ndgts = 1; + for (ndgts = 1; ndgts < 8 && *d >= '0' && *d <= '9'; ndgts++) /* ajs */ + num = 10*num + (*d++ - '0'); + if (*d >= '0' && *d <= '9') + { /* Number is too long (over 8 digits). */ /* ajs */ + do { d++; } while (*d >= '0' && *d <= '9'); + yyinbuf = d; + goto error; + } + yyinbuf = d; + yylval.IntVal = num; + switch (ndgts) + { case 1: return NUM9; + case 2: if (num <= 23) return NUM23; + if (num <= 59) return NUM59; + /*otherwise*/ return NUM99; + case 3: + case 4: if (num/100 <= 23 && num%100 <= 59) return NUM2359; + /*otherwise*/ return NUM9999; + case 5: + case 6: if (num/10000 <= 23 + && (num%10000)/100 <= 59 + && num%100 <= 59) + return NUM235959; + if ((((num % 10000) / 100) <= 12) /* ajs */ + && ((num % 100) <= 31)) /* ajs */ + return NUM991231; /* ajs */ + goto error; + case 8: if ((((num % 10000) / 100) <= 12) /* ajs */ + && ((num % 100) <= 31)) /* ajs */ + return NUM99991231; /* ajs */ + goto error; /* ajs */ + default: goto error; + } } + + /* Pass back the following delimiter tokens verbatim.. */ + if (*c == '-' || *c == '+' || *c == '/' || *c == ':' || *c == '.') + { yyinbuf = d; + return *c; + } + + error: + /* An unidentified character was found in the input. */ + yyinbuf = d; + if (yyans.error == NULL) yyans.error = yyinbuf; + goto restart; +} + +/* struct wordtable *find_word (word) char *word; + * Look up a word in the "wordtable" array via a binary search. + */ +static +struct wordtable * +find_word (word) + register char *word; +{ register int low, mid, high; + register int comparison; + + low = -1; + high = WORDTABLE_SIZE; + while (low+1 < high) + { mid = (low + high) / 2; + comparison = strcmp (wordtable[mid].text, word); + if (comparison == 0) return wordtable+mid; + if (comparison > 0) high = mid; + else low = mid; + } + return NULL; +} diff --git a/src/dateyacc.c b/src/dateyacc.c new file mode 100644 index 0000000..ddc9c07 --- /dev/null +++ b/src/dateyacc.c @@ -0,0 +1,1588 @@ +/* A Bison parser, made from dateyacc.y + by GNU bison 1.35. */ + +#define YYBISON 1 /* Identify Bison output. */ + +# define DAY_NAME 257 +# define MONTH_NAME 258 +# define NUM9 259 +# define NUM23 260 +# define NUM59 261 +# define NUM99 262 +# define NUM2359 263 +# define NUM9999 264 +# define NUM235959 265 +# define NUM991231 266 +# define NUM99991231 267 +# define AMPM 268 +# define STD_ZONE 269 +# define DST_ZONE 270 +# define DST_SUFFIX 271 + +#line 37 "dateyacc.y" + +#ifdef RCSIDENT +static char rcsident[] = "$Header: /cvsroot/lib/AXE/src/Attic/dateyacc.c,v 1.1 2002-07-25 08:01:26 arjen Exp $"; +#endif RCSIDENT + +#include +#include "parsedate.h" +struct parseddate yyans; + +/* No error routine is needed here. */ +#define yyerror(s) + +#line 50 "dateyacc.y" +#ifndef YYSTYPE +typedef union { + int IntVal; +} yystype; +# define YYSTYPE yystype +# define YYSTYPE_IS_TRIVIAL 1 +#endif +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif + + + +#define YYFINAL 189 +#define YYFLAG -32768 +#define YYNTBASE 23 + +/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */ +#define YYTRANSLATE(x) ((unsigned)(x) <= 271 ? yytranslate[x] : 42) + +/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */ +static const char yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 22, 2, 19, 18, 20, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 21, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 3, 4, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17 +}; + +#if YYDEBUG +static const short yyprhs[] = +{ + 0, 0, 2, 4, 6, 8, 10, 13, 17, 22, + 26, 31, 34, 38, 43, 47, 52, 54, 57, 61, + 64, 68, 71, 75, 80, 83, 87, 91, 95, 99, + 102, 106, 111, 113, 116, 120, 125, 128, 132, 136, + 140, 144, 147, 151, 156, 158, 161, 165, 168, 172, + 176, 181, 186, 190, 195, 200, 202, 204, 208, 212, + 217, 219, 221, 224, 227, 231, 237, 241, 244, 248, + 254, 258, 260, 262, 264, 267, 270, 273, 277, 281, + 285, 289, 293, 295, 297, 299, 301, 303, 305, 308, + 310, 313, 316, 320, 322, 324, 328, 332, 338, 344, + 348, 352, 358, 364, 368, 372, 374, 376, 378, 381, + 384, 388, 390, 393, 396, 400, 403, 407, 409, 413, + 417, 419, 423, 427, 429 +}; +static const short yyrhs[] = +{ + 6, 0, 7, 0, 5, 0, 23, 0, 30, 0, + 30, 26, 0, 30, 26, 35, 0, 30, 26, 35, + 33, 0, 30, 26, 33, 0, 30, 26, 33, 35, + 0, 30, 35, 0, 30, 35, 26, 0, 30, 35, + 26, 33, 0, 30, 35, 33, 0, 30, 35, 33, + 26, 0, 27, 0, 27, 26, 0, 27, 26, 35, + 0, 27, 35, 0, 27, 35, 26, 0, 26, 30, + 0, 26, 30, 35, 0, 26, 30, 35, 33, 0, + 26, 27, 0, 26, 27, 35, 0, 26, 35, 30, + 0, 26, 35, 27, 0, 26, 35, 28, 0, 26, + 28, 0, 26, 28, 35, 0, 26, 33, 35, 30, + 0, 35, 0, 35, 30, 0, 35, 30, 26, 0, + 35, 30, 26, 33, 0, 35, 27, 0, 35, 27, + 26, 0, 35, 26, 30, 0, 35, 26, 27, 0, + 35, 26, 28, 0, 35, 28, 0, 35, 28, 26, + 0, 35, 33, 26, 30, 0, 28, 0, 28, 26, + 0, 28, 26, 35, 0, 28, 35, 0, 28, 35, + 26, 0, 33, 26, 30, 0, 33, 26, 30, 35, + 0, 33, 26, 35, 30, 0, 33, 35, 30, 0, + 33, 35, 30, 26, 0, 33, 35, 26, 30, 0, + 9, 0, 26, 0, 29, 18, 41, 0, 29, 18, + 35, 0, 29, 18, 35, 26, 0, 1, 0, 3, + 0, 3, 18, 0, 30, 33, 0, 31, 19, 33, + 0, 24, 19, 24, 19, 33, 0, 32, 20, 33, + 0, 33, 30, 0, 33, 19, 31, 0, 33, 19, + 24, 19, 24, 0, 33, 20, 32, 0, 29, 0, + 12, 0, 13, 0, 24, 34, 0, 34, 24, 0, + 24, 24, 0, 24, 19, 34, 0, 34, 19, 24, + 0, 24, 20, 34, 0, 34, 20, 24, 0, 24, + 20, 24, 0, 7, 0, 6, 0, 8, 0, 9, + 0, 10, 0, 4, 0, 4, 18, 0, 37, 0, + 36, 38, 0, 36, 39, 0, 36, 38, 39, 0, + 9, 0, 37, 0, 5, 21, 23, 0, 5, 18, + 23, 0, 5, 21, 23, 21, 23, 0, 5, 18, + 23, 18, 23, 0, 6, 21, 23, 0, 6, 18, + 23, 0, 6, 21, 23, 21, 23, 0, 6, 18, + 23, 18, 23, 0, 9, 21, 23, 0, 9, 18, + 23, 0, 11, 0, 14, 0, 15, 0, 15, 17, + 0, 19, 15, 0, 19, 15, 17, 0, 16, 0, + 19, 16, 0, 22, 40, 0, 19, 22, 40, 0, + 19, 40, 0, 19, 19, 40, 0, 5, 0, 5, + 21, 23, 0, 5, 18, 23, 0, 6, 0, 6, + 21, 23, 0, 6, 18, 23, 0, 9, 0, 9, + 0 +}; + +#endif + +#if YYDEBUG +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const short yyrline[] = +{ + 0, 72, 74, 77, 79, 82, 84, 85, 86, 87, + 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, + 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, + 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, + 128, 129, 130, 131, 132, 133, 138, 139, 140, 141, + 142, 148, 151, 155, 157, 158, 160, 163, 165, 166, + 168, 169, 172, 179, 186, 189, 191, 195, 198, 202, + 205, 207, 211, 214, 216, 218, 220, 224, 227, 231, + 233, 234, 235, 238, 244, 247, 253, 258, 263, 268, + 273, 278, 283, 288, 293, 298, 305, 315, 318, 320, + 322, 324, 326, 328, 330, 332, 334, 338, 341, 343, + 345, 347, 349, 351, 355 +}; +#endif + + +#if (YYDEBUG) || defined YYERROR_VERBOSE + +/* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */ +static const char *const yytname[] = +{ + "$", "error", "$undefined.", "DAY_NAME", "MONTH_NAME", "NUM9", "NUM23", + "NUM59", "NUM99", "NUM2359", "NUM9999", "NUM235959", "NUM991231", + "NUM99991231", "AMPM", "STD_ZONE", "DST_ZONE", "DST_SUFFIX", "'.'", + "'-'", "'/'", "':'", "'+'", "num59", "num", "goal", "dayname", + "date.year", "year.date", "yymmdd", "date", "hyphen.date", "slash.date", + "year", "month.name", "time", "hour", "hour.alone", "am.pm", "zone", + "zone.offset", "time2359", 0 +}; +#endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const short yyr1[] = +{ + 0, 23, 23, 24, 24, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 26, 26, 27, 27, 27, 27, 28, 28, 28, + 28, 28, 29, 29, 30, 30, 30, 31, 31, 32, + 32, 32, 33, 33, 33, 33, 33, 34, 34, 35, + 35, 35, 35, 36, 36, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 38, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 40, 40, 40, + 40, 40, 40, 40, 41 +}; + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const short yyr2[] = +{ + 0, 1, 1, 1, 1, 1, 2, 3, 4, 3, + 4, 2, 3, 4, 3, 4, 1, 2, 3, 2, + 3, 2, 3, 4, 2, 3, 3, 3, 3, 2, + 3, 4, 1, 2, 3, 4, 2, 3, 3, 3, + 3, 2, 3, 4, 1, 2, 3, 2, 3, 3, + 4, 4, 3, 4, 4, 1, 1, 3, 3, 4, + 1, 1, 2, 2, 3, 5, 3, 2, 3, 5, + 3, 1, 1, 1, 2, 2, 2, 3, 3, 3, + 3, 3, 1, 1, 1, 1, 1, 1, 2, 1, + 2, 2, 3, 1, 1, 3, 3, 5, 5, 3, + 3, 5, 5, 3, 3, 1, 1, 1, 2, 2, + 3, 1, 2, 2, 3, 2, 3, 1, 3, 3, + 1, 3, 3, 1, 1 +}; + +/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE + doesn't specify something else to do. Zero means the default is an + error. */ +static const short yydefact[] = +{ + 0, 60, 61, 87, 3, 1, 2, 84, 85, 86, + 105, 72, 73, 4, 0, 56, 16, 44, 71, 5, + 0, 0, 0, 0, 32, 0, 89, 62, 88, 0, + 0, 0, 0, 0, 0, 3, 1, 2, 0, 0, + 76, 74, 85, 24, 29, 71, 21, 0, 0, 0, + 0, 93, 17, 19, 45, 47, 0, 83, 82, 6, + 63, 11, 0, 0, 1, 0, 0, 0, 0, 67, + 0, 0, 0, 0, 75, 1, 85, 0, 36, 41, + 33, 0, 106, 107, 111, 0, 0, 90, 91, 96, + 95, 100, 99, 104, 103, 0, 77, 81, 79, 25, + 30, 22, 0, 27, 28, 26, 0, 18, 20, 46, + 48, 93, 58, 57, 9, 7, 83, 12, 14, 64, + 66, 0, 68, 0, 0, 70, 0, 49, 0, 0, + 52, 78, 80, 39, 40, 38, 37, 42, 34, 0, + 108, 117, 120, 123, 109, 112, 0, 0, 115, 113, + 92, 0, 0, 0, 0, 0, 23, 31, 59, 10, + 8, 13, 15, 0, 50, 51, 54, 53, 35, 43, + 0, 0, 0, 0, 110, 116, 114, 98, 97, 102, + 101, 65, 69, 119, 118, 122, 121, 0, 0, 0 +}; + +static const short yydefgoto[] = +{ + 13, 67, 187, 15, 16, 17, 45, 69, 20, 21, + 60, 70, 24, 25, 26, 87, 88, 148, 113 +}; + +static const short yypact[] = +{ + 255,-32768, -6, 16, 14, 22, 46,-32768, 84,-32768, + -32768,-32768,-32768,-32768, 231, 276, 307, 307, 18, 298, + -3, 36, 148, -2, 266, 305, 314,-32768,-32768, 40, + 40, 40, 40, 40, 40,-32768,-32768,-32768, 370, 370, + -32768,-32768, 102, 238, 238,-32768, 345, 207, 287, 14, + 24, 83, 238, 55, 238, 55, 352, 24,-32768, 345, + -32768, 331, 358, 358, 24, 370, 370, 370, 338,-32768, + 218, 366, 218, 218,-32768, 57,-32768, 287, 55, 55, + 331, 90,-32768, 47,-32768, 183, 156, 92,-32768, 51, + 50, 58, 54,-32768,-32768, 62,-32768,-32768,-32768,-32768, + -32768, 358, 370,-32768,-32768, 358, 235,-32768,-32768,-32768, + -32768, 1, 55,-32768, 238, 358,-32768, 358, 55,-32768, + -32768, 67,-32768, 72, 93,-32768, 105, 238, 370, 370, + 55,-32768,-32768,-32768,-32768, 358,-32768,-32768, 358, 370, + -32768, 101, 118,-32768, 109,-32768, 156, 156,-32768,-32768, + -32768, 40, 40, 40, 40, 358,-32768,-32768,-32768,-32768, + -32768,-32768,-32768, 370,-32768,-32768,-32768,-32768,-32768,-32768, + 40, 40, 40, 40,-32768,-32768,-32768,-32768,-32768,-32768, + -32768,-32768,-32768,-32768,-32768,-32768,-32768, 134, 137,-32768 +}; + +static const short yypgoto[] = +{ + -23, 0,-32768, 116, 5, 6, 142, 44, 79, 94, + 26, 13, 163,-32768,-32768,-32768, 69, -84,-32768 +}; + + +#define YYLAST 377 + + +static const short yytable[] = +{ + 14, -124, 149, 35, 36, 37, 89, 90, 91, 92, + 93, 94, 27, 23, 40, 14, 62, 72, 73, 33, + 43, 44, 34, 74, 14, -83, 22, 41, 23, 78, + 79, -83, 29, -83, 28, 30, 56, 23, 95, 97, + 31, 47, 31, 32, 19, 32, 36, 37, 14, -82, + 81, 96, 98, 103, 104, -82, 63, -82, 2, 46, + -83, 23, 175, 176, 140, 121, 124, 40, 80, 151, + 74, 152, 131, 132, 106, 154, 153, 14, 123, 126, + 41, 155, 133, 134, -55, 114, 163, 118, 119, 120, + 23, 72, 105, 2, 3, 35, 36, 37, -93, -93, + -93, 33, 33, 106, 34, 34, -93, 83, 84, 65, + 66, 85, 127, 39, 86, 130, -93, -93, -93, 170, + 33, 135, 171, 34, -93, 73, 174, 156, 177, 178, + 179, 180, 52, 54, 188, 59, 172, 189, 68, 173, + 77, 160, 18, 161, 122, 0, 157, 183, 184, 185, + 186, 2, 3, 4, 64, 37, 150, 51, 0, 10, + 125, 141, 142, 182, 168, 143, 0, 65, 66, 108, + 0, 110, 165, 166, 0, 0, 96, 117, 48, 53, + 55, 181, 61, 169, 0, 71, 0, 129, 141, 142, + 0, 0, 143, 0, 136, 137, 138, 139, 144, 145, + 0, 0, 146, 0, 0, 147, 99, 100, 0, 101, + 102, 3, 4, 64, 37, 107, 51, 109, 10, 112, + 0, 0, 115, 35, 36, 37, 65, 66, 158, 0, + 0, 128, 0, 0, 162, 3, 35, 36, 37, 3, + 35, 36, 37, 49, 50, 0, 167, 51, 0, 10, + 38, 39, 0, 0, 65, 66, 1, 0, 2, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 2, + 3, 35, 75, 6, 7, 76, 9, 159, 11, 12, + 3, 4, 5, 6, 7, 42, 9, 10, 11, 12, + 164, 3, 35, 75, 6, 7, 76, 9, 0, 11, + 12, 2, 0, 49, 57, 58, 7, 42, 9, 10, + 2, 0, 49, 50, 0, 0, 51, 0, 10, 82, + 83, 84, 0, 0, 85, 0, 0, 86, -94, -94, + -94, 0, 0, -94, 2, 0, -94, 116, 58, 7, + 76, 9, 3, 4, 64, 37, 0, 51, 0, 10, + 49, 57, 58, 7, 42, 9, 10, 49, 50, 0, + 0, 111, 0, 10, 116, 58, 7, 76, 9, 2, + 3, 35, 36, 37, 3, 35, 36, 37 +}; + +static const short yycheck[] = +{ + 0, 0, 86, 5, 6, 7, 29, 30, 31, 32, + 33, 34, 18, 0, 14, 15, 19, 19, 20, 18, + 15, 15, 21, 23, 24, 3, 0, 14, 15, 24, + 24, 9, 18, 11, 18, 21, 18, 24, 38, 39, + 18, 15, 18, 21, 0, 21, 6, 7, 48, 3, + 24, 38, 39, 48, 48, 9, 20, 11, 3, 15, + 3, 48, 146, 147, 17, 65, 66, 67, 24, 18, + 70, 21, 72, 73, 48, 21, 18, 77, 65, 66, + 67, 19, 77, 77, 0, 59, 19, 61, 62, 63, + 77, 19, 48, 3, 4, 5, 6, 7, 14, 15, + 16, 18, 18, 77, 21, 21, 22, 15, 16, 19, + 20, 19, 68, 20, 22, 71, 14, 15, 16, 18, + 18, 77, 21, 21, 22, 20, 17, 101, 151, 152, + 153, 154, 16, 17, 0, 19, 18, 0, 22, 21, + 24, 115, 0, 117, 65, -1, 102, 170, 171, 172, + 173, 3, 4, 5, 6, 7, 87, 9, -1, 11, + 66, 5, 6, 163, 138, 9, -1, 19, 20, 53, + -1, 55, 128, 129, -1, -1, 163, 61, 15, 16, + 17, 155, 19, 139, -1, 22, -1, 71, 5, 6, + -1, -1, 9, -1, 78, 79, 80, 81, 15, 16, + -1, -1, 19, -1, -1, 22, 43, 44, -1, 46, + 47, 4, 5, 6, 7, 52, 9, 54, 11, 56, + -1, -1, 59, 5, 6, 7, 19, 20, 112, -1, + -1, 68, -1, -1, 118, 4, 5, 6, 7, 4, + 5, 6, 7, 5, 6, -1, 130, 9, -1, 11, + 19, 20, -1, -1, 19, 20, 1, -1, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 3, + 4, 5, 6, 7, 8, 9, 10, 114, 12, 13, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 127, 4, 5, 6, 7, 8, 9, 10, -1, 12, + 13, 3, -1, 5, 6, 7, 8, 9, 10, 11, + 3, -1, 5, 6, -1, -1, 9, -1, 11, 14, + 15, 16, -1, -1, 19, -1, -1, 22, 14, 15, + 16, -1, -1, 19, 3, -1, 22, 6, 7, 8, + 9, 10, 4, 5, 6, 7, -1, 9, -1, 11, + 5, 6, 7, 8, 9, 10, 11, 5, 6, -1, + -1, 9, -1, 11, 6, 7, 8, 9, 10, 3, + 4, 5, 6, 7, 4, 5, 6, 7 +}; +/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ +#line 3 "/usr/share/bison/bison.simple" + +/* Skeleton output parser for bison, + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software + Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ + +/* This is the parser code that is written into each bison parser when + the %semantic_parser declaration is not specified in the grammar. + It was written by Richard Stallman by simplifying the hairy parser + used when %semantic_parser is specified. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +#if ! defined (yyoverflow) || defined (YYERROR_VERBOSE) + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# if YYSTACK_USE_ALLOCA +# define YYSTACK_ALLOC alloca +# else +# ifndef YYSTACK_USE_ALLOCA +# if defined (alloca) || defined (_ALLOCA_H) +# define YYSTACK_ALLOC alloca +# else +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) +# else +# if defined (__STDC__) || defined (__cplusplus) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# endif +# define YYSTACK_ALLOC malloc +# define YYSTACK_FREE free +# endif +#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */ + + +#if (! defined (yyoverflow) \ + && (! defined (__cplusplus) \ + || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + short yyss; + YYSTYPE yyvs; +# if YYLSP_NEEDED + YYLTYPE yyls; +# endif +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# if YYLSP_NEEDED +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ + + 2 * YYSTACK_GAP_MAX) +# else +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAX) +# endif + +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + register YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (0) +# endif +# endif + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack, Stack, yysize); \ + Stack = &yyptr->Stack; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) + +#endif + + +#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) +# define YYSIZE_T __SIZE_TYPE__ +#endif +#if ! defined (YYSIZE_T) && defined (size_t) +# define YYSIZE_T size_t +#endif +#if ! defined (YYSIZE_T) +# if defined (__STDC__) || defined (__cplusplus) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# endif +#endif +#if ! defined (YYSIZE_T) +# define YYSIZE_T unsigned int +#endif + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY -2 +#define YYEOF 0 +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrlab1 +/* Like YYERROR except do call yyerror. This remains here temporarily + to ease the transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ +#define YYFAIL goto yyerrlab +#define YYRECOVERING() (!!yyerrstatus) +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + yychar1 = YYTRANSLATE (yychar); \ + YYPOPSTACK; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror ("syntax error: cannot back up"); \ + YYERROR; \ + } \ +while (0) + +#define YYTERROR 1 +#define YYERRCODE 256 + + +/* YYLLOC_DEFAULT -- Compute the default location (before the actions + are run). + + When YYLLOC_DEFAULT is run, CURRENT is set the location of the + first token. By default, to implement support for ranges, extend + its range to the last symbol. */ + +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + Current.last_line = Rhs[N].last_line; \ + Current.last_column = Rhs[N].last_column; +#endif + + +/* YYLEX -- calling `yylex' with the right arguments. */ + +#if YYPURE +# if YYLSP_NEEDED +# ifdef YYLEX_PARAM +# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) +# else +# define YYLEX yylex (&yylval, &yylloc) +# endif +# else /* !YYLSP_NEEDED */ +# ifdef YYLEX_PARAM +# define YYLEX yylex (&yylval, YYLEX_PARAM) +# else +# define YYLEX yylex (&yylval) +# endif +# endif /* !YYLSP_NEEDED */ +#else /* !YYPURE */ +# define YYLEX yylex () +#endif /* !YYPURE */ + + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +#endif /* !YYDEBUG */ + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#if YYMAXDEPTH == 0 +# undef YYMAXDEPTH +#endif + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + +#ifdef YYERROR_VERBOSE + +# ifndef yystrlen +# if defined (__GLIBC__) && defined (_STRING_H) +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +static YYSIZE_T +# if defined (__STDC__) || defined (__cplusplus) +yystrlen (const char *yystr) +# else +yystrlen (yystr) + const char *yystr; +# endif +{ + register const char *yys = yystr; + + while (*yys++ != '\0') + continue; + + return yys - yystr - 1; +} +# endif +# endif + +# ifndef yystpcpy +# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +static char * +# if defined (__STDC__) || defined (__cplusplus) +yystpcpy (char *yydest, const char *yysrc) +# else +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +# endif +{ + register char *yyd = yydest; + register const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif +#endif + +#line 315 "/usr/share/bison/bison.simple" + + +/* The user can define YYPARSE_PARAM as the name of an argument to be passed + into yyparse. The argument should have type void *. + It should actually point to an object. + Grammar actions can access the variable by casting it + to the proper pointer type. */ + +#ifdef YYPARSE_PARAM +# if defined (__STDC__) || defined (__cplusplus) +# define YYPARSE_PARAM_ARG void *YYPARSE_PARAM +# define YYPARSE_PARAM_DECL +# else +# define YYPARSE_PARAM_ARG YYPARSE_PARAM +# define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; +# endif +#else /* !YYPARSE_PARAM */ +# define YYPARSE_PARAM_ARG +# define YYPARSE_PARAM_DECL +#endif /* !YYPARSE_PARAM */ + +/* Prevent warning if -Wstrict-prototypes. */ +#ifdef __GNUC__ +# ifdef YYPARSE_PARAM +int yyparse (void *); +# else +int yyparse (void); +# endif +#endif + +/* YY_DECL_VARIABLES -- depending whether we use a pure parser, + variables are global, or local to YYPARSE. */ + +#define YY_DECL_NON_LSP_VARIABLES \ +/* The lookahead symbol. */ \ +int yychar; \ + \ +/* The semantic value of the lookahead symbol. */ \ +YYSTYPE yylval; \ + \ +/* Number of parse errors so far. */ \ +int yynerrs; + +#if YYLSP_NEEDED +# define YY_DECL_VARIABLES \ +YY_DECL_NON_LSP_VARIABLES \ + \ +/* Location data for the lookahead symbol. */ \ +YYLTYPE yylloc; +#else +# define YY_DECL_VARIABLES \ +YY_DECL_NON_LSP_VARIABLES +#endif + + +/* If nonreentrant, generate the variables here. */ + +#if !YYPURE +YY_DECL_VARIABLES +#endif /* !YYPURE */ + +int +yyparse (YYPARSE_PARAM_ARG) + YYPARSE_PARAM_DECL +{ + /* If reentrant, generate the variables here. */ +#if YYPURE + YY_DECL_VARIABLES +#endif /* !YYPURE */ + + register int yystate; + register int yyn; + int yyresult; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + /* Lookahead token as an internal (translated) token number. */ + int yychar1 = 0; + + /* Three stacks and their tools: + `yyss': related to states, + `yyvs': related to semantic values, + `yyls': related to locations. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + short yyssa[YYINITDEPTH]; + short *yyss = yyssa; + register short *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; + register YYSTYPE *yyvsp; + +#if YYLSP_NEEDED + /* The location stack. */ + YYLTYPE yylsa[YYINITDEPTH]; + YYLTYPE *yyls = yylsa; + YYLTYPE *yylsp; +#endif + +#if YYLSP_NEEDED +# define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) +#else +# define YYPOPSTACK (yyvsp--, yyssp--) +#endif + + YYSIZE_T yystacksize = YYINITDEPTH; + + + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; +#if YYLSP_NEEDED + YYLTYPE yyloc; +#endif + + /* When reducing, the number of symbols on the RHS of the reduced + rule. */ + int yylen; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + + yyssp = yyss; + yyvsp = yyvs; +#if YYLSP_NEEDED + yylsp = yyls; +#endif + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. so pushing a state here evens the stacks. + */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyssp >= yyss + yystacksize - 1) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + short *yyss1 = yyss; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. */ +# if YYLSP_NEEDED + YYLTYPE *yyls1 = yyls; + /* This used to be a conditional around just the two extra args, + but that might be undefined if yyoverflow is a macro. */ + yyoverflow ("parser stack overflow", + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yyls1, yysize * sizeof (*yylsp), + &yystacksize); + yyls = yyls1; +# else + yyoverflow ("parser stack overflow", + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); +# endif + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyoverflowlab; +# else + /* Extend the stack our own way. */ + if (yystacksize >= YYMAXDEPTH) + goto yyoverflowlab; + yystacksize *= 2; + if (yystacksize > YYMAXDEPTH) + yystacksize = YYMAXDEPTH; + + { + short *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyoverflowlab; + YYSTACK_RELOCATE (yyss); + YYSTACK_RELOCATE (yyvs); +# if YYLSP_NEEDED + YYSTACK_RELOCATE (yyls); +# endif +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; +#if YYLSP_NEEDED + yylsp = yyls + yysize - 1; +#endif + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyssp >= yyss + yystacksize - 1) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + goto yybackup; + + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + +/* Do appropriate processing given the current state. */ +/* Read a lookahead token if we need one and don't already have one. */ +/* yyresume: */ + + /* First try to decide what to do without reference to lookahead token. */ + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* yychar is either YYEMPTY or YYEOF + or a valid token in external form. */ + + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; + } + + /* Convert token to internal form (in yychar1) for indexing tables with */ + + if (yychar <= 0) /* This means end of input. */ + { + yychar1 = 0; + yychar = YYEOF; /* Don't call YYLEX any more */ + + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yychar1 = YYTRANSLATE (yychar); + +#if YYDEBUG + /* We have to keep this `#if YYDEBUG', since we use variables + which are defined only if `YYDEBUG' is set. */ + if (yydebug) + { + YYFPRINTF (stderr, "Next token is %d (%s", + yychar, yytname[yychar1]); + /* Give the individual parser a way to print the precise + meaning of a token, for further debugging info. */ +# ifdef YYPRINT + YYPRINT (stderr, yychar, yylval); +# endif + YYFPRINTF (stderr, ")\n"); + } +#endif + } + + yyn += yychar1; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) + goto yydefault; + + yyn = yytable[yyn]; + + /* yyn is what to do for this token type in this state. + Negative => reduce, -yyn is rule number. + Positive => shift, yyn is new state. + New state is final state => don't bother to shift, + just return success. + 0, or most negative number => error. */ + + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrlab; + + if (yyn == YYFINAL) + YYACCEPT; + + /* Shift the lookahead token. */ + YYDPRINTF ((stderr, "Shifting token %d (%s), ", + yychar, yytname[yychar1])); + + /* Discard the token being shifted unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; + + *++yyvsp = yylval; +#if YYLSP_NEEDED + *++yylsp = yylloc; +#endif + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + yystate = yyn; + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. + + Otherwise, the following line sets YYVAL to the semantic value of + the lookahead token. This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + +#if YYLSP_NEEDED + /* Similarly for the default location. Let the user run additional + commands if for instance locations are ranges. */ + yyloc = yylsp[1-yylen]; + YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); +#endif + +#if YYDEBUG + /* We have to keep this `#if YYDEBUG', since we use variables which + are defined only if `YYDEBUG' is set. */ + if (yydebug) + { + int yyi; + + YYFPRINTF (stderr, "Reducing via rule %d (line %d), ", + yyn, yyrline[yyn]); + + /* Print the symbols being reduced, and their result. */ + for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++) + YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); + YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]); + } +#endif + + switch (yyn) { + +case 55: +#line 134 "dateyacc.y" +{ yyans.hour = yyvsp[0].IntVal / 100; + yyans.minute = yyvsp[0].IntVal % 100; + yyans.second = -1; /* unspecified */ + ; + break;} +case 60: +#line 143 "dateyacc.y" +{ extern char *yyinbuf; + if (yyans.error == NULL) yyans.error = yyinbuf; + ; + break;} +case 61: +#line 150 "dateyacc.y" +{ yyans.c_weekday = yyvsp[0].IntVal; ; + break;} +case 62: +#line 152 "dateyacc.y" +{ yyans.c_weekday = yyvsp[-1].IntVal; ; + break;} +case 65: +#line 159 "dateyacc.y" +{ yyans.day = yyvsp[-4].IntVal; yyans.month = yyvsp[-2].IntVal; ; + break;} +case 69: +#line 167 "dateyacc.y" +{ yyans.day = yyvsp[0].IntVal; yyans.month = yyvsp[-2].IntVal; ; + break;} +case 72: +#line 174 "dateyacc.y" +{ yyans.year = (yyvsp[0].IntVal / 10000) + 1900; /* ajs */ + yyans.month = (yyvsp[0].IntVal % 10000) / 100; /* ajs */ + yyans.day = (yyvsp[0].IntVal % 100); /* ajs */ + ; + break;} +case 73: +#line 180 "dateyacc.y" +{ yyans.year = (yyvsp[0].IntVal / 10000); /* ajs */ + yyans.month = (yyvsp[0].IntVal % 10000) / 100; /* ajs */ + yyans.day = (yyvsp[0].IntVal % 100); /* ajs */ + ; + break;} +case 74: +#line 188 "dateyacc.y" +{ yyans.day = yyvsp[-1].IntVal; ; + break;} +case 75: +#line 190 "dateyacc.y" +{ yyans.day = yyvsp[0].IntVal; ; + break;} +case 76: +#line 192 "dateyacc.y" +{ yyans.month = yyvsp[-1].IntVal; yyans.day = yyvsp[0].IntVal; ; + break;} +case 77: +#line 197 "dateyacc.y" +{ yyans.day = yyvsp[-2].IntVal; ; + break;} +case 78: +#line 199 "dateyacc.y" +{ yyans.day = yyvsp[0].IntVal; ; + break;} +case 79: +#line 204 "dateyacc.y" +{ yyans.day = yyvsp[-2].IntVal; ; + break;} +case 80: +#line 206 "dateyacc.y" +{ yyans.day = yyvsp[0].IntVal; ; + break;} +case 81: +#line 208 "dateyacc.y" +{ yyans.month = yyvsp[-2].IntVal; yyans.day = yyvsp[0].IntVal; ; + break;} +case 82: +#line 213 "dateyacc.y" +{ yyans.year = 2000 + yyvsp[0].IntVal; ; + break;} +case 83: +#line 215 "dateyacc.y" +{ yyans.year = 2000 + yyvsp[0].IntVal; ; + break;} +case 84: +#line 217 "dateyacc.y" +{ yyans.year = 1900 + yyvsp[0].IntVal; ; + break;} +case 85: +#line 219 "dateyacc.y" +{ yyans.year = yyvsp[0].IntVal; ; + break;} +case 86: +#line 221 "dateyacc.y" +{ yyans.year = yyvsp[0].IntVal; ; + break;} +case 87: +#line 226 "dateyacc.y" +{ yyans.month = yyvsp[0].IntVal; ; + break;} +case 88: +#line 228 "dateyacc.y" +{ yyans.month = yyvsp[-1].IntVal; ; + break;} +case 93: +#line 240 "dateyacc.y" +{ yyans.hour = yyvsp[0].IntVal / 100; + yyans.minute = yyvsp[0].IntVal % 100; + yyans.second = -1; /* unspecified */ + ; + break;} +case 95: +#line 249 "dateyacc.y" +{ yyans.hour = yyvsp[-2].IntVal; + yyans.minute = yyvsp[0].IntVal; + yyans.second = -1; /* unspecified */ + ; + break;} +case 96: +#line 254 "dateyacc.y" +{ yyans.hour = yyvsp[-2].IntVal; + yyans.minute = yyvsp[0].IntVal; + yyans.second = -1; /* unspecified */ + ; + break;} +case 97: +#line 259 "dateyacc.y" +{ yyans.hour = yyvsp[-4].IntVal; + yyans.minute = yyvsp[-2].IntVal; + yyans.second = yyvsp[0].IntVal; + ; + break;} +case 98: +#line 264 "dateyacc.y" +{ yyans.hour = yyvsp[-4].IntVal; + yyans.minute = yyvsp[-2].IntVal; + yyans.second = yyvsp[0].IntVal; + ; + break;} +case 99: +#line 269 "dateyacc.y" +{ yyans.hour = yyvsp[-2].IntVal; + yyans.minute = yyvsp[0].IntVal; + yyans.second = -1; /* unspecified */ + ; + break;} +case 100: +#line 274 "dateyacc.y" +{ yyans.hour = yyvsp[-2].IntVal; + yyans.minute = yyvsp[0].IntVal; + yyans.second = -1; /* unspecified */ + ; + break;} +case 101: +#line 279 "dateyacc.y" +{ yyans.hour = yyvsp[-4].IntVal; + yyans.minute = yyvsp[-2].IntVal; + yyans.second = yyvsp[0].IntVal; + ; + break;} +case 102: +#line 284 "dateyacc.y" +{ yyans.hour = yyvsp[-4].IntVal; + yyans.minute = yyvsp[-2].IntVal; + yyans.second = yyvsp[0].IntVal; + ; + break;} +case 103: +#line 289 "dateyacc.y" +{ yyans.hour = yyvsp[-2].IntVal / 100; + yyans.minute = yyvsp[-2].IntVal % 100; + yyans.second = yyvsp[0].IntVal; + ; + break;} +case 104: +#line 294 "dateyacc.y" +{ yyans.hour = yyvsp[-2].IntVal / 100; + yyans.minute = yyvsp[-2].IntVal % 100; + yyans.second = yyvsp[0].IntVal; + ; + break;} +case 105: +#line 299 "dateyacc.y" +{ yyans.hour = yyvsp[0].IntVal / 10000; + yyans.minute = (yyvsp[0].IntVal % 10000) / 100; + yyans.second = yyvsp[0].IntVal % 100; + ; + break;} +case 106: +#line 307 "dateyacc.y" +{ if (yyans.hour < 1 || yyans.hour > 12) + yyans.hour = -1; /* invalid */ + else + { if (yyans.hour == 12) yyans.hour = 0; + yyans.hour += yyvsp[0].IntVal; /* 0 for AM, 12 for PM */ + } ; + break;} +case 107: +#line 317 "dateyacc.y" +{ yyans.zone = yyvsp[0].IntVal; yyans.dst = 0; ; + break;} +case 108: +#line 319 "dateyacc.y" +{ yyans.zone = yyvsp[-1].IntVal + 60; yyans.dst = 1; ; + break;} +case 109: +#line 321 "dateyacc.y" +{ yyans.zone = yyvsp[0].IntVal; yyans.dst = 0; ; + break;} +case 110: +#line 323 "dateyacc.y" +{ yyans.zone = yyvsp[-1].IntVal + 60; yyans.dst = 1; ; + break;} +case 111: +#line 325 "dateyacc.y" +{ yyans.zone = yyvsp[0].IntVal; yyans.dst = 1; ; + break;} +case 112: +#line 327 "dateyacc.y" +{ yyans.zone = yyvsp[0].IntVal; yyans.dst = 1; ; + break;} +case 113: +#line 329 "dateyacc.y" +{ yyans.zone = yyvsp[0].IntVal; yyans.dst = 0; ; + break;} +case 114: +#line 331 "dateyacc.y" +{ yyans.zone = yyvsp[0].IntVal; yyans.dst = 0; ; + break;} +case 115: +#line 333 "dateyacc.y" +{ yyans.zone = - yyvsp[0].IntVal; yyans.dst = 0; ; + break;} +case 116: +#line 335 "dateyacc.y" +{ yyans.zone = - yyvsp[0].IntVal; yyans.dst = 0; ; + break;} +case 117: +#line 340 "dateyacc.y" +{ yyval.IntVal = 60 * yyvsp[0].IntVal; ; + break;} +case 118: +#line 342 "dateyacc.y" +{ yyval.IntVal = 60 * yyvsp[-2].IntVal + yyvsp[0].IntVal; ; + break;} +case 119: +#line 344 "dateyacc.y" +{ yyval.IntVal = 60 * yyvsp[-2].IntVal + yyvsp[0].IntVal; ; + break;} +case 120: +#line 346 "dateyacc.y" +{ yyval.IntVal = 60 * yyvsp[0].IntVal; ; + break;} +case 121: +#line 348 "dateyacc.y" +{ yyval.IntVal = 60 * yyvsp[-2].IntVal + yyvsp[0].IntVal; ; + break;} +case 122: +#line 350 "dateyacc.y" +{ yyval.IntVal = 60 * yyvsp[-2].IntVal + yyvsp[0].IntVal; ; + break;} +case 123: +#line 352 "dateyacc.y" +{ yyval.IntVal = 60 * (yyvsp[0].IntVal / 100) | (yyvsp[0].IntVal % 100); ; + break;} +case 124: +#line 357 "dateyacc.y" +{ yyans.hour = yyvsp[0].IntVal / 100; /* ajs */ + yyans.minute = yyvsp[0].IntVal % 100; /* ajs */ + yyans.second = -1; /* ajs */ + ; + break;} +} + +#line 705 "/usr/share/bison/bison.simple" + + + yyvsp -= yylen; + yyssp -= yylen; +#if YYLSP_NEEDED + yylsp -= yylen; +#endif + +#if YYDEBUG + if (yydebug) + { + short *yyssp1 = yyss - 1; + YYFPRINTF (stderr, "state stack now"); + while (yyssp1 != yyssp) + YYFPRINTF (stderr, " %d", *++yyssp1); + YYFPRINTF (stderr, "\n"); + } +#endif + + *++yyvsp = yyval; +#if YYLSP_NEEDED + *++yylsp = yyloc; +#endif + + /* Now `shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTBASE] + *yyssp; + if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTBASE]; + + goto yynewstate; + + +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ +yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; + +#ifdef YYERROR_VERBOSE + yyn = yypact[yystate]; + + if (yyn > YYFLAG && yyn < YYLAST) + { + YYSIZE_T yysize = 0; + char *yymsg; + int yyx, yycount; + + yycount = 0; + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + for (yyx = yyn < 0 ? -yyn : 0; + yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) + if (yycheck[yyx + yyn] == yyx) + yysize += yystrlen (yytname[yyx]) + 15, yycount++; + yysize += yystrlen ("parse error, unexpected ") + 1; + yysize += yystrlen (yytname[YYTRANSLATE (yychar)]); + yymsg = (char *) YYSTACK_ALLOC (yysize); + if (yymsg != 0) + { + char *yyp = yystpcpy (yymsg, "parse error, unexpected "); + yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]); + + if (yycount < 5) + { + yycount = 0; + for (yyx = yyn < 0 ? -yyn : 0; + yyx < (int) (sizeof (yytname) / sizeof (char *)); + yyx++) + if (yycheck[yyx + yyn] == yyx) + { + const char *yyq = ! yycount ? ", expecting " : " or "; + yyp = yystpcpy (yyp, yyq); + yyp = yystpcpy (yyp, yytname[yyx]); + yycount++; + } + } + yyerror (yymsg); + YYSTACK_FREE (yymsg); + } + else + yyerror ("parse error; also virtual memory exhausted"); + } + else +#endif /* defined (YYERROR_VERBOSE) */ + yyerror ("parse error"); + } + goto yyerrlab1; + + +/*--------------------------------------------------. +| yyerrlab1 -- error raised explicitly by an action | +`--------------------------------------------------*/ +yyerrlab1: + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + /* return failure if at end of input */ + if (yychar == YYEOF) + YYABORT; + YYDPRINTF ((stderr, "Discarding token %d (%s).\n", + yychar, yytname[yychar1])); + yychar = YYEMPTY; + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + + yyerrstatus = 3; /* Each real token shifted decrements this */ + + goto yyerrhandle; + + +/*-------------------------------------------------------------------. +| yyerrdefault -- current state does not do anything special for the | +| error token. | +`-------------------------------------------------------------------*/ +yyerrdefault: +#if 0 + /* This is wrong; only states that explicitly want error tokens + should shift them. */ + + /* If its default is to accept any token, ok. Otherwise pop it. */ + yyn = yydefact[yystate]; + if (yyn) + goto yydefault; +#endif + + +/*---------------------------------------------------------------. +| yyerrpop -- pop the current state because it cannot handle the | +| error token | +`---------------------------------------------------------------*/ +yyerrpop: + if (yyssp == yyss) + YYABORT; + yyvsp--; + yystate = *--yyssp; +#if YYLSP_NEEDED + yylsp--; +#endif + +#if YYDEBUG + if (yydebug) + { + short *yyssp1 = yyss - 1; + YYFPRINTF (stderr, "Error: state stack now"); + while (yyssp1 != yyssp) + YYFPRINTF (stderr, " %d", *++yyssp1); + YYFPRINTF (stderr, "\n"); + } +#endif + +/*--------------. +| yyerrhandle. | +`--------------*/ +yyerrhandle: + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yyerrdefault; + + yyn += YYTERROR; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) + goto yyerrdefault; + + yyn = yytable[yyn]; + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrpop; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrpop; + + if (yyn == YYFINAL) + YYACCEPT; + + YYDPRINTF ((stderr, "Shifting error token, ")); + + *++yyvsp = yylval; +#if YYLSP_NEEDED + *++yylsp = yylloc; +#endif + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +/*---------------------------------------------. +| yyoverflowab -- parser overflow comes here. | +`---------------------------------------------*/ +yyoverflowlab: + yyerror ("parser stack overflow"); + yyresult = 2; + /* Fall through. */ + +yyreturn: +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif + return yyresult; +} +#line 363 "dateyacc.y" + diff --git a/src/dateyacc.h b/src/dateyacc.h new file mode 100644 index 0000000..6463750 --- /dev/null +++ b/src/dateyacc.h @@ -0,0 +1,30 @@ +#ifndef BISON_DATEYACC_H +# define BISON_DATEYACC_H + +#ifndef YYSTYPE +typedef union { + int IntVal; +} yystype; +# define YYSTYPE yystype +# define YYSTYPE_IS_TRIVIAL 1 +#endif +# define DAY_NAME 257 +# define MONTH_NAME 258 +# define NUM9 259 +# define NUM23 260 +# define NUM59 261 +# define NUM99 262 +# define NUM2359 263 +# define NUM9999 264 +# define NUM235959 265 +# define NUM991231 266 +# define NUM99991231 267 +# define AMPM 268 +# define STD_ZONE 269 +# define DST_ZONE 270 +# define DST_SUFFIX 271 + + +extern YYSTYPE yylval; + +#endif /* not BISON_DATEYACC_H */ diff --git a/src/dateyacc.y b/src/dateyacc.y new file mode 100644 index 0000000..12a09a4 --- /dev/null +++ b/src/dateyacc.y @@ -0,0 +1,366 @@ +/*$Log: dateyacc.y,v $ +/*Revision 1.1 2002-07-25 08:01:26 arjen +/*First checkin, AXE release 0.2 +/* + * Revision 1.1 84/09/01 15:01:22 wales + * Initial revision + * + * Copyright (c) 1984 by Richard B. Wales + * + * Purpose: + * + * YACC parser for "parsedate" routine. + * + * Usage: + * + * Called as needed by the "parsedate" routine in "parsedate.c". + * Not intended to be called from any other routine. + * + * Notes: + * + * Global contents: + * + * int yyparse () + * Parses the date string pointed to by the global variable + * "yyinbuf". Sets the appropriate fields in the global data + * structure "yyans". The returned value is 1 if there was a + * syntax error, 0 if there was no error. + * + * Local contents: + * + * None. + */ + +/* ajs + * ajs Code added on 850314 to allow goal := year.date '.' time + * ajs and year.date := [CC]YYMMDD (YY > 23) + * ajs All added lines contain "ajs" for easy searching. + * ajs */ + +%{ +#ifdef RCSIDENT +static char rcsident[] = "$Header: /cvsroot/lib/AXE/src/dateyacc.y,v 1.1 2002-07-25 08:01:26 arjen Exp $"; +#endif RCSIDENT + +#include +#include "parsedate.h" +struct parseddate yyans; + +/* No error routine is needed here. */ +#define yyerror(s) +%} + +%union { + int IntVal; +} + +%token DAY_NAME +%token MONTH_NAME +%token NUM9 NUM23 NUM59 NUM99 NUM2359 NUM9999 NUM235959 +%token NUM991231 NUM99991231 /* ajs */ +%token AMPM +%token STD_ZONE DST_ZONE DST_SUFFIX + +%type DAY_NAME +%type MONTH_NAME +%type NUM9 NUM23 NUM59 NUM99 NUM2359 NUM9999 NUM235959 +%type NUM991231 NUM99991231 /* ajs */ +%type AMPM +%type STD_ZONE DST_ZONE +%type num59 num zone.offset + +%start goal +%% + +num59: + NUM23 + | NUM59 + ; + +num: + NUM9 + | num59 + ; + +goal: + date + | date dayname + | date dayname time + | date dayname time year + | date dayname year + | date dayname year time + | date time + | date time dayname + | date time dayname year + | date time year + | date time year dayname + | date.year + | date.year dayname + | date.year dayname time + | date.year time + | date.year time dayname + | dayname date + | dayname date time + | dayname date time year + | dayname date.year + | dayname date.year time + | dayname time date + | dayname time date.year + | dayname time year.date + | dayname year.date + | dayname year.date time + | dayname year time date + | time + | time date + | time date dayname + | time date dayname year + | time date.year + | time date.year dayname + | time dayname date + | time dayname date.year + | time dayname year.date + | time year.date + | time year.date dayname + | time year dayname date + | year.date + | year.date dayname + | year.date dayname time + | year.date time + | year.date time dayname + | year dayname date + | year dayname date time + | year dayname time date + | year time date + | year time date dayname + | year time dayname date + | NUM2359 + { yyans.hour = $1 / 100; + yyans.minute = $1 % 100; + yyans.second = -1; /* unspecified */ + } + | dayname + | yymmdd '.' time2359 /* ajs */ + | yymmdd '.' time /* ajs */ + | yymmdd '.' time dayname /* ajs */ + | error + { extern char *yyinbuf; + if (yyans.error == NULL) yyans.error = yyinbuf; + } + ; + +dayname: + DAY_NAME + { yyans.c_weekday = $1; } + | DAY_NAME '.' + { yyans.c_weekday = $1; } + ; + +date.year: + date year + | hyphen.date '-' year + | num '-' num '-' year + { yyans.day = $1; yyans.month = $3; } + | slash.date '/' year + ; + +year.date: + year date + | year '-' hyphen.date + | year '-' num '-' num + { yyans.day = $5; yyans.month = $3; } + | year '/' slash.date + | yymmdd /* ajs */ + ; + /* ajs */ +yymmdd: /* ajs */ + NUM991231 /* ajs */ + { yyans.year = ($1 / 10000) + 1900; /* ajs */ + yyans.month = ($1 % 10000) / 100; /* ajs */ + yyans.day = ($1 % 100); /* ajs */ + } /* ajs */ +/*| NUM235959 (leads to parser conflict) */ /* ajs */ + | NUM99991231 /* ajs */ + { yyans.year = ($1 / 10000); /* ajs */ + yyans.month = ($1 % 10000) / 100; /* ajs */ + yyans.day = ($1 % 100); /* ajs */ + } /* ajs */ + ; + +date: + num month.name + { yyans.day = $1; } + | month.name num + { yyans.day = $2; } + | num num + { yyans.month = $1; yyans.day = $2; } + ; + +hyphen.date: + num '-' month.name + { yyans.day = $1; } + | month.name '-' num + { yyans.day = $3; } + ; + +slash.date: + num '/' month.name + { yyans.day = $1; } + | month.name '/' num + { yyans.day = $3; } + | num '/' num + { yyans.month = $1; yyans.day = $3; } + ; + +year: + NUM59 /* 2-digit year < 60 : after 2000 */ + { yyans.year = 2000 + $1; } + | NUM23 + { yyans.year = 2000 + $1; } + | NUM99 /* precludes two-digit date before 1960 */ + { yyans.year = 1900 + $1; } + | NUM2359 + { yyans.year = $1; } + | NUM9999 + { yyans.year = $1; } + ; + +month.name: + MONTH_NAME + { yyans.month = $1; } + | MONTH_NAME '.' + { yyans.month = $1; } + ; + +time: + hour.alone + | hour am.pm + | hour zone + | hour am.pm zone + ; + +hour: + NUM2359 + { yyans.hour = $1 / 100; + yyans.minute = $1 % 100; + yyans.second = -1; /* unspecified */ + } + | hour.alone + ; + +hour.alone: + NUM9 ':' num59 + { yyans.hour = $1; + yyans.minute = $3; + yyans.second = -1; /* unspecified */ + } + | NUM9 '.' num59 + { yyans.hour = $1; + yyans.minute = $3; + yyans.second = -1; /* unspecified */ + } + | NUM9 ':' num59 ':' num59 + { yyans.hour = $1; + yyans.minute = $3; + yyans.second = $5; + } + | NUM9 '.' num59 '.' num59 + { yyans.hour = $1; + yyans.minute = $3; + yyans.second = $5; + } + | NUM23 ':' num59 + { yyans.hour = $1; + yyans.minute = $3; + yyans.second = -1; /* unspecified */ + } + | NUM23 '.' num59 + { yyans.hour = $1; + yyans.minute = $3; + yyans.second = -1; /* unspecified */ + } + | NUM23 ':' num59 ':' num59 + { yyans.hour = $1; + yyans.minute = $3; + yyans.second = $5; + } + | NUM23 '.' num59 '.' num59 + { yyans.hour = $1; + yyans.minute = $3; + yyans.second = $5; + } + | NUM2359 ':' num59 + { yyans.hour = $1 / 100; + yyans.minute = $1 % 100; + yyans.second = $3; + } + | NUM2359 '.' num59 + { yyans.hour = $1 / 100; + yyans.minute = $1 % 100; + yyans.second = $3; + } + | NUM235959 + { yyans.hour = $1 / 10000; + yyans.minute = ($1 % 10000) / 100; + yyans.second = $1 % 100; + } + ; + +am.pm: + AMPM + { if (yyans.hour < 1 || yyans.hour > 12) + yyans.hour = -1; /* invalid */ + else + { if (yyans.hour == 12) yyans.hour = 0; + yyans.hour += $1; /* 0 for AM, 12 for PM */ + } } + ; + +zone: + STD_ZONE + { yyans.zone = $1; yyans.dst = 0; } + | STD_ZONE DST_SUFFIX + { yyans.zone = $1 + 60; yyans.dst = 1; } + | '-' STD_ZONE + { yyans.zone = $2; yyans.dst = 0; } + | '-' STD_ZONE DST_SUFFIX + { yyans.zone = $2 + 60; yyans.dst = 1; } + | DST_ZONE + { yyans.zone = $1; yyans.dst = 1; } + | '-' DST_ZONE + { yyans.zone = $2; yyans.dst = 1; } + | '+' zone.offset + { yyans.zone = $2; yyans.dst = 0; } + | '-' '+' zone.offset + { yyans.zone = $3; yyans.dst = 0; } + | '-' zone.offset + { yyans.zone = - $2; yyans.dst = 0; } + | '-' '-' zone.offset + { yyans.zone = - $3; yyans.dst = 0; } + ; + +zone.offset: + NUM9 + { $$ = 60 * $1; } + | NUM9 ':' num59 + { $$ = 60 * $1 + $3; } + | NUM9 '.' num59 + { $$ = 60 * $1 + $3; } + | NUM23 + { $$ = 60 * $1; } + | NUM23 ':' num59 + { $$ = 60 * $1 + $3; } + | NUM23 '.' num59 + { $$ = 60 * $1 + $3; } + | NUM2359 + { $$ = 60 * ($1 / 100) | ($1 % 100); } + ; + +time2359: /* ajs */ + NUM2359 /* ajs */ + { yyans.hour = $1 / 100; /* ajs */ + yyans.minute = $1 % 100; /* ajs */ + yyans.second = -1; /* ajs */ + } /* ajs */ + ; + +%% diff --git a/src/directory.xpm b/src/directory.xpm new file mode 100644 index 0000000..3321c02 --- /dev/null +++ b/src/directory.xpm @@ -0,0 +1,20 @@ +/* XPM */ +static char * directory_xpm[] = { +"16 13 4 1", +" c #FFFFFFFFFFFF", +". c #000000000000", +"X c #FFFFFFFF7979", +"o c #C7C7C3C30000", +" .. ", +".... X.. ", +". XXXoX. ..", +". XXXXo.......X.", +". XXXXXXXXXXXXo.", +". XXXXXXXXXXXXo.", +". XXXXXXXXXXXXo.", +". XXXXXXXXXXXXo.", +". XXXXXXXXXXXXo.", +". XXXXXXXXXXXXo.", +". XXXXXXXXXXXXo.", +".Xooooooooooooo.", +"................"}; diff --git a/src/display.h b/src/display.h new file mode 100644 index 0000000..cc65b94 --- /dev/null +++ b/src/display.h @@ -0,0 +1,138 @@ +/************************************************************************** +** (c) Copyright 1998, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : display.h +** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : Definition of display class +** +** EXPORTED OBJECTS : class display +** LOCAL OBJECTS : +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Feb 06, 1998 +** LAST UPDATE : Feb 07, 1998 +** MODIFICATIONS : +**************************************************************************/ + +/***************************** + $Log: display.h,v $ + Revision 1.1 2002-07-25 08:01:26 arjen + First checkin, AXE release 0.2 + +*****************************/ + +/* static const char *RCSID = "$Id: display.h,v 1.1 2002-07-25 08:01:26 arjen Exp $"; */ + +#ifndef _DISPLAY_H +#define _DISPLAY_H + +#include +#include + +/* +/////////////////////////////////////////////////////////////////////////// +// NAME : display +// BASECLASS : +// MEMBERS : dpy : Pointer to the Xlib Display +// OPERATORS : >> XEvent - Read next event from the queue +// METHODS : display() - Connect the default display +// display(char *) - Connect a specific display. +// ~display() - Close the display connection +// +// Root() - The root window. +// Black() - Black pixel value. +// White() - White pixel value. +// DESCRIPTION : A display object maintains the connection to the X +// workstation. The library contains one such object, stddpy +// which is connected to the default display. +// +// RELATIONS : +// SEE ALSO : +// LAST MODIFIED : +/////////////////////////////////////////////////////////////////////////// +*/ + +class display +{ + Display *dpy; + + GC default_gc; + +public: + + display() + { + Status s; + s = XInitThreads(); + dpy = XOpenDisplay(""); + default_gc = XCreateGC(dpy, DefaultRootWindow(dpy), 0, 0); + } + + // contructor with char* argument opens named display. + display(char *display_name) + { + dpy = XOpenDisplay(display_name); + default_gc = XCreateGC(dpy, DefaultRootWindow(dpy), 0, 0); + } + + ~display() + { + XFreeGC(dpy, default_gc); + XCloseDisplay(dpy); + } + + display & operator>> (XEvent &ev) + { + XNextEvent(dpy, &ev); + return *this; + } + + // return display pointer. + Display *Dpy() + { + return dpy; + } + + operator Display *() + { + return dpy; + } + + Window Root() + { + return DefaultRootWindow(dpy); + } + + // Obtain the color index value for a white pixel. + unsigned long White() + { + return WhitePixel(dpy, DefaultScreen(dpy)); + } + + // Obtain the color index value for a black pixel. + unsigned long Black() + { + return BlackPixel(dpy, DefaultScreen(dpy)); + } + + GC gc() + { + return default_gc; + } + + Colormap ColMap() + { + return DefaultColormap(dpy, DefaultScreen(dpy)); + } +}; + +extern display stddpy; + +#endif /* _DISPLAY_H */ diff --git a/src/edit.cpp b/src/edit.cpp new file mode 100644 index 0000000..31bb2b7 --- /dev/null +++ b/src/edit.cpp @@ -0,0 +1,519 @@ + +/************************************************************************** +** (c) Copyright 1998, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : edit.cpp +** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : Implementation of text editor classes +** +** EXPORTED OBJECTS : +** LOCAL OBJECTS : +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Mar 13, 1998 +** LAST UPDATE : Jun 18, 1998 +** MODIFICATIONS : +**************************************************************************/ + +/***************************** + $Log: edit.cpp,v $ + Revision 1.1 2002-07-25 08:01:26 arjen + First checkin, AXE release 0.2 + +*****************************/ + +static const char *RCSID = "$Id: edit.cpp,v 1.1 2002-07-25 08:01:26 arjen Exp $"; + +#include "edit.h" +#include + +#include + +/*========================================================================= +** NAME : EV_KeyPress +** SYNOPSIS : +** PARAMETERS : +** RETURN VALUE : +** +** DESCRIPTION : +** +** VARS USED : +** VARS CHANGED : +** FUNCTIONS USED : +** SEE ALSO : +** LAST MODIFIED : May 21, 1998 +**========================================================================= +*/ + +int edit::EV_KeyPress(XKeyEvent ev) +{ + KeySym key; + int x_cursor; + unsigned w, h; + + Size(w, h); // The size of the window + + toggle_cursor(); + key = XLookupKeysym(&ev, ev.state & 1); + + // If text is selected, remove it first. + + DeleteSelection(); + + switch (key) + { + case XK_Left: + if (cursor_position > 0) + { + cursor_position--; + } + break; + + case XK_Right: + if (cursor_position < ~text) + { + cursor_position++; + } + break; + + case XK_BackSpace: + if (cursor_position > 0) + { + cursor_position--; + text(cursor_position, 1) = ""; + } + break; + + case XK_Delete: + text(cursor_position, 1) = ""; + break; + + case XK_Return: + case XK_KP_Enter: + enter(); + break; + + default: + if (key >= 0x20 && key <= 0x7e) + { + text(cursor_position, 0) = String((char)key); + cursor_position++; + } + break; + + } + if (cursor_position != 0) + x_cursor = fixed.TextWidth(text,cursor_position) + text_position; + else + x_cursor = text_position; + + if (x_cursor < 0) + { + text_position += w/4; + } + else if ((unsigned)x_cursor > w) + { + text_position -= w / 4; + } + redraw(); // Recreates the cursor. + + return 1; +} + +/*========================================================================= +** NAME : EV_ButtonPress - Handle press of mouse button +** SYNOPSIS : +** PARAMETERS : +** RETURN VALUE : +** +** DESCRIPTION : Buttonpress of the left mouse button puts the text +** cursor at the mouse's position and sets the focus to +** the edit window. +** The X server will send a FocusIn event as a result of +** the SetFocus +** +** VARS USED : +** VARS CHANGED : +** FUNCTIONS USED : +** SEE ALSO : +** LAST MODIFIED : May 22, 1998 +**========================================================================= +*/ + + +int edit::EV_ButtonPress(XButtonEvent ev) +{ + if (selected_until != -1) + { + selected_until = -1; + redraw(); + } + + if (ev.button == 1) + { + // Left mouse button + + if (focus_state != No_Focus) + { + // The cursor is visible; hide it from its old position + + toggle_cursor(); + } + cursor_position = map_to_textposition(ev.x); + if (cursor_position > ~text) + cursor_position = ~text; + + SetFocus(); + + if (focus_state != No_Focus) + { + // If we already have the focus, show the cursor on its new + // position, else the FocusIn event will take care of this. + + toggle_cursor(); + } + } + else if (ev.button == 2) + { + // Middle mouse button, paste the cut buffer + + int nbytes; + char *paste_text; + + paste_text = XFetchBytes(stddpy, &nbytes); + if (paste_text) + { + printf(" Pasting %s\n", paste_text); + text(cursor_position, 0) = paste_text; + redraw(); + } + } + return 1; +} + +/*========================================================================= +** NAME : EV_FocusIn - Handle FocusIn event +** SYNOPSIS : +** PARAMETERS : +** RETURN VALUE : +** +** DESCRIPTION : Four event handling functions work together to track +** the keyboard focus. The events involved are FocusIn, +** FocusOut, EnterNotify and LeaveNotify +** +** VARS USED : +** VARS CHANGED : +** FUNCTIONS USED : +** SEE ALSO : +** LAST MODIFIED : May 21, 1998 +**========================================================================= +*/ + +int edit::EV_FocusIn(XFocusChangeEvent ev) +{ + if (focus_state == No_Focus) + toggle_cursor(); + focus_state = Explicit_Focus; + return 1; +} + +int edit::EV_FocusOut(XFocusChangeEvent ev) +{ + focus_state = No_Focus; + toggle_cursor(); + return 1; +} +int edit::EV_EnterNotify(XCrossingEvent ev) +{ + if (ev.focus && focus_state == No_Focus) + { + focus_state = Implicit_Focus; + toggle_cursor(); + } + return 1; +} + +int edit::EV_LeaveNotify(XCrossingEvent ev) +{ + if (ev.focus && focus_state == Implicit_Focus) + { + focus_state = No_Focus; + toggle_cursor(); + } + return 1; +} + + +/*========================================================================= +** NAME : EV_MotionNotify - handle motion event. +** SYNOPSIS : +** PARAMETERS : +** RETURN VALUE : +** +** DESCRIPTION : +** +** VARS USED : +** VARS CHANGED : +** FUNCTIONS USED : +** SEE ALSO : +** LAST MODIFIED : May 22, 1998 +**========================================================================= +*/ + +int edit::EV_MotionNotify(XMotionEvent ev) +{ + selected_until = map_to_textposition(ev.x); + + redraw(); + + return 1; +} + +int edit::EV_ButtonRelease(XButtonEvent ev) +{ + String selected_text; + int selection_length; + + if (ev.button == 1 && selected_until != -1) + { + selected_until = map_to_textposition(ev.x); + + if (selected_until >= cursor_position) + { + selection_length = selected_until - cursor_position; + selected_text = text(cursor_position, selection_length); + } + else + { + selection_length = cursor_position - selected_until; + selected_text = text(selected_until, selection_length); + } + if (selected_text) + { + printf("%d chars selected: %s\n", selection_length,(char *)selected_text); + + XStoreBytes(stddpy, selected_text, selection_length); + } + else + { + printf("Nothing selected\n"); + } + } + + return 1; +} + +int edit::map_to_textposition(int x) +{ + + return (x - text_position) / 6; +} + +int edit::map_to_pixelposition(int tp) +{ + return fixed.TextWidth(text, tp) + text_position; +} + +/*========================================================================= +** NAME : toggle_cursor +** SYNOPSIS : +** PARAMETERS : +** RETURN VALUE : +** +** DESCRIPTION : +** +** VARS USED : +** VARS CHANGED : +** FUNCTIONS USED : +** SEE ALSO : +** LAST MODIFIED : Mar 17, 1998 +**========================================================================= +*/ + +void edit::toggle_cursor(void) +{ + int x_cursor; + + if (cursor_position != 0) + x_cursor = fixed.TextWidth(text,cursor_position) + text_position; + else + x_cursor = 0; + + DrawLine(edit_cursor_gc, x_cursor, 1, x_cursor, 13); +} + +/*========================================================================= +** NAME : redraw - Draw the edit object (again) +** SYNOPSIS : +** PARAMETERS : +** RETURN VALUE : +** +** DESCRIPTION : Clear the window and redraw the edited text. +** If part of the text is selected, draw this part +** in a different color. +** Draw a text cursor if we have the focus. +** +** VARS USED : +** VARS CHANGED : +** FUNCTIONS USED : +** SEE ALSO : +** LAST MODIFIED : May 22, 1998 +**========================================================================= +*/ + +void edit::redraw(void) +{ + int selection_length; + String selected_text; + int x_start, x_end; + + /* Redraw the entire text */ + + Clear(); + DrawString(text_normal_gc, text_position, 12, text); + + /* If part of the text is selected, highlight this part */ + + if (selected_until != -1) + { + if (selected_until >= cursor_position) + { + selection_length = selected_until - cursor_position; + x_start = map_to_pixelposition(cursor_position); + x_end = map_to_pixelposition(selected_until); + selected_text = text(cursor_position, selection_length); + } + else + { + selection_length = cursor_position - selected_until; + x_start = map_to_pixelposition(selected_until); + x_end = map_to_pixelposition(cursor_position); + selected_text = text(selected_until, selection_length); + } + + XFillRectangle(stddpy, ID(), inside_3D_gc, x_start, 1, x_end-x_start, 14); + DrawString(text_normal_gc, x_start, 12, selected_text); + } + + /* If we have the focus, draw the text cursor */ + + if (focus_state != No_Focus) + { + toggle_cursor(); + } +} + +void edit::enter(void) +{ + ParentMessage(EDIT_ENTERED); +} + +void edit::focuslost(void) +{ + ParentMessage(EDIT_FOCUSLOST); +} + + +/*========================================================================= +** NAME : DeleteSelection - Delete any selected text +** SYNOPSIS : +** PARAMETERS : +** RETURN VALUE : The number of characters deleted. +** +** DESCRIPTION : +** Make sure the cursor stays within the text. If the +** selection is 'right-to-left', i.e. from selected_until +** to cursor_position, the cursor is moved to the beginning +** of the selected text. +** +** VARS USED : +** VARS CHANGED : +** FUNCTIONS USED : +** SEE ALSO : +** LAST MODIFIED : Jun 18, 1998 +**========================================================================= +*/ + +int edit::DeleteSelection(void) +{ + int selection_length; + + selection_length = 0; + + if (selected_until != -1) + { + + if (selected_until >= cursor_position) + { + selection_length = selected_until - cursor_position; + text(cursor_position, selection_length) = ""; + } + else + { + selection_length = cursor_position - selected_until; + text(selected_until, selection_length) = ""; + cursor_position = selected_until; + } + } + selected_until = -1; // Nothing selected + + return selection_length; +} + +/*========================================================================= +** NAME : ClearSelection +** SYNOPSIS : +** PARAMETERS : +** RETURN VALUE : +** +** DESCRIPTION : +** +** VARS USED : +** VARS CHANGED : +** FUNCTIONS USED : +** SEE ALSO : +** LAST MODIFIED : Jun 18, 1998 +**========================================================================= +*/ + +int edit::ClearSelection(void) +{ + if (selected_until != -1) + { + selected_until = -1; + redraw(); + } + + return 0; +} + +/*========================================================================= +** NAME : SelectAll +** SYNOPSIS : +** PARAMETERS : +** RETURN VALUE : +** +** DESCRIPTION : +** +** VARS USED : +** VARS CHANGED : +** FUNCTIONS USED : +** SEE ALSO : +** LAST MODIFIED : Jun 18, 1998 +**========================================================================= +*/ + +void edit::SelectAll(void) +{ + cursor_position = 0; + selected_until = ~text - 1; + redraw(); + +} diff --git a/src/edit.h b/src/edit.h new file mode 100644 index 0000000..6d5e461 --- /dev/null +++ b/src/edit.h @@ -0,0 +1,134 @@ + +/************************************************************************** +** (c) Copyright 1998, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : edit.h +** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : Definition of text editor classes +** +** EXPORTED OBJECTS : +** LOCAL OBJECTS : +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Mar 13, 1998 +** LAST UPDATE : Jun 18, 1998 +** MODIFICATIONS : +**************************************************************************/ + +/***************************** + $Log: edit.h,v $ + Revision 1.1 2002-07-25 08:01:26 arjen + First checkin, AXE release 0.2 + +*****************************/ + +/* static const char *RCSID = "$Id: edit.h,v 1.1 2002-07-25 08:01:26 arjen Exp $"; */ + +#ifndef AXE_EDIT_H +#define AXE_EDIT_H + +#include "xappl.h" + +#include "String.h" + +/* +/////////////////////////////////////////////////////////////////////////// +// NAME : edit +// BASECLASS : window +// MEMBERS : cursor_position : Index in the text string where edit +// operations occur. A visible cursor is drawn before +// that character when we have the focus. +// selected_until : If text is selected, this is the index +// in the text string that marks the end of the selec- +// ted text. Characters are selected from the +// cursor_position until here or vice versa. +// OPERATORS : +// METHODS : +// +// DESCRIPTION : +// +// RELATIONS : +// SEE ALSO : +// LAST MODIFIED : Jun 18, 1998 +/////////////////////////////////////////////////////////////////////////// +*/ + +class edit : public window +{ + int selected_until; // End of selected text + int text_position; // Graphical position in window. + + enum { No_Focus, Implicit_Focus, Explicit_Focus } focus_state; + + + int map_to_textposition(int x); + int map_to_pixelposition(int tp); + void toggle_cursor(void); + +protected: + + String text; + int cursor_position; // Text cursor in String + + virtual int EV_KeyPress(XKeyEvent ev); + virtual int EV_ButtonPress(XButtonEvent ev); + virtual int EV_ButtonRelease(XButtonEvent ev); + virtual int EV_MotionNotify(XMotionEvent ev); + virtual int EV_FocusIn(XFocusChangeEvent ev); + virtual int EV_FocusOut(XFocusChangeEvent ev); + virtual int EV_EnterNotify(XCrossingEvent ev); + virtual int EV_LeaveNotify(XCrossingEvent ev); + +public: + + edit(window &par, int x, int y, const String &txt) + : window(par, x, y, 100, 20) + { + text = txt; + cursor_position = 0; + selected_until = -1; + text_position = 2; + focus_state = No_Focus; + SelectInput(ExposureMask|KeyPressMask, 1); + SelectInput(EnterWindowMask|LeaveWindowMask|FocusChangeMask, 1); + SelectInput(ButtonPressMask|Button1MotionMask|ButtonReleaseMask, 1); + XDefineCursor(stddpy, ID(), text_cursor); + } + + edit & operator =(const String &s) + { + text = s; + redraw(); + + return *this; + } + + operator String &() + { + return text; + } + + void redraw(void); + + virtual int EV_Expose(XExposeEvent ev) + { + redraw(); + return 1; + } + + virtual void enter(void); + virtual void focuslost(void); + + void SelectAll(void); + int ClearSelection(void); + int DeleteSelection(void); +}; + +#endif /* AXE_EDIT_H */ diff --git a/src/filedialog.cpp b/src/filedialog.cpp new file mode 100644 index 0000000..f04443b --- /dev/null +++ b/src/filedialog.cpp @@ -0,0 +1,197 @@ + +#include "filedialog.h" + +#define OPEN_DLG_OK 100 +#define OPEN_DLG_CANCEL 101 + +#include + +#include + +#include "directory.xpm" +#include "regfile.xpm" + +bool operator < (const file_entry &fe1, const file_entry &fe2) +{ + if (S_ISDIR(fe1.st.st_mode) == S_ISDIR(fe2.st.st_mode)) + { + return fe1.name < fe2.name; + } + else + { + return S_ISDIR(fe1.st.st_mode); + } +} + +directory_view::directory_view(window &parent) : table_view(parent, 200, 2) +{ + width(0) = 20; + width(1) = 330; + head(1) = " Name "; + Resize(360, 220); + dir.create(directory_xpm); + reg.create(regfile_xpm); + cwd = "."; +} + +int directory_view::scan() +{ + DIR *dirstream; + struct dirent *entry; + unsigned i; + + d_list.clear(); + dirstream = opendir(cwd); + entry = readdir(dirstream); + + while (entry) + { + file_entry file; + + file.name = entry->d_name; + stat(entry->d_name, &file.st); + d_list.push_back(file); + + entry = readdir(dirstream); + } + closedir(dirstream); + + sort(d_list.begin(), d_list.end()); + + recreate(d_list.size()); + + for (i = 0; i < d_list.size(); i++) + { + cell(i, 1) = d_list[i].name; + } + + return i; +} + +// Change the view's directory and return the new directory pathname + +String directory_view::changedir(String dir) +{ + char process_dir[PATH_MAX]; // Remember the process cwd + char destination_dir[PATH_MAX]; + + getcwd(process_dir, PATH_MAX); + + chdir(cwd); + if (chdir(dir) == -1) + { + int slash; + + perror("File selector"); + slash = dir.rindex('/'); + dir = dir(0, slash); + chdir(dir); + } + getcwd(destination_dir, PATH_MAX); + cwd = destination_dir; + scan(); + redraw(); + + chdir(process_dir); // Restore the directory we came from + + return cwd; +} + +void directory_view::redraw() +{ + int i; + int y; + + table_view::redraw(); + y = 22; + i = top_row(); + + while ((unsigned)i < d_list.size() && (unsigned)y < Size().h) + { + if (S_ISDIR(d_list[i].st.st_mode)) + { + DrawPixmap(text_normal_gc, 2, y, dir); + } + else + { + DrawPixmap(text_normal_gc, 2, y, reg); + } + i++; + y += 20; + } +} + +file_dialog::file_dialog(int cmd) : managed_window("File Selector") +{ + char path[PATH_MAX]; + + Background(inside_3D); + Resize(400, 360); + + OK = new command_button(*this, 20, 300, "OK", OPEN_DLG_OK); + OK_command = cmd; + + Cancel = new command_button(*this, 300, 300, "Cancel", OPEN_DLG_CANCEL); + Command_WhenClosed(OPEN_DLG_CANCEL); + + diredit = new edit(*this, 20, 20, ""); + diredit->Resize(360, 20); + + directory_list = new directory_view(*this); + directory_list->Move(20, 44); + fileedit = new edit(*this, 20, 270, ""); + fileedit->Resize(360, 20); + + getcwd(path, PATH_MAX); + *diredit = String(path); + directory_list->changedir(path); +} + +int file_dialog::DoCommand(int code) +{ + switch (code) + { + case OPEN_DLG_OK: + Unmap(); + XApp->DoCommand(OK_command); + return 1; + + case OPEN_DLG_CANCEL: + Unmap(); + return 1; + + default: + return -1; + } +} + +void file_dialog::ChildMessage(win_message &msg) +{ + + if (msg.msg_id == EDIT_ENTERED) + { + if (msg.from == fileedit) + { + diredit->SetFocus(); + } + else + { + *diredit = directory_list->changedir(*diredit); + fileedit->SetFocus(); + } + } + else if (msg.msg_id == TABLE_ROW_SELECT) + { + if (directory_list->selected_a_dir()) + { + String newdir; + + newdir = directory_list->cell(directory_list->selected(), 1); + *diredit = directory_list->changedir(newdir); + } + else + { + *fileedit = directory_list->cell(directory_list->selected(), 1); + } + } +} diff --git a/src/filedialog.h b/src/filedialog.h new file mode 100644 index 0000000..536a939 --- /dev/null +++ b/src/filedialog.h @@ -0,0 +1,68 @@ + +#include "button.h" +#include "edit.h" +#include "table.h" +#include "pixmap.h" + +#define OPEN_DLG_OK 100 +#define OPEN_DLG_CANCEL 101 + +#include +#include +#include + +struct file_entry +{ + String name; + struct stat st; +}; + +bool operator < (const file_entry &fe1, const file_entry &fe2); + +class directory_view : public table_view +{ + String cwd; + std::vector d_list; + + pixmap dir; + pixmap reg; + + int scan(); + +public: + + directory_view(window &parent); + + void redraw(); + String changedir(String dir); + + bool selected_a_dir() + { + return S_ISDIR(d_list[selected()].st.st_mode) != 0; + } +}; + + +class file_dialog : public managed_window +{ + command_button *OK; + command_button *Cancel; + edit *diredit; + edit *fileedit; + directory_view *directory_list; + int OK_command; + +public: + + file_dialog(int cmd); + + String PathName() + { + return *diredit + "/" + *fileedit; + } + + virtual int DoCommand(int code); + + virtual void ChildMessage(win_message &msg); +}; + diff --git a/src/font.cpp b/src/font.cpp new file mode 100644 index 0000000..227e352 --- /dev/null +++ b/src/font.cpp @@ -0,0 +1,49 @@ +/************************************************************************** +** (c) Copyright 1998, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : font.cpp +** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : Implementation of font class +** +** EXPORTED OBJECTS : font::TextWidth() +** LOCAL OBJECTS : +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Feb 13, 1998 +** LAST UPDATE : Feb 13, 1998 +** MODIFICATIONS : +**************************************************************************/ + +/***************************** + $Log: font.cpp,v $ + Revision 1.1 2002-07-25 08:01:26 arjen + First checkin, AXE release 0.2 + +*****************************/ + +static const char *RCSID = "$Id: font.cpp,v 1.1 2002-07-25 08:01:26 arjen Exp $"; + +#include +#include "font.h" + +int font::TextWidth(char *string, int length = 0) +{ + if (length == 0) + { + length = strlen(string); + } + + return XTextWidth(fs, string, length); +} + +int font::TextWidth(const String & string) +{ + return XTextWidth(fs, string, ~string); +} diff --git a/src/font.h b/src/font.h new file mode 100644 index 0000000..1a2510d --- /dev/null +++ b/src/font.h @@ -0,0 +1,114 @@ +/************************************************************************** +** (c) Copyright 1998, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : font.h +** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : Definition of font class +** +** EXPORTED OBJECTS : class font +** LOCAL OBJECTS : +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Feb 13, 1998 +** LAST UPDATE : Jan 22, 2002 +** MODIFICATIONS : +**************************************************************************/ + +/***************************** + $Log: font.h,v $ + Revision 1.1 2002-07-25 08:01:26 arjen + First checkin, AXE release 0.2 + +*****************************/ + +/* static const char *RCSID = "$Id: font.h,v 1.1 2002-07-25 08:01:26 arjen Exp $"; */ + +#include +#include +#include "display.h" +#include "String.h" + +/* +/////////////////////////////////////////////////////////////////////////// +// NAME : font +// BASECLASS : +// MEMBERS : XFontStruct *fs +// OPERATORS : +// METHODS : +// +// DESCRIPTION : +// +// RELATIONS : +// SEE ALSO : +// LAST MODIFIED : Jan 22, 2002 +/////////////////////////////////////////////////////////////////////////// +*/ + +class font +{ + XFontStruct *fs; + +public: + + font() + { + fs = 0; + } + + font(char *name) + { + fs = XLoadQueryFont(stddpy.Dpy(), name); + if (fs == NULL) + { + cerr << "Warnig: can not open font " << name << "\n"; + } + } + + ~font() + { + if (fs) + XFreeFont(stddpy.Dpy(), fs); + } + + operator bool(void) + { + return fs != 0; + } + + void Load(char *name) + { + if (fs) + XFreeFont(stddpy.Dpy(), fs); + fs = XLoadQueryFont(stddpy.Dpy(), name); + if (fs == NULL) + { + cerr << "Warnig: can not open font " << name << "\n"; + } + } + + operator XID () + { + return fs ? fs->fid : 0; + } + + int TextWidth(char *string, int length = 0); + int TextWidth(const String & string); + + int ascent(void) + { + return fs ? fs->ascent : 0; + } + + int descent(void) + { + return fs ? fs->descent : 0; + } +}; + diff --git a/src/frame.cpp b/src/frame.cpp new file mode 100644 index 0000000..885b014 --- /dev/null +++ b/src/frame.cpp @@ -0,0 +1,171 @@ + +/************************************************************************** +** (c) Copyright 1998, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : frame.cpp +** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : Implementation of class frame +** +** EXPORTED OBJECTS : +** LOCAL OBJECTS : +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Mar 07, 1998 +** LAST UPDATE : Mar 07, 1998 +** MODIFICATIONS : +**************************************************************************/ + +/***************************** + $Log: frame.cpp,v $ + Revision 1.1 2002-07-25 08:01:27 arjen + First checkin, AXE release 0.2 + +*****************************/ + +static const char *RCSID = "$Id: frame.cpp,v 1.1 2002-07-25 08:01:27 arjen Exp $"; + +#include "frame.h" + +/*========================================================================= +** NAME : EV_Expose - Handle Expose event. +** SYNOPSIS : +** PARAMETERS : +** RETURN VALUE : +** +** DESCRIPTION : +** +** VARS USED : +** VARS CHANGED : +** FUNCTIONS USED : +** SEE ALSO : +** LAST MODIFIED : +**========================================================================= +*/ + +int frame::EV_Expose(XExposeEvent ev) +{ + draw_effect(); + place_text(); + redraw(); + return 1; +} + +/*========================================================================= +** NAME : draw_effect - Draw the border effects in a frame +** SYNOPSIS : +** PARAMETERS : +** RETURN VALUE : +** +** DESCRIPTION : +** +** VARS USED : +** VARS CHANGED : +** FUNCTIONS USED : +** SEE ALSO : +** LAST MODIFIED : +**========================================================================= +*/ + +void frame::draw_effect(void) +{ + gc *top_gc, *bottom_gc; + + unsigned w, h; + int thick; + + if (strength > 0) + { + top_gc = &light_3D_gc; + bottom_gc = &dark_3D_gc; + thick = strength; + } + else + { + top_gc = &dark_3D_gc; + bottom_gc = &light_3D_gc; + thick = -strength; + } + + Size(w, h); + for (int i=0; i< thick; i++) + { + XDrawLine(stddpy, ID(), *top_gc, i, i, i, h-i); + XDrawLine(stddpy, ID(), *top_gc, i, i, w-i, i); + + XDrawLine(stddpy, ID(), *bottom_gc, i, h-i, w-i, h-i); + XDrawLine(stddpy, ID(), *bottom_gc, w-i, i, w-i, h-i); + } + +} + + +/*========================================================================= +** NAME : place_text - Place aligned text in a frame +** SYNOPSIS : +** PARAMETERS : +** RETURN VALUE : +** +** DESCRIPTION : +** +** VARS USED : +** VARS CHANGED : +** FUNCTIONS USED : +** SEE ALSO : +** LAST MODIFIED : +**========================================================================= +*/ + +void frame::place_text(void) +{ + int x, y; + unsigned w, h; + + if (text && text[0]) + { + Size(w, h); + switch (halign) + { + case Left: + x = strength; + break; + + case Center: + x = (w - default_font.TextWidth(text)) / 2; + break; + + case Right: + x = w - default_font.TextWidth(text) - strength; + break; + + } + + switch (valign) + { + int space; + + case Top: + y = default_font.ascent() + strength; + break; + + case Middle: + space = (h - (default_font.ascent() + default_font.descent())) / 2; + y = space + default_font.ascent(); + break; + + case Bottom: + y = h - default_font.descent() - strength; + break; + + } + + XDrawString(stddpy, ID(), menu_normal_gc, x, y, text, strlen(text)); + } +} + diff --git a/src/frame.h b/src/frame.h new file mode 100644 index 0000000..f7242c1 --- /dev/null +++ b/src/frame.h @@ -0,0 +1,135 @@ + +/************************************************************************** +** (c) Copyright 1998, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : frame.h +** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : Definition of the frame class +** +** EXPORTED OBJECTS : +** LOCAL OBJECTS : +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Mar 06, 1998 +** LAST UPDATE : Mar 13, 1998 +** MODIFICATIONS : +**************************************************************************/ + +/***************************** + $Log: frame.h,v $ + Revision 1.1 2002-07-25 08:01:27 arjen + First checkin, AXE release 0.2 + +*****************************/ + +/* static const char *RCSID = "$Id: frame.h,v 1.1 2002-07-25 08:01:27 arjen Exp $"; */ + +#ifndef FRAME_H +#define FRAME_H + +#include "xappl.h" + + +/* +/////////////////////////////////////////////////////////////////////////// +// NAME : frame - window with border effect and aligned text +// BASECLASS : window +// MEMBERS : text : The text to draw in the frame (may be 0). +// valign : Vertical alignment of the text +// halign : Horizontal alignment of the text. +// effect : Type of border: 3D, Shadow, etc +// strength : Of the border effect. 0 = no effect, +// positive means 'Up'; negative is 'Down' +// +// OPERATORS : +// METHODS : PRIVATE draw_effect() : Draw border effect +// PRIVATE place_text() : Draw the aligned text +// +// TextAlign() : Set aligment of the text +// Strength() : Change or read the strength of the effect. +// +// DESCRIPTION : A frame adds two visual effects to a window: +// 1. A border effect (3D or shadow) +// 2. An aligned line of text. +// +// RELATIONS : +// SEE ALSO : +// LAST MODIFIED : +/////////////////////////////////////////////////////////////////////////// +*/ + +enum hor_alignment { Left, Center, Right }; +enum ver_alignment { Top, Middle, Bottom }; + +class frame : public window +{ + char *text; + + hor_alignment halign; + ver_alignment valign; + + enum { TriD, Shadow } effect; + + int strength; + + void draw_effect(void); + + void place_text(void); + + virtual int EV_Expose(XExposeEvent ev); + +public: + + frame(window &par, int x, int y, int s = 3) : window(par, x, y, 80, 30) + { + Background(inside_3D); + strength = s; + effect = TriD; + text = 0; + halign = Center; + valign = Middle; + SelectInput(ExposureMask, 1); + } + + frame(window &par, int x, int y, char *t) : window(par, x, y, 80, 30) + { + Background(inside_3D); + strength = 5; + effect = TriD; + text = t; + halign = Center; + valign = Middle; + SelectInput(ExposureMask, 1); + } + + void TextAlign(hor_alignment hor, ver_alignment ver) + { + halign = hor; + valign = ver; + place_text(); + } + + void Strength(int s) + { + strength = s; + draw_effect(); + } + int Strength(void) + { + return strength; + } + + virtual void redraw(void) + { + } +}; + +#endif /* FRAME_H */ + diff --git a/src/gc.h b/src/gc.h new file mode 100644 index 0000000..5434b6f --- /dev/null +++ b/src/gc.h @@ -0,0 +1,140 @@ +/************************************************************************** +** (c) Copyright 1998, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : gc.h +** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : Definition of gc class +** +** EXPORTED OBJECTS : class gc +** LOCAL OBJECTS : +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Feb 22, 1998 +** LAST UPDATE : Oct 28, 1999 +** MODIFICATIONS : +**************************************************************************/ + +/***************************** + $Log: gc.h,v $ + Revision 1.1 2002-07-25 08:01:27 arjen + First checkin, AXE release 0.2 + +*****************************/ + +/* static const char *RCSID = "$Id: gc.h,v 1.1 2002-07-25 08:01:27 arjen Exp $"; */ + +#include +#include "display.h" +#include "color.h" +#include "font.h" +#include "pattern.h" + +/* +/////////////////////////////////////////////////////////////////////////// +// NAME : gc +// BASECLASS : +// MEMBERS : XID gc_id +// OPERATORS : +// METHODS : +// +// DESCRIPTION : +// +// RELATIONS : +// SEE ALSO : +// LAST MODIFIED : Oct 28, 1999 +/////////////////////////////////////////////////////////////////////////// +*/ + +class gc +{ + GC gc_id; + +public: + + gc() + { + gc_id = 0; + } + + gc(const color &fg) + { + gc_id = XCreateGC(stddpy, stddpy.Root(), 0, 0); + XSetForeground(stddpy, gc_id, fg); + } + + gc(font &fn, color &fg) + { + gc_id = XCreateGC(stddpy, stddpy.Root(), 0, 0); + if (fn) + { + XSetFont(stddpy, gc_id, fn); + } + XSetForeground(stddpy, gc_id, fg); + } + + gc(font &fn, color &fg, stipple &stip) + { + gc_id = XCreateGC(stddpy, stddpy.Root(), 0, 0); + if (fn) + { + XSetFont(stddpy, gc_id, fn); + } + XSetForeground(stddpy, gc_id, fg); + XSetStipple(stddpy, gc_id, stip); + XSetFillStyle(stddpy, gc_id, FillStippled); + + } + + ~gc() + { + XFreeGC(stddpy, gc_id); + } + + operator GC() const + { + return gc_id; + } + + void Create() + { + gc_id = XCreateGC(stddpy, stddpy.Root(), 0, 0); + } + + void SetFunction(int func) + { + XSetFunction(stddpy, gc_id, func); + } + + void SetForeground(unsigned long fg) + { + XSetForeground(stddpy, gc_id, fg); + } + + void SetBackground(unsigned long fg) + { + XSetBackground(stddpy, gc_id, fg); + } + + void SetFont(font &fn) + { + if (fn) + { + XSetFont(stddpy, gc_id, fn); + } + } + + void SetLineAttributes(unsigned width, int line_style = LineSolid, + int cap_style = CapButt, int join_style = JoinMiter) + { + XSetLineAttributes(stddpy, gc_id, width, line_style, + cap_style, join_style); + } +}; + diff --git a/src/geometry.cpp b/src/geometry.cpp new file mode 100644 index 0000000..33f9d58 --- /dev/null +++ b/src/geometry.cpp @@ -0,0 +1,86 @@ + +/************************************************************************** +** (c) Copyright 1998, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : geometry.cpp +** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : Implementation of geometry classes +** +** EXPORTED OBJECTS : +** LOCAL OBJECTS : +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Apr 04, 1998 +** LAST UPDATE : Apr 04, 1998 +** MODIFICATIONS : +**************************************************************************/ + +/***************************** + $Log: geometry.cpp,v $ + Revision 1.1 2002-07-25 08:01:27 arjen + First checkin, AXE release 0.2 + +*****************************/ + +static const char *RCSID = "$Id: geometry.cpp,v 1.1 2002-07-25 08:01:27 arjen Exp $"; + +#include "geometry.h" + +rectangle::rectangle(point p1, point p2) +{ + if (p1.x < p2.x) + { + x = p1.x; + w = p2.x - p1.x; + } + else + { + x = p2.x; + w = p1.x - p2.x; + } + + if (p1.y < p2.y) + { + y = p1.y; + h = p2.y - p1.y; + } + else + { + y = p2.y; + h = p1.y - p2.y; + } +} + +bool rectangle::encloses(point p) +{ + return p.x > x && p.x < x + w && p.y > y && p.y < y + h; +} + +bool rectangle::encloses(rectangle r) +{ + return encloses(r.Origin()) && encloses(r.Origin() + r.Size()); +} + +point operator + (point p1, point p2) +{ + p1.x += p2.x; + p1.y += p2.y; + + return p1; +} + +point operator + (point p, size s) +{ + p.x += s.w; + p.y += s.h; + + return p; +} + diff --git a/src/geometry.h b/src/geometry.h new file mode 100644 index 0000000..08ddd98 --- /dev/null +++ b/src/geometry.h @@ -0,0 +1,130 @@ + +/************************************************************************** +** (c) Copyright 1998, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : geometry.h +** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : Definition of geometry classes: point, size, rect +** +** EXPORTED OBJECTS : +** LOCAL OBJECTS : +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Mar 04, 1998 +** LAST UPDATE : Jul 05, 2000 +** MODIFICATIONS : +**************************************************************************/ + +/***************************** + $Log: geometry.h,v $ + Revision 1.1 2002-07-25 08:01:27 arjen + First checkin, AXE release 0.2 + +*****************************/ + +/* static const char *RCSID = "$Id: geometry.h,v 1.1 2002-07-25 08:01:27 arjen Exp $"; */ + +#ifndef AXE_GEOMETRY_H +#define AXE_GEOMETRY_H + +class point +{ +public: + + short x, y; + + point() + { + x = 0; y = 0; + } + + point(short _x, short _y) + { + x = _x; + y = _y; + } +}; + +class size +{ +public: + + unsigned short w, h; + + size() + { + w = 0; + h = 0; + } + + size(unsigned short width, unsigned short height) + { + w = width; + h = height; + } +}; + +class rectangle +{ + short x, y; + unsigned short w, h; + + +public: + + rectangle() + { + x = 0; + y = 0; + w = 0; + h = 0; + } + + rectangle(int _x, int _y, unsigned int _w, unsigned int _h) + { + x = _x; + y = _y; + w = _w; + h = _h; + } + + rectangle(point p, size s) + { + x = p.x; + y = p.y; + w = s.w; + h = s.h; + } + + // Define a rectangle by its diagonal + + rectangle(point p1, point p2); + + point Origin() + { + return point(x, y); + } + + size Size() + { + return size(w, h); + } + + bool encloses(point); + bool encloses(rectangle); +}; + +point operator + (point p1, point p2); +point operator + (point p, size s); + +// +// ParseGeometryString + +#endif diff --git a/src/hour.cpp b/src/hour.cpp new file mode 100644 index 0000000..3394ff7 --- /dev/null +++ b/src/hour.cpp @@ -0,0 +1,114 @@ +/************************************************************************** +** (c) Copyright 1999, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : hour.cpp +** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : +** +** EXPORTED OBJECTS : +** LOCAL OBJECTS : +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Feb 06, 1998 +** LAST UPDATE : Oct 16, 1999 +**************************************************************************/ + +/***************************** + $Log: hour.cpp,v $ + Revision 1.1 2002-07-25 08:01:27 arjen + First checkin, AXE release 0.2 + +*****************************/ + +static const char *RCSID = "$Id: hour.cpp,v 1.1 2002-07-25 08:01:27 arjen Exp $"; + +#include "date.h" +#include "parsedate.h" + +hour::hour(String s) +{ + struct parseddate *pd; + + pd = parsedate(s); + hours = pd->hour; + minutes = pd->minute; + seconds = pd->second; +} + +hour operator+(hour &t1, hour &t2) +{ + hour t = t1; + + t.seconds += t2.seconds; + if (t.seconds >= 60) + { + t.minutes++; + t.seconds -= 60; + } + t.minutes += t2.minutes; + if (t.minutes >= 60) + { + t.hours++; + t.minutes -= 60; + } + t.hours += t2.hours; + + return t; +} + +hour hour::operator+=(hour t) +{ + seconds += t.seconds; + if (seconds >= 60) + { + minutes++; + seconds -= 60; + } + minutes += t.minutes; + if (minutes >= 60) + { + hours++; + minutes -= 60; + } + hours += t.hours; + + return *this; +} + +hour operator-(hour &t1, hour &t2) +{ + hour t = t1; + + t.seconds -= t2.seconds; + if (t.seconds < 0) + { + t.minutes--; + t.seconds += 60; + } + + t.minutes -= t2.minutes; + if (t.minutes < 0) + { + t.hours--; + t.minutes += 60; + } + + t.hours -= t2.hours; + + return t; +} + +ostream& operator<<(ostream &s, const hour &t) +{ + s << t.hours << ":" << t.minutes << ":" << t.seconds; + + return s; +} + diff --git a/src/icon.cpp b/src/icon.cpp new file mode 100644 index 0000000..062588d --- /dev/null +++ b/src/icon.cpp @@ -0,0 +1,41 @@ +/************************************************************************** +** (c) Copyright 1998, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : icon.cpp +** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : Implementation of icon class +** +** EXPORTED OBJECTS : +** LOCAL OBJECTS : +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Jul 13, 2000 +** MODIFICATIONS : +**************************************************************************/ + +/***************************** + $Log: icon.cpp,v $ + Revision 1.1 2002-07-25 08:01:27 arjen + First checkin, AXE release 0.2 + +*****************************/ + +static const char *RCSID = "$Id: icon.cpp,v 1.1 2002-07-25 08:01:27 arjen Exp $"; + +#include "icon.h" + +extern gc text_normal_gc; + +int icon::EV_Expose(XExposeEvent ev) +{ + DrawPixmap(text_normal_gc, 0, 0, picture); + return 1; +} + diff --git a/src/icon.h b/src/icon.h new file mode 100644 index 0000000..ac1dc6b --- /dev/null +++ b/src/icon.h @@ -0,0 +1,88 @@ +/************************************************************************** +** (c) Copyright 1998, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : icon.h +** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : Definition of icon class +** +** EXPORTED OBJECTS : class icon +** LOCAL OBJECTS : +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Jul 13, 2000 +** MODIFICATIONS : +**************************************************************************/ + +/***************************** + $Log: icon.h,v $ + Revision 1.1 2002-07-25 08:01:27 arjen + First checkin, AXE release 0.2 + +*****************************/ + +/* static const char *RCSID = "$Id: icon.h,v 1.1 2002-07-25 08:01:27 arjen Exp $"; */ + +#ifndef AXE_ICON_H +#define AXE_ICON_H + +#include +#include +#include "xwindow.h" + +/* +/////////////////////////////////////////////////////////////////////////// +// NAME : icon +// BASECLASS : +// MEMBERS : pixmap picture; +// OPERATORS : +// METHODS : +// +// DESCRIPTION : An icon is a window that contains a pixmap. +// It automatically redraws on Expose events. +// +// RELATIONS : +// SEE ALSO : +// LAST MODIFIED : Jul 13, 2000 +/////////////////////////////////////////////////////////////////////////// +*/ + +class icon : public window +{ + pixmap picture; + + virtual int EV_Expose(XExposeEvent ev); + +public: + + icon(window &parent, int x, int y, char *data, unsigned int w, unsigned int h) : + window(parent, x, y, w, h) + { + //picture = XCreateBitmapFromData(stddpy, stddpy.Root(), data, w, h); + SelectInput(ExposureMask, 1); + } + + icon(window &parent, int x, int y, char *pixmap_data[]) : + window(parent, x, y, 4, 4, 0) + { + picture.create(pixmap_data); + Resize(picture.Size()); + SelectInput(ExposureMask, 1); + } + + icon(window &parent, int x, int y, char *filename) : window(parent, x, y, 4, 4, 0) + { + picture.read(filename); + Resize(picture.Size()); + SelectInput(ExposureMask, 1); + } + +}; + +#endif /* AXE_ICON_H */ diff --git a/src/ideas b/src/ideas new file mode 100644 index 0000000..571442c --- /dev/null +++ b/src/ideas @@ -0,0 +1,37 @@ +class vector // Allocated array of doubles + + vector() // default dimension: 3 + vector(int dim) + vector(vector &) // copy constructor + ~vector() + + +class matrix // Allocated array of vectors + + matrix() // default 3 x 3 + matrix(int rows, int cols = 0) + // 0 columns: cols = rows, default to square matrix + matrix(double) // numbers on diagonal, rest=0 + matrix(matrix &) // copy constructor + + To raise a matrix M to an integer power n: + (see DDJ #177, page 86) + note that the bits in n represent squares of M + + Result = 1; + for (bit = 0; bit < # bits in n; bit ++) + if bit in n is set + Result *= M; + M = M * M; + +class time + + Hours, minutes, seconds (fractional seconds ?) + + Conversion from HMS to decimal and vice-versa + + time(double) // hours + + double() // Convert to decimal hours + + operator + - diff --git a/src/integer.cpp b/src/integer.cpp new file mode 100644 index 0000000..131ac74 --- /dev/null +++ b/src/integer.cpp @@ -0,0 +1,70 @@ +/************************************************************************** +** (c) Copyright 1999, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : integer.cpp +** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : +** +** EXPORTED OBJECTS : +** LOCAL OBJECTS : +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Feb 06, 1998 +** LAST UPDATE : Oct 16, 1999 +**************************************************************************/ + +/***************************** + $Log: integer.cpp,v $ + Revision 1.1 2002-07-25 08:01:27 arjen + First checkin, AXE release 0.2 + +*****************************/ + +static const char *RCSID = "$Id: integer.cpp,v 1.1 2002-07-25 08:01:27 arjen Exp $"; + + +#include "integer.h" + +integer& integer::operator=(integer &i) +{ + if (nr_words > 0) + delete Number; + + msw = i.msw; + nr_words = i.nr_words; + Number = new unsigned short[nr_words]; + for (int j=0; j>(istream &s, integer &i) +{ + return s; +} diff --git a/src/integer.h b/src/integer.h new file mode 100644 index 0000000..fa1f115 --- /dev/null +++ b/src/integer.h @@ -0,0 +1,86 @@ +/************************************************************************** +** (c) Copyright 1999, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : integer.h +** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : Arbitrary length integer +** +** EXPORTED OBJECTS : +** LOCAL OBJECTS : +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Feb 06, 1998 +** LAST UPDATE : Oct 16, 1999 +** MODIFICATIONS : +**************************************************************************/ + +/***************************** + $Log: integer.h,v $ + Revision 1.1 2002-07-25 08:01:27 arjen + First checkin, AXE release 0.2 + +*****************************/ + +/* static const char *RCSID = "$Id: integer.h,v 1.1 2002-07-25 08:01:27 arjen Exp $"; */ + + +#include + +/* + * The integer class (not int !) implements an arbitrary length + * number. It allocates more words as the number grows. + * When a number consists of more than one word, only the first + * is signed (the most significant), the rest of the words is + * unsigned. + * + * When adding, overflow is detected if the addends are of the same + * sign and the result has a different sign. + */ + +class integer +{ + int nr_words; + short msw; // Most significant word, in 2s complement + unsigned short *Number; // least significant words. + +public: + + integer() + { + nr_words = 0; + msw = 0; + } + + integer (long l) + { + nr_words = 1; + Number = new unsigned short[1]; + Number[0] = l; + msw = l >> 16; + } + + ~integer() + { + if (nr_words > 0) + delete Number; + } + + integer& operator=(integer &); + integer operator+(integer &); +// operator-() +// operator*() +// operator/() +// operator%() +// operator<<() +// operator>>() + + friend ostream& operator<<(ostream&, integer&); + friend istream& operator>>(istream&, integer&); +}; diff --git a/src/inttest.cpp b/src/inttest.cpp new file mode 100644 index 0000000..bf6e75c --- /dev/null +++ b/src/inttest.cpp @@ -0,0 +1,14 @@ + +#include "Integer.h" + +main() +{ + integer a(2000000000), b(2048); + integer c; + + cout << "a = " << a << ", b = " << b << "\n"; + cout << "c = " << c << "\n"; + c = b; + cout << "c = b : c = " << c << "\n"; +} + \ No newline at end of file diff --git a/src/menu.cpp b/src/menu.cpp new file mode 100644 index 0000000..a0ad141 --- /dev/null +++ b/src/menu.cpp @@ -0,0 +1,378 @@ +/************************************************************************** +** (c) Copyright 1998, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : menu.cpp +** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : Implementation of menu classes +** +** EXPORTED OBJECTS : menu_container +** LOCAL OBJECTS : +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Feb 13, 1998 +** LAST UPDATE : Mar 07, 1998 +** MODIFICATIONS : +**************************************************************************/ + +/***************************** + $Log: menu.cpp,v $ + Revision 1.1 2002-07-25 08:01:27 arjen + First checkin, AXE release 0.2 + +*****************************/ + +static const char *RCSID = "$Id: menu.cpp,v 1.1 2002-07-25 08:01:27 arjen Exp $"; + +#include "menu.h" + +#include + + +/*========================================================================= +** NAME : RearrangeItems +** SYNOPSIS : +** PARAMETERS : +** RETURN VALUE : +** +** DESCRIPTION : +** +** VARS USED : +** VARS CHANGED : +** FUNCTIONS USED : +** SEE ALSO : +** LAST MODIFIED : +**========================================================================= +*/ + +void menu_container::RearrangeItems(unsigned &ov_width, unsigned &ov_height) +{ + win_list *l; + unsigned width, height; + + ov_width = 0; + ov_height = 0; + + if (mode == Horizontal) + { + for(l = children; l; l = l->next) + { + l->child->Move(ov_width, 0); + l->child->Size(width, height); + ov_width += width; + ov_height = height > ov_height ? height : ov_height; + } + + for(l = children; l; l = l->next) + { + l->child->Size(width, height); + l->child->Resize(width, ov_height); + } + } + else /* mode is Vertical */ + { + for(l = children; l; l = l->next) + { + l->child->Move(0, ov_height); + l->child->Size(width, height); + ov_height += height; + ov_width = width > ov_width ? width : ov_width; + } + + for(l = children; l; l = l->next) + { + l->child->Size(width, height); + l->child->Resize(ov_width, height); + } + } + +} + +/*========================================================================= +** NAME : HideSubmenus +** SYNOPSIS : +** PARAMETERS : +** RETURN VALUE : +** +** DESCRIPTION : +** +** VARS USED : +** VARS CHANGED : +** FUNCTIONS USED : +** SEE ALSO : +** LAST MODIFIED : +**========================================================================= +*/ + +void menu_container::HideSubmenus(void) +{ + //printf("HideSubmenus(0x%x)\n",this); + + win_list *l = children; + + while (l) + { + menu_item *mi; + + mi = (menu_item *)l->child; + mi->HideSubmenu(); + + l = l->next; + } + +} + +/*========================================================================= +** NAME : Show +** SYNOPSIS : +** PARAMETERS : +** RETURN VALUE : +** +** DESCRIPTION : +** +** VARS USED : +** VARS CHANGED : +** FUNCTIONS USED : +** SEE ALSO : +** LAST MODIFIED : +**========================================================================= +*/ + +void menu_container::Show(menu_item *by, int x, int y) +{ + shown_by = by; + Move(x, y); + Realize(); +} + + +void menu_item::redraw(void) +{ +} + +/*========================================================================= +** NAME : EV_EnterNotify +** SYNOPSIS : +** PARAMETERS : +** RETURN VALUE : +** +** DESCRIPTION : +** +** VARS USED : +** VARS CHANGED : +** FUNCTIONS USED : +** SEE ALSO : +** LAST MODIFIED : +**========================================================================= +*/ + +int menu_item::EV_EnterNotify(XCrossingEvent ev) +{ + highlighted = 1; + Background(menu_highlight); + Clear(); + + redraw(); + + GrabPointer(hand_cursor); + + // Make sure all sibling popup menus are disappeared. + + win_list *l = parent->children; + + while (l) + { + menu_item *mi; + + mi = (menu_item *)l->child; + if (mi != this) + mi->HideSubmenu(); + + l = l->next; + } + + ShowSubmenu(ev.x_root - ev.x, ev.y_root - ev.y); + + return 1; +} + +/*========================================================================= +** NAME : EV_LeaveNotify +** SYNOPSIS : +** PARAMETERS : +** RETURN VALUE : +** +** DESCRIPTION : +** +** VARS USED : +** VARS CHANGED : +** FUNCTIONS USED : +** SEE ALSO : +** LAST MODIFIED : +**========================================================================= +*/ + +int menu_item::EV_LeaveNotify(XCrossingEvent ev) +{ + highlighted = 0; + Background(menu_normal); + Clear(); + redraw(); + + return 1; +} + +/*========================================================================= +** NAME : EV_ButtonRelease +** SYNOPSIS : +** PARAMETERS : +** RETURN VALUE : +** +** DESCRIPTION : +** +** VARS USED : +** VARS CHANGED : +** FUNCTIONS USED : +** SEE ALSO : +** LAST MODIFIED : +**========================================================================= +*/ + +int menu_item::EV_ButtonRelease(XButtonEvent ev) +{ + menu_container *contain; + + UngrabPointer(); + + contain = (menu_container *)parent; + while (contain->shown_by) + { + menu_item *mi = (menu_item *)contain->shown_by; + contain = (menu_container *)mi->parent; + } + //printf("contain->HideSubmenus(0x%x)\n", contain); + contain->HideSubmenus(); + + if (highlighted && !popup) + { + return XApp->SendCommand(command_code); + } + + return 1; + +} + +/*========================================================================= +** NAME : HideSubmenu +** SYNOPSIS : +** PARAMETERS : +** RETURN VALUE : +** +** DESCRIPTION : +** +** VARS USED : +** VARS CHANGED : +** FUNCTIONS USED : +** SEE ALSO : +** LAST MODIFIED : +**========================================================================= +*/ + +void menu_item::HideSubmenu(void) +{ + if (popup) + { + //printf("popup->HideSubmenus(0x%x)\n", popup); + popup->HideSubmenus(); + popup->Unmap(); + popup->shown_by = 0; + } +} + +/*========================================================================= +** NAME : ShowSubmenu +** SYNOPSIS : +** PARAMETERS : +** RETURN VALUE : +** +** DESCRIPTION : +** +** VARS USED : +** VARS CHANGED : +** FUNCTIONS USED : +** SEE ALSO : +** LAST MODIFIED : +**========================================================================= +*/ + +void menu_item::ShowSubmenu(int x, int y) +{ + if (popup) + { + unsigned w, h; + + menu_container *contain; + + Size(w, h); + + contain = (menu_container *)parent; + contain->PositionSubmenu(x, y, w, h); + + popup->Show(this, x, y); + } + +} + + +/*========================================================================= +** NAME : redraw - Draw a label in a menu item +** SYNOPSIS : +** PARAMETERS : +** RETURN VALUE : +** +** DESCRIPTION : +** +** VARS USED : +** VARS CHANGED : +** FUNCTIONS USED : +** SEE ALSO : +** LAST MODIFIED : Mar 07, 1998 +**========================================================================= +*/ + +void menu_label::redraw(void) +{ + XDrawString(stddpy, ID(), enabled ? menu_normal_gc : menu_dimmed_gc, + 5, default_font.ascent() + 3, label, strlen(label)); + +} + +/*========================================================================= +** NAME : redraw -- Draw a separator in a menu item +** SYNOPSIS : +** PARAMETERS : +** RETURN VALUE : +** +** DESCRIPTION : +** +** VARS USED : +** VARS CHANGED : +** FUNCTIONS USED : +** SEE ALSO : +** LAST MODIFIED : +**========================================================================= +*/ + +void menu_separator::redraw(void) +{ + unsigned int w, h; + + Size(w, h); + XDrawLine(stddpy, ID(), menu_normal_gc, 0, 3, w, 3); +} diff --git a/src/menu.h b/src/menu.h new file mode 100644 index 0000000..882bb0e --- /dev/null +++ b/src/menu.h @@ -0,0 +1,336 @@ +/************************************************************************** +** (c) Copyright 1998, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : menu.h +** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : Definition of menu classes +** +** EXPORTED OBJECTS : class menu_container +** LOCAL OBJECTS : +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Feb 13, 1998 +** LAST UPDATE : Mar 07, 1998 +** MODIFICATIONS : +**************************************************************************/ + +/***************************** + $Log: menu.h,v $ + Revision 1.1 2002-07-25 08:01:27 arjen + First checkin, AXE release 0.2 + +*****************************/ + +/* static const char *RCSID = "$Id: menu.h,v 1.1 2002-07-25 08:01:27 arjen Exp $"; */ + +#include +#include "xappl.h" + +/* +/////////////////////////////////////////////////////////////////////////// +// NAME : menu_container +// BASECLASS : window +// MEMBERS : mode : Horizontal or Vertical +// OPERATORS : +// METHODS : +// +// DESCRIPTION : A menu_container is the parent window of menu items. +// The menu_container lines the menu items up next to +// eachother and makes them all fit together. +// +// RELATIONS : shown_by : menu_item that popped me up. The menu item +// which is clicked uses this to climb to +// the top of the menu tree and hide all submenus +// SEE ALSO : +// LAST MODIFIED : Feb 27, 1998 +/////////////////////////////////////////////////////////////////////////// +*/ + +class menu_item; // Forward declaration. + +class menu_container : public window +{ + +protected: + + enum {Horizontal, Vertical} mode; + +public: + + menu_item *shown_by; + + /* + * Both constructors perform the same function. Create a window + * with default size, set the background color and solicit + * StructureNotify events. + * Note that the size of the menu_container is eventually determined + * by the sizes of the menu items. + */ + + menu_container() : window(0, 0, 50, 100, 1) + { + shown_by = 0; + + Background(menu_normal); + SelectInput(StructureNotifyMask, 1); + } + + menu_container(window &frame) : window(frame, 0, 0, 100, 15) + { + shown_by = 0; + + Background(menu_normal); + SelectInput(StructureNotifyMask, 1); + } + + void RearrangeItems(unsigned &overall_width, unsigned &overall_height); + + /* + * The position of a sub-menu depends on the mode. Horizontal menus + * put submenus below the item, vertical menus put a submenu right + * of the item. + */ + + void PositionSubmenu(int &x, int &y, unsigned w, unsigned h) + { + if (mode == Horizontal) + y += h - 3; + else + x += w - 5; + } + + /* + * Submenu management. + */ + + void HideSubmenus(void); + + void Show(menu_item *by, int x, int y); + +}; + + +/* +/////////////////////////////////////////////////////////////////////////// +// NAME : menu_item +// BASECLASS : window +// MEMBERS : +// OPERATORS : +// METHODS : +// +// DESCRIPTION : +// +// RELATIONS : +// SEE ALSO : +// LAST MODIFIED : +/////////////////////////////////////////////////////////////////////////// +*/ + +class menu_item : public window +{ + int command_code; + +protected: + + int highlighted; + int enabled; + + menu_container *popup; + +public: + + menu_item(window &bar, int cc, int en = 1) : window(bar, 0, 0, 50, 15, 0) + { + highlighted = 0; + enabled = en; + command_code = cc; + popup = 0; + + SelectInput(ExposureMask, 1); + Background(menu_normal); + SelectInput(ButtonReleaseMask|EnterWindowMask|LeaveWindowMask, enabled); + } + + virtual void redraw(void); + + virtual int EV_Expose(XExposeEvent ev) + { + redraw(); + return 1; + } + + virtual int EV_EnterNotify(XCrossingEvent ev); + virtual int EV_LeaveNotify(XCrossingEvent ev); + virtual int EV_ButtonRelease(XButtonEvent ev); + + void HideSubmenu(void); + void ShowSubmenu(int x, int y); + + void Popup(menu_container *pop) + { + popup = pop; + } + + void Enable(int e) + { + enabled = e; + SelectInput(EnterWindowMask, e); + } + +}; + +/* +/////////////////////////////////////////////////////////////////////////// +// NAME : menu_bar +// BASECLASS : menu_container +// MEMBERS : +// OPERATORS : +// METHODS : +// +// DESCRIPTION : +// +// RELATIONS : +// SEE ALSO : +// LAST MODIFIED : +/////////////////////////////////////////////////////////////////////////// +*/ + +class menu_bar : public menu_container +{ +public: + + menu_bar(window &frame) : menu_container(frame) + { + mode = Horizontal; + } + + + virtual int ParentResized(int w, int h) + { + unsigned width, height; + + RearrangeItems(width, height); + + // Resize to fit the parent window + + Resize(w-2, height); + + return 1; + } +}; + + +/* +/////////////////////////////////////////////////////////////////////////// +// NAME : popup_menu +// BASECLASS : menu_container +// MEMBERS : +// OPERATORS : +// METHODS : +// +// DESCRIPTION : +// +// RELATIONS : +// SEE ALSO : +// LAST MODIFIED : +/////////////////////////////////////////////////////////////////////////// +*/ + +class popup_menu: public menu_container +{ +public: + + popup_menu() : menu_container() + { + XSetWindowAttributes attrib; + unsigned long mask; + + attrib.override_redirect = True; + mask = CWOverrideRedirect; + + XChangeWindowAttributes(stddpy.Dpy(), ID(), mask, &attrib); + mode = Vertical; + } + + virtual int EV_ConfigureNotify(XConfigureEvent ev) + { + unsigned width, height; + + RearrangeItems(width, height); + + Resize(width, height); + + return 1; + } + +}; + + +/* +/////////////////////////////////////////////////////////////////////////// +// NAME : menu_label +// BASECLASS : menu_item +// MEMBERS : +// OPERATORS : +// METHODS : +// +// DESCRIPTION : +// +// RELATIONS : +// SEE ALSO : +// LAST MODIFIED : Mar 07, 1998 +/////////////////////////////////////////////////////////////////////////// +*/ + +class menu_label : public menu_item +{ + char *label; + +public: + + menu_label(window &bar, char *text, int cc = 0) : menu_item(bar, cc) + { + label = text; + int width = default_font.TextWidth(label) + 10; + int height = default_font.ascent() + default_font.descent() + 6; + Resize(width, height); + } + + virtual void redraw(void); +}; + +/* +/////////////////////////////////////////////////////////////////////////// +// NAME : menu_separator +// BASECLASS : menu_item +// MEMBERS : +// OPERATORS : +// METHODS : +// +// DESCRIPTION : +// +// RELATIONS : +// SEE ALSO : +// LAST MODIFIED : +/////////////////////////////////////////////////////////////////////////// +*/ + +class menu_separator : public menu_item +{ +public: + + menu_separator(window &bar) : menu_item(bar, 0, 0) + { + Resize(2, 7); + } + + virtual void redraw(void); +}; + diff --git a/src/money.h b/src/money.h new file mode 100644 index 0000000..44f7010 --- /dev/null +++ b/src/money.h @@ -0,0 +1,122 @@ +/************************************************************************** +** (c) Copyright 1999, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : money.h +** SYSTEM NAME : Andromeda X-Windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : Financial classes +** +** EXPORTED OBJECTS : class amount +** LOCAL OBJECTS : +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Aug 26, 1999 +** LAST UPDATE : Aug 26, 1999 +** MODIFICATIONS : +**************************************************************************/ + +/***************************** + $Log: money.h,v $ + Revision 1.1 2002-07-25 08:01:27 arjen + First checkin, AXE release 0.2 + +*****************************/ + +// static const char RCSID[] = "$Id: money.h,v 1.1 2002-07-25 08:01:27 arjen Exp $"; + +#ifndef MONEY_H +#define MONEY_H + +#include +#include +#include "String.h" + +/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +** NAME : amount - Encapsulate an amount of money +** MEMBERS : value - The monetary value (in cents) +** OPERATORS : +** ostream << : String to output stream. +** istream << : String from input stream. +** METHODS : +** +** DESCRIPTION : +** +** RELATIONS : +** SEE ALSO : +** LAST MODIFIED : Aug 26, 1999 +**+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +*/ + +class amount +{ + unsigned long value; + +public: + + amount() + { + value = 0; + } + + amount(unsigned long l) + { + value = l; + } + + amount(String s); + + operator long() + { + return value; + } + + operator String(); + String make_string(void); + + amount operator+(amount a) + { + amount sum; + + sum.value = value + a.value; + return sum; + } + + amount operator *= (double f) + { + double v; + + v = rint(value * f); + value = (unsigned long)v; + + return *this; + } + + amount operator /= (double f) + { + double v; + + v = rint(value / f); + value = (unsigned long)v; + + return *this; + } + + amount &operator+=(amount a) + { + value += a.value; + + return *this; + } + + friend istream &operator>>(istream&, amount &); + friend ostream &operator<<(ostream&, amount); + +}; + +#endif /* MONEY_H */ diff --git a/src/nopicture.xpm b/src/nopicture.xpm new file mode 100644 index 0000000..c608b87 --- /dev/null +++ b/src/nopicture.xpm @@ -0,0 +1,44 @@ +/* XPM */ +static char * nopicture_xpm[] = { +"29 32 9 1", +" c None", +". c #838183", +"+ c #C5C2C5", +"@ c #FFFFFF", +"# c #008200", +"$ c #000000", +"% c #313062", +"& c #FF65CD", +"* c #FF6531", +".....................++++++++", +".@@@@@@@@@@@@@@@@@@@..+++++++", +".@@@@@@@@@@@@@@@@@@@.+.++++++", +".@@+++++++++++++++++.@+.+++++", +".@@+++++++++++++++++.@@+.++++", +".@@++++++++#####++++.@@@+.+++", +".@@+++++++#######+++.@@@@+.++", +".@@++++++#########++.@@@@@+.+", +".@@++++++#########++$$$$$$$$+", +".@@++++++#########+++%%%%%%$.", +".@@++++++#########++++.....$.", +".@@++++++#########+++++++@@$.", +".@@+++++++#######++++++++@@$.", +".@@+&++++++#####+++++++++@@$.", +".@@+&&+++++++++++++++++++@@$.", +".@@+&&&++++++++++++++++++@@$.", +".@@+&&&&+++++++++++++++++@@$.", +".@@+&&&&&++++++********++%%$.", +".@@+&&&&&&+++++******+++%%..+", +".@@+&&&&&&&++++*****++%%%.+++", +".@@+&&&&&&+++++**+++%%%..++++", +".@@+&&&&&++++++++++%%..++++++", +".@@+&&&&++++++%%%%$%.++++++$.", +".@@+&&&++++++%%....+++++++.$.", +".@@+&&+++++++%.++++++++++.@$.", +".@@+&++++%%%%%.+++++++++.@@$.", +".@@++++++%...+++++++++..+@@$.", +".@@+++++%%.++++++++.+++++@@$.", +".@@@@@%%..++++++++.+@@@@@@@$.", +".@@@@%%.++++++++++@@@@@@@@@$.", +"$$$$$$.+++++++++$$$$$$$$$$$$.", +"+......++++++++++............"}; diff --git a/src/out.cpp b/src/out.cpp new file mode 100644 index 0000000..4dc2fc8 --- /dev/null +++ b/src/out.cpp @@ -0,0 +1,172 @@ +/*ident "@(#)cfront:lib/stream/out.c 1.5" */ +/* + C++ stream i/o source + + out.c +*/ + +#include +#include +extern "C" unsigned int strlen(const char*); +#include + + +const int cb_size = 1024; +const int fld_size = 256; + +/* a circular formating buffer */ +static char formbuf[cb_size]; // some slob for form overflow +static char* bfree=formbuf; +static char* max = &formbuf[cb_size-1]; + +char* chr(register int i, register int w) // note: chr(0) is "" +{ + register char* buf = bfree; + + if (w<=0 || fld_size>=4)); + while (0>=4); + } + return p+1; +} + +char* oct(long ii, int w) +{ + int m = sizeof(long)*3; // maximum oct digits for a long + if (w<0 || fld_size>=3)); + while (0>=3); + } + + return p+1; +} + +char* dec(long i, int w) +{ + int sign = 0; + if (i < 0) { + sign = 1; + i = -i; + } + int m = sizeof(long)*3; // maximum dec digits for a long + if (w<0 || fld_size + * + * char date; + * struct parseddate *pd; + * + * pd = parsedate (date); + * + * compute_unixtime (pd); + * + * break_down_unixtime (pd); + * + * date = mail_date_string (pd); + * + * date = uucp_date_string (pd); + * + * Notes: + * + * The returned value from "parsedate", "mail_date_string", or + * "uucp_date_string" points to static data whose contents are + * overwritten by the next call to the same routine. + * + * "compute_unixtime" is implicitly called by "parsedate". + * + * Global contents: + * + * struct parseddate *parsedate (date) char *date; + * Parse a character string representing a date and time into + * individual values in a "struct parseddate" data structure. + * + * compute_unixtime (pd) struct parseddate *pd; + * Given a mostly filled-in "struct parseddate", compute the day + * of the week and the internal UNIX representation of the date. + * + * break_down_unixtime (pd) struct parseddate *pd; + * Compute the date and time corresponding to the "unixtime" and + * "zone" values in a "struct parseddate". + * + * char *mail_date_string (pd) struct parseddate *pd; + * Generate a character string representing a date and time in + * the RFC822 (ARPANET mail standard) format. + * + * char *uucp_date_string (pd) struct parseddate *pd; + * Generate a character string representing a date and time in + * the UUCP mail format. + * + * Local contents: + * + * None. + */ + +#include +#include "parsedate.h" + +static char *RCSID = "$Id: parsedate.c,v 1.1 2002-07-25 08:01:27 arjen Exp $"; + +extern int yyparse(); + +compute_unixtime (register struct parseddate *pd); + +/* Number of seconds in various time intervals. */ +#define SEC_PER_MIN 60 +#define SEC_PER_HOUR (60*SEC_PER_MIN) +#define SEC_PER_DAY (24*SEC_PER_HOUR) +#define SEC_PER_YEAR (365*SEC_PER_DAY) + +/* Number of days in each month. */ +static int monthsize[] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 }; + +/* Three-letter abbreviations of month and day names. */ +static char monthname[] = "JanFebMarAprMayJunJulAugSepOctNovDec"; +static char dayname[] = "SunMonTueWedThuFriSat"; + +/* struct parseddate *parsedate (date) char *date; + * Analyze a character string representing a date and time. The + * returned value points to a data structure with the desired + * information. (NOTE: The returned value points to static data + * whose contents are overwritten by each call.) + */ +struct parseddate * parsedate (char *date) +{ register char *c; + register int year_save; + extern struct parseddate yyans; + extern char *yyinbuf; + + /* Initialize the returned-value structure. */ + yyans.unixtime = -1; + yyans.year = -1; + yyans.month = -1; + yyans.day = -1; + yyans.hour = -1; + yyans.minute = -1; + yyans.second = -1; + yyans.zone = -1; + yyans.dst = -1; + yyans.weekday = -1; + yyans.c_weekday = -1; + yyans.error = NULL; + + /* Parse the argument string. */ + yyinbuf = date; + if (yyparse () != 0 && yyans.error == NULL) + yyans.error = yyinbuf; + + /* Validate the day of the month, compute/validate the day of the + * week, and compute the internal UNIX form of the time. See if + * "compute_unixtime" found fault with the year or the day of the + * month. (Note that we have to remember the original "year" value + * because it might legitimately have been -1 to begin with.) + */ + year_save = yyans.year; compute_unixtime (&yyans); + if (yyans.error == NULL + && (yyans.year != year_save + || (yyans.month > 0 && yyans.day < 0) + || (yyans.month < 0 && yyans.day > 0))) + yyans.error = yyinbuf; + + return &yyans; +} + +/* compute_unixtime (pd) struct parseddate *pd; + * Given a mostly filled-in "struct parseddate", compute the day of + * the week and the internal UNIX representation of the date. + * + * A year before 1600 will be rejected and replaced with -1. A + * date from 1600 on which falls outside the range representable in + * internal UNIX form will still have the correct day of the week + * computed. + * + * The day of the week is always computed on the assumption that the + * Gregorian calendar is in use. Days of the week for dates in the + * far future may turn out to be incorrect if any changes are made + * to the calendar between now and then. + */ +compute_unixtime (register struct parseddate *pd) +{ + register int weekday, n, l, a; + + /* Validate the year. */ + if (pd->year >= 0 && pd->year < 1600) pd->year = -1; + + /* Validate the day of the month. Also calculate the number of days + * in February (even if this is not February, we will need the num- + * ber of days in February later on when computing the UNIX time). + */ + if (pd->month > 0) + { if (pd->year < 0) monthsize[2] = 29; + else if (pd->year % 4 != 0) monthsize[2] = 28; + else if (pd->year % 100 != 0) monthsize[2] = 29; + else if (pd->year % 400 != 0) monthsize[2] = 28; + else monthsize[2] = 29; + if (pd->day <= 0 || pd->day > monthsize[pd->month]) + pd->day = -1; + } + + /* Compute the day of the week. The next several lines constitute a + * perpetual-calendar formula. Note, of course, that the "claimed" + * day of the week (pd->c_weekday) is ignored here. + */ + if (pd->year > 0 && pd->month > 0 && pd->day > 0) + { if (pd->month >= 3) n = pd->year / 100, + l = pd->year % 100; + else n = (pd->year-1) / 100, + l = (pd->year-1) % 100; + a = (26 * ((pd->month+9)%12 + 1) - 2) / 10; + weekday = (a+(l>>2)+(n>>2)+l-(n+n)+pd->day); + while (weekday < 0) weekday += 7; + pd->weekday = weekday % 7; + } + + /* Figure out the internal UNIX form of the date. */ + if (pd->year >= 1969 && pd->year <= 2038 + && pd->month > 0 && pd->day > 0 + && pd->hour >= 0 && pd->minute >= 0 + && pd->zone != -1 && pd->zone > -1440 && pd->zone < 1440) + { pd->unixtime = + SEC_PER_YEAR * (pd->year - 1970) + + SEC_PER_DAY * ((pd->year - 1969) / 4) + /* month is taken care of later */ + + SEC_PER_DAY * (pd->day - 1) + + SEC_PER_HOUR * pd->hour + + SEC_PER_MIN * pd->minute + /* seconds are taken care of later */ + - SEC_PER_MIN * pd->zone; + if (pd->second >= 0) + pd->unixtime += pd->second; + for (n = pd->month - 1; n > 0; n--) + pd->unixtime += SEC_PER_DAY * monthsize[n]; + if (pd->unixtime < 0) pd->unixtime = -1; + } + else pd->unixtime = -1; +} + +/* break_down_unixtime (pd) struct parseddate *pd; + * Given the "unixtime" and "zone" fields of a "struct parseddate", + * compute the values of the "year", "month", "day", "hour", "min- + * ute", "second", and "weekday" fields. The "dst" and "error" + * fields of the structure are not used or modified. + */ +break_down_unixtime (pd) + register struct parseddate *pd; +{ register unsigned long timevalue; + register int m, n; + + /* Validate the "unixtime" and "zone" fields. */ + if (pd->unixtime < 0 + || pd->zone == -1 || pd->zone <= -1440 || pd->zone >= 1440) + { /* Sorry, can't do it. */ + pd->year = -1; pd->month = -1; pd->day = -1; + pd->hour = -1; pd->minute = -1; pd->second = -1; + pd->weekday = -1; + return; + } + + /* Even though "pd->unixtime" must be non-negative, and thus cannot + * indicate a time earlier than 1970, a negative "pd->zone" could + * cause the local date to be Wednesday, 31 December 1969. Such a + * date requires special handling. + * + * A local date earlier than 31 December 1969 is impossible because + * "pd->zone" must represent a time-zone shift of less than a day. + */ + if (pd->zone < 0 && pd->unixtime + SEC_PER_MIN * pd->zone < 0) + { pd->year = 1969; pd->month = 12; pd->day = 31; + pd->weekday = 3; /* Wednesday */ + timevalue = pd->unixtime + SEC_PER_MIN * pd->zone + SEC_PER_DAY; + /* Note: 0 <= timevalue < SEC_PER_DAY */ + pd->hour = timevalue / SEC_PER_HOUR; + pd->minute = (timevalue % SEC_PER_HOUR) / SEC_PER_MIN; + pd->second = timevalue % SEC_PER_MIN; + return; + } + + /* Handle the general case (local time is 1970 or later). */ + timevalue = pd->unixtime + SEC_PER_MIN * pd->zone; + + /* day of the week (1 January 1970 was a Thursday) . . . */ + pd->weekday = (timevalue/SEC_PER_DAY + 4 /* Thursday */) % 7; + + /* year (note that the only possible century year here is 2000, + * a leap year -- hence no special tests for century years are + * needed) . . . + */ + for (m = 1970; ; m++) + { n = (m%4==0) ? SEC_PER_YEAR+SEC_PER_DAY : SEC_PER_YEAR; + if (n > timevalue) break; + timevalue -= n; + } + pd->year = m; + monthsize[2] = (m%4==0) ? 29 : 28; + + /* month . . . */ + for (m = 1; ; m++) + { n = SEC_PER_DAY * monthsize[m]; + if (n > timevalue) break; + timevalue -= n; + } + pd->month = m; + + /* day, hour, minute, and second . . . */ + pd->day = (timevalue / SEC_PER_DAY) + 1; + pd->hour = (timevalue % SEC_PER_DAY) / SEC_PER_HOUR; + pd->minute = (timevalue % SEC_PER_HOUR) / SEC_PER_MIN; + pd->second = timevalue % SEC_PER_MIN; +} + +/* char *mail_date_string (pd) struct parseddate *pd; + * Generate a character string representing a date and time in the + * RFC822 (ARPANET mail standard) format. A value of NULL is re- + * turned if "pd" does not contain all necessary data fields. + * (NOTE: The returned value points to static data whose contents + * are overwritten by each call.) + */ +char * +mail_date_string (pd) + register struct parseddate *pd; +{ register char *c; + static char answer[50]; + + /* Check the day of the month and compute the day of the week. */ + compute_unixtime (pd); + + /* Make sure all required fields are present. */ + if (pd->year < 0 || pd->month < 0 || pd->day < 0 + || pd->hour < 0 || pd->minute < 0 + || pd->zone == -1 || pd->zone <= -1440 || pd->zone >= 1440) + return NULL; /* impossible to generate string */ + + /* Generate the answer string. */ + sprintf (answer, + "%.3s, %d %.3s %d %02d:%02d", + dayname + 3*pd->weekday, + pd->day, monthname + 3*(pd->month-1), + (pd->year >= 1960 && pd->year <= 1999) + ? pd->year - 1900 : pd->year, + pd->hour, pd->minute); + c = answer + strlen (answer); + if (pd->second >= 0) sprintf (c, ":%02d", pd->second), c += 3; + *c++ = ' '; + switch (pd->zone) + { /* NOTE: Only zone abbreviations in RFC822 are used here. */ + case 0: strcpy (c, pd->dst ? "+0000" : "GMT"); break; + case -240: strcpy (c, pd->dst ? "EDT" : "-0400"); break; + case -300: strcpy (c, pd->dst ? "CDT" : "EST"); break; + case -360: strcpy (c, pd->dst ? "MDT" : "CST"); break; + case -420: strcpy (c, pd->dst ? "PDT" : "MST"); break; + case -480: strcpy (c, pd->dst ? "-0800" : "PST"); break; + default: + if (pd->zone >= 0) + sprintf (c, "+%02d%02d", pd->zone/60, pd->zone%60); + else sprintf (c, "-%02d%02d", -pd->zone/60, -pd->zone%60); + } + + return answer; +} + +/* char *uucp_date_string (pd) struct parseddate *pd; + * Generate a character string representing a date and time in the + * UUCP mail format. A value of NULL is returned if "pd" does not + * contain all necessary data fields. (NOTE: The returned value + * points to static data whose contents are overwritten by each + * call.) + */ +char * +uucp_date_string (pd) + register struct parseddate *pd; +{ register char *c; + static char answer[50]; + + /* Check the day of the month and compute the day of the week. */ + compute_unixtime (pd); + + /* Make sure all required fields are present. */ + if (pd->year < 0 || pd->month < 0 || pd->day < 0 + || pd->hour < 0 || pd->minute < 0 + || pd->zone == -1 || pd->zone <= -1440 || pd->zone >= 1440) + return NULL; /* impossible to generate string */ + + /* Generate the answer string. */ + sprintf (answer, + "%.3s %.3s %d %02d:%02d", + dayname + 3*pd->weekday, + monthname + 3*(pd->month-1), pd->day, + pd->hour, pd->minute); + c = answer + strlen (answer); + if (pd->second >= 0) sprintf (c, ":%02d", pd->second), c += 3; + switch (pd->zone) + { /* NOTE: Only zone abbreviations in RFC822 are used here. */ + case 0: strcpy (c, pd->dst ? "+0000" : "-GMT"); break; + case -240: strcpy (c, pd->dst ? "-EDT" : "-0400"); break; + case -300: strcpy (c, pd->dst ? "-CDT" : "-EST"); break; + case -360: strcpy (c, pd->dst ? "-MDT" : "-CST"); break; + case -420: strcpy (c, pd->dst ? "-PDT" : "-MST"); break; + case -480: strcpy (c, pd->dst ? "-0800" : "-PST"); break; + default: + if (pd->zone >= 0) + sprintf (c, "+%02d%02d", pd->zone/60, pd->zone%60); + else sprintf (c, "-%02d%02d", -pd->zone/60, -pd->zone%60); + } + c = answer + strlen (answer); + sprintf (c, " %d", pd->year); + + return answer; +} diff --git a/src/parsedate.h b/src/parsedate.h new file mode 100644 index 0000000..173f1fa --- /dev/null +++ b/src/parsedate.h @@ -0,0 +1,43 @@ + +/* Data structure returned by "parseddate". + * + * A value of NULL for "error" means that no syntax errors were detected + * in the argument value. A non-NULL value points to the byte position + * within the argument string at which it was discovered that an error + * existed. + * + * A value of -1 means that the field was never given a value, or that + * the value supplied was invalid. (A side effect of this convention is + * that a time zone offset of -1 -- i.e., one minute west of GMT -- is + * indistinguishable from an invalid or unspecified time zone offset. + * Since the likelihood of "-0001" being a legitimate time zone is nil, + * banning it is a small price to pay for the uniformity of using -1 as + * a "missing/invalid" indication for all fields.) + */ + +#ifdef __cplusplus +extern "C" { +#endif + +struct parseddate +{ + long unixtime; /* UNIX internal representation of time */ + char *error; /* NULL = OK; non-NULL = error */ + int year; /* year (1600 on) */ + int month; /* month (1-12) */ + int day; /* day of month (1-31) */ + int hour; /* hour (0-23) */ + int minute; /* minute (0-59) */ + int second; /* second (0-59) */ + int zone; /* time zone offset in minutes -- "+" or "-" */ + int dst; /* daylight savings time (0 = no, 1 = yes) */ + int weekday; /* real day of week (0-6; 0 = Sunday) */ + int c_weekday; /* claimed day of week (0-6; 0 = Sunday) */ +}; + +struct parseddate *parsedate(char *date); + +#ifdef __cplusplus +} +#endif + diff --git a/src/pattern.h b/src/pattern.h new file mode 100644 index 0000000..2777b5b --- /dev/null +++ b/src/pattern.h @@ -0,0 +1,78 @@ +/************************************************************************** +** (c) Copyright 1998, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : pattern.h +** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : Definition of patterning classes: stipple, tile +** +** EXPORTED OBJECTS : class stipple +** LOCAL OBJECTS : +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Feb 25, 1998 +** LAST UPDATE : Feb 25, 1998 +** MODIFICATIONS : +**************************************************************************/ + +/***************************** + $Log: pattern.h,v $ + Revision 1.1 2002-07-25 08:01:27 arjen + First checkin, AXE release 0.2 + +*****************************/ + +/* static const char *RCSID = "$Id: pattern.h,v 1.1 2002-07-25 08:01:27 arjen Exp $"; */ + +#include +#include "display.h" + +/* +/////////////////////////////////////////////////////////////////////////// +// NAME : stipple +// BASECLASS : +// MEMBERS : Pixmap pixm; +// OPERATORS : +// METHODS : +// +// DESCRIPTION : +// +// RELATIONS : +// SEE ALSO : +// LAST MODIFIED : Feb 25, 1998 +/////////////////////////////////////////////////////////////////////////// +*/ + +class stipple +{ + Pixmap pixm; + +public: + + stipple() + { + pixm = 0; + } + + stipple(char *data, unsigned int w, unsigned int h) + { + pixm = XCreateBitmapFromData(stddpy, stddpy.Root(), data, w, h); + } + + ~stipple() + { + XFreePixmap(stddpy, pixm); + } + + operator Pixmap() + { + return pixm; + } +}; + diff --git a/src/pinguin.xpm b/src/pinguin.xpm new file mode 100644 index 0000000..a163e06 --- /dev/null +++ b/src/pinguin.xpm @@ -0,0 +1,63 @@ +/* XPM */ +static char * pinguin_xpm[] = { +"44 44 16 1", +" c None", +". c #FFFFFF", +"+ c #887878", +"@ c #080808", +"# c #686468", +"$ c #C0C4C8", +"% c #9094A0", +"& c #F0E8E0", +"* c #484C50", +"= c #D8D0D0", +"- c #484838", +"; c #B0B4B8", +"> c #C03808", +", c #F0C008", +"' c #E88C70", +") c #E0A000", +"............................................", +".........................+@@@#$.............", +".......................$@@@@@@@%............", +"......................&@@@@@@**@%...........", +"......................%@@@@@@@@@@...........", +"......................+@@@@@@@@@@=..........", +"......................+@$-@@;&-@@%..........", +"......................+#;$@;=%;@@%..........", +"......................%*@%@%-@$@@+..........", +"......................%**>,,>-;@@*..........", +"......................$-,,,',,)@@-..........", +"......................;-),,)>)>@@@..........", +"......................$@>))>>)+@%@;.........", +"......................=*$>>>)=.@@@@.........", +"......................@%.;%$...;@@@$........", +".....................--..&=.....-@@@&.......", +"....................=@;.........$@@@@.......", +"...................=@@$..&&.&===&@@@@#......", +"...................@@-..&.....===+@@@@$.....", +"...................@@=.....&......@@@@-.....", +"..................+@-.............*@@@@.....", +"..................@@$.......&.....+@@@@;....", +".................&@-..&..&&.......'@@@@+....", +".................@@#.....&........$@@@@@....", +"................+@@+...&.&.....&..=@@@@@....", +"................%--%.........&....$@@@@@....", +"................&,,-;...&&.......')@@@@)....", +"...............&),,)@+......&....))@@@-,....", +".............&=>),),>@%..&......$))-@-),&...", +"............'),,,),,,-@#.....&..$>)))),,,...", +"............'),,))),,,@@...&.&..$>))),,))'..", +"............=>,),)),),);..&....;@>,,,),)),).", +"............'),,),)),,)=......%@@>,,),),,),.", +".............),,,,,,),,-#;;%+@@@@),,,,,),'..", +".............)>>))),,,)>@@@@@@@@->,,,))=....", +"...............=)>>))>>-*+$$$$=;#>>)>>......", +"..................&>---$..........->-=......", +".....................&=.....................", +"............................................", +"............................................", +"............................................", +"............................................", +"............................................", +"............................................"}; diff --git a/src/pixmap.h b/src/pixmap.h new file mode 100644 index 0000000..08f605f --- /dev/null +++ b/src/pixmap.h @@ -0,0 +1,157 @@ +/************************************************************************** +** (c) Copyright 1998, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : pixmap.h +** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : Definition of pixmap classes: pixmap, bitmap +** +** EXPORTED OBJECTS : class pixmap +** LOCAL OBJECTS : +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Jul 13, 2000 +** MODIFICATIONS : +**************************************************************************/ + +/***************************** + $Log: pixmap.h,v $ + Revision 1.1 2002-07-25 08:01:27 arjen + First checkin, AXE release 0.2 + +*****************************/ + +/* static const char *RCSID = "$Id: pixmap.h,v 1.1 2002-07-25 08:01:27 arjen Exp $"; */ + +#ifndef AXE_PIXMAP_H +#define AXE_PIXMAP_H + +#include +#include +#include "display.h" + +/* +/////////////////////////////////////////////////////////////////////////// +// NAME : pixmap +// BASECLASS : +// MEMBERS : Pixmap pixm; +// OPERATORS : +// METHODS : +// +// DESCRIPTION : +// +// RELATIONS : +// SEE ALSO : +// LAST MODIFIED : Jul 13, 2000 +/////////////////////////////////////////////////////////////////////////// +*/ + +class pixmap +{ + Pixmap pixm; + unsigned w, h; // Size of the pixmap + +public: + + pixmap() + { + pixm = 0; + } + + pixmap(char *data, unsigned int w, unsigned int h) + { + pixm = XCreateBitmapFromData(stddpy, stddpy.Root(), data, w, h); + } + + pixmap(char *filename) + { + XpmAttributes attr; + + attr.valuemask = 0; + + XpmReadFileToPixmap(stddpy, stddpy.Root(), filename, &pixm, NULL, &attr); + w = attr.width; + h = attr.height; + } + + pixmap(char *data[]) + { + XpmAttributes attr; + + attr.valuemask = 0; + + XpmCreatePixmapFromData(stddpy, stddpy.Root(), data, &pixm, NULL, &attr); + w = attr.width; + h = attr.height; + } + + ~pixmap() + { + if (pixm != 0) + { + XFreePixmap(stddpy, pixm); + } + } + + void read(char *filename) + { +extern pixmap nopicture; + XpmAttributes attr; + int error; + + if (pixm != 0) + { + XFreePixmap(stddpy, pixm); + } + + attr.valuemask = 0; + error = XpmReadFileToPixmap(stddpy, stddpy.Root(), filename, &pixm, NULL, &attr); + if (error != XpmSuccess) + { + cerr << "Error " << error << " reading XPM file " << filename << "\n"; + pixm = nopicture.pixm; + w = nopicture.w; + h = nopicture.h; + } + else + { + w = attr.width; + h = attr.height; + } + } + + void create(char *data[]) + { + XpmAttributes attr; + + if (pixm != 0) + { + XFreePixmap(stddpy, pixm); + } + + attr.valuemask = 0; + + XpmCreatePixmapFromData(stddpy, stddpy.Root(), data, &pixm, NULL, &attr); + w = attr.width; + h = attr.height; + } + + operator Pixmap() const + { + return pixm; + } + + size Size() const + { + return size(w, h); + } +}; + + +#endif /* AXE_PIXMAP_H */ diff --git a/src/regex.cpp b/src/regex.cpp new file mode 100644 index 0000000..e3b4311 --- /dev/null +++ b/src/regex.cpp @@ -0,0 +1,62 @@ +/************************************************************************** +** (c) Copyright 2001, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : regex.cpp +** SYSTEM NAME : Andromeda X-Windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : regex class implementation. +** +** EXPORTED OBJECTS : +** LOCAL OBJECTS : +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Feb 23, 2001 +** LAST UPDATE : Feb 23, 2001 +** MODIFICATIONS : +**************************************************************************/ + +/***************************** + $Log: regex.cpp,v $ + Revision 1.1 2002-07-25 08:01:27 arjen + First checkin, AXE release 0.2 + +*****************************/ + +static const char RCSID[] = "$Id: regex.cpp,v 1.1 2002-07-25 08:01:27 arjen Exp $"; + +#include +#include +#include "String.h" + + // Constructors and destructors for the regex class + +regex::regex(const String ®) +{ + regcomp (&expression, reg.p->s, REG_EXTENDED); +} + +regex::regex(const char *reg) +{ + regcomp (&expression, reg, REG_EXTENDED); +} + +regex::~regex() +{ + regfree(&expression); +} + + +bool operator == (const String &s, const regex &r) +{ + return regexec(&r.expression, s.p->s, 0, 0, 0) == 0; +} +bool operator == (const regex &r, const String &s) +{ + return regexec(&r.expression, s.p->s, 0, 0, 0) == 0; +} diff --git a/src/regfile.xpm b/src/regfile.xpm new file mode 100644 index 0000000..c3752fd --- /dev/null +++ b/src/regfile.xpm @@ -0,0 +1,19 @@ +/* XPM */ +static char * regfile_xpm[] = { +"16 13 3 1", +" c #FFFFFFFFFFFF", +". c #000000000000", +"X c #0000FFFFFFFF", +" ..........", +" ..XXXXXXXX.", +" ...XXXXXXXX.", +" .XX.XXXXXXXX.", +" .XXX.XXXXXXXX.", +" ..XXX.XXXXXXXX.", +".......XXXXXXXX.", +".XXXXXXXXXXXXXX.", +".XXXXXXXXXXXXXX.", +".XXXXXXXXXXXXXX.", +".XXXXXXXXXXXXXX.", +".XXXXXXXXXXXXXX.", +"................"}; diff --git a/src/scroll.cpp b/src/scroll.cpp new file mode 100644 index 0000000..6db9bef --- /dev/null +++ b/src/scroll.cpp @@ -0,0 +1,147 @@ + +/************************************************************************** +** (c) Copyright 1998, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : scroll.cpp +** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : Implementation of scrollbar class. +** +** EXPORTED OBJECTS : +** LOCAL OBJECTS : +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Mar 20, 1998 +** LAST UPDATE : Apr 04, 1998 +** MODIFICATIONS : +**************************************************************************/ + +/***************************** + $Log: scroll.cpp,v $ + Revision 1.1 2002-07-25 08:01:27 arjen + First checkin, AXE release 0.2 + +*****************************/ + +static const char *RCSID = "$Id: scroll.cpp,v 1.1 2002-07-25 08:01:27 arjen Exp $"; + +#include "scroll.h" + +slider::slider(scrollbar *b) : frame(*b, 0, 0, 2) +{ + bar = b; + slide_start_y = 7; + Resize(14,14); + SelectInput(ButtonPressMask|Button1MotionMask|ButtonReleaseMask, 1); + Map(); +} + +/*========================================================================= +** NAME : EV_MotionNotify +** SYNOPSIS : +** PARAMETERS : +** RETURN VALUE : +** +** DESCRIPTION : Move the mouse in the slider with button 1 pressed. +** move_slider() cannot be used directly because the +** motion is in physical coordinates and move_slider() +** needs an offset in logical coordinates. The function +** scrollbar::map_mouse() performs the translation. +** +** VARS USED : +** VARS CHANGED : +** FUNCTIONS USED : +** SEE ALSO : +** LAST MODIFIED : Apr 04, 1998 +**========================================================================= +*/ + +int slider::EV_MotionNotify(XMotionEvent ev) +{ + bar->move_slider(bar->map_mouse(ev.y - slide_start_y)); + + return 1; +} + +/*========================================================================= +** NAME : move_slider +** SYNOPSIS : void scrollbar::move_slider(int offset) +** PARAMETERS : offset : change in the slider's position +** RETURN VALUE : None +** +** DESCRIPTION : Moves the slider within the scrollbar. Called when +** the mouse is clicked in the scrollbar or when the +** slider is dragged. +** The offset is in logical coordinates. +** +** VARS USED : +** VARS CHANGED : +** FUNCTIONS USED : +** SEE ALSO : +** LAST MODIFIED : Apr 04, 1998 +**========================================================================= +*/ + +void scrollbar::move_slider(int offset) +{ + int physical_position; + size scroll_size; + + position += offset; + + // Clip the slider in its range. + + if (position < 0) + position = 0; + if (position + slider_size > bar_size) + position = bar_size - slider_size; + + scroll_size = Size(); + physical_position = position * scroll_size.h / bar_size; + + sl->Move(0, physical_position); + ParentMessage(SCROLL_POSITIONED); +} + +/*========================================================================= +** NAME : SetSizes +** SYNOPSIS : +** PARAMETERS : +** RETURN VALUE : +** +** DESCRIPTION : +** +** VARS USED : +** VARS CHANGED : +** FUNCTIONS USED : +** SEE ALSO : +** LAST MODIFIED : Aug 30, 1999 +**========================================================================= +*/ + +void scrollbar::SetSizes(unsigned s_bar, unsigned s_slider) +{ + size scroll_size; + size physical_slider; + + // Needs to recalculate the position in logical coordinates. + + bar_size = s_bar; + slider_size = s_slider; + + scroll_size = Size(); + + physical_slider.w = 14; + physical_slider.h = slider_size * scroll_size.h / bar_size; + if (physical_slider.h < 5) + physical_slider.h = 5; + + sl->Resize(physical_slider); +} + diff --git a/src/scroll.h b/src/scroll.h new file mode 100644 index 0000000..fc5279f --- /dev/null +++ b/src/scroll.h @@ -0,0 +1,167 @@ + +/************************************************************************** +** (c) Copyright 1998, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : scroll.h +** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : Definition of scrollbar class. +** A scrollbar is a construction with two frames. The +** scrollbar itself and a slider that moves within +** the scrollbar. +** +** EXPORTED OBJECTS : +** LOCAL OBJECTS : +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Mar 20, 1998 +** LAST UPDATE : Oct 09, 1999 +** MODIFICATIONS : +**************************************************************************/ + +/***************************** + $Log: scroll.h,v $ + Revision 1.1 2002-07-25 08:01:27 arjen + First checkin, AXE release 0.2 + +*****************************/ + +/* static const char *RCSID = "$Id: scroll.h,v 1.1 2002-07-25 08:01:27 arjen Exp $"; */ + +#ifndef _SCROLL_H +#define _SCROLL_H + +#include "frame.h" + +class scrollbar; + +/* +/////////////////////////////////////////////////////////////////////////// +// NAME : slider +// BASECLASS : frame +// MEMBERS : +// OPERATORS : +// METHODS : +// +// DESCRIPTION : +// +// RELATIONS : +// SEE ALSO : +// LAST MODIFIED : Oct 09, 1999 +/////////////////////////////////////////////////////////////////////////// +*/ + +class slider : public frame +{ + scrollbar *bar; + + int slide_start_y; + +public: + + slider(scrollbar *b); + + virtual int EV_ButtonPress(XButtonEvent ev) + { + slide_start_y = ev.y; + + return 1; + } + + virtual int EV_ButtonRelease(XButtonEvent ev) + { + return 1; + } + + virtual int EV_MotionNotify(XMotionEvent ev); +}; + +/* +/////////////////////////////////////////////////////////////////////////// +// NAME : scrollbar +// BASECLASS : frame +// MEMBERS : +// OPERATORS : +// METHODS : +// +// DESCRIPTION : +// The bar_size, slider_size and position are defined +// in logical coordinates. +// The bar_size represents the size of the data being +// scrolled and corresponds to the total size of the +// scrollbar. The slider_size and position are mapped to +// physical coordinates using the ratio of the bar_size. +// +// physical coord = logical coord * window size / bar size. +// +// RELATIONS : +// SEE ALSO : +// LAST MODIFIED : Apr 03, 1998 +/////////////////////////////////////////////////////////////////////////// +*/ + +class scrollbar : public frame +{ + slider *sl; + + unsigned bar_size, slider_size; + + int position; + +public: + + scrollbar(window &par, unsigned size, int x, int y) + : frame(par, x, y, -2) + { + Resize(16, size); + bar_size = size; + slider_size = 16; + sl = new slider(this); + position = 0; + SelectInput(ButtonPressMask, 1); + } + + ~scrollbar() + { + delete sl; + } + + // Map physical pixel coordinate to logical coordinate. + + int map_mouse(int mouse) + { + size scroll_size = Size(); + int physical; + + physical = mouse * (int)bar_size / scroll_size.h; + + return physical; + } + + void move_slider(int offset); + + virtual int EV_ButtonPress(XButtonEvent ev) + { + if (map_mouse(ev.y) > position) + move_slider(slider_size); + else + move_slider(-slider_size); + + return 1; + } + + operator int() + { + return position; + } + + void SetSizes(unsigned s_bar, unsigned s_slider); +}; + +#endif /* _SCROLL_H */ diff --git a/src/shape.h b/src/shape.h new file mode 100644 index 0000000..002ae50 --- /dev/null +++ b/src/shape.h @@ -0,0 +1,156 @@ +/* + * C++ X Windows class library + */ + +#include + +class point +{ + short _x, _y; + +public: + + point() { _x = 0; _y = 0; } + + point(int x, int y) { _x = x; _y = y; } + + short x() { return _x; } + + short y() { return _y; } + +}; + + +class line +{ + int npoints; + int mode; + point *points; + + + void drawline(drawable &d); + +public: + + line() + { + npoints = 0; + mode = CoordModeOrigin; + } + + line(short x1, short y1, short x2, short y2) + { + npoints = 2; + mode = CoordModeOrigin; + points = new point[2]; + points[0] = point(x1, y1); + points[1] = point(x2, y2); + } + + line(point p1, point p2) + { + npoints = 2; + mode = CoordModeOrigin; + points = new point[2]; + points[0] = p1; + points[1] = p2; + } + + ~line() + { + if (npoints != 0) + delete [] points; + } + + point &operator[] (int index); + +}; + +class rectangle +{ + short x, y; + unsigned short width, height; + + +public: + + rectangle() + { + x = 0; + y = 0; + width = 0; + height = 0; + } + + rectangle(int _x, int _y, unsigned int _w, unsigned int _h) + { + x = _x; + y = _y; + width = _w; + height = _h; + } + + // Define a rectangle by its diagonal + + rectangle(point p1, point p2); + +}; + +class box +{ + short x, y; + unsigned short width, height; + +public: + + box() + { + x = 0; + y = 0; + width = 0; + height = 0; + } + + box(int _x, int _y, unsigned int _w, unsigned int _h) + { + x = _x; + y = _y; + width = _w; + height = _h; + } + + // Define a box by its diagonal + + box(point p1, point p2); + +}; + +class text +{ + short x, y; + String txt; + + +public: + + text() + { + x = 0; + y = 0; + } + + text(int _x, int _y, String str) + { + x = _x; + y = _y; + txt = str; + } + + text(point p, String s) + { + x = p.x(); + y = p.y(); + txt = s; + } + +}; diff --git a/src/string.cpp b/src/string.cpp new file mode 100644 index 0000000..6221f2f --- /dev/null +++ b/src/string.cpp @@ -0,0 +1,456 @@ +/************************************************************************** +** (c) Copyright 1997, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : string.cpp +** SYSTEM NAME : Andromeda X-Windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : String class implementation. +** +** EXPORTED OBJECTS : +** LOCAL OBJECTS : +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Nov 17, 1997 +** LAST UPDATE : Aug 26, 1999 +** MODIFICATIONS : +**************************************************************************/ + +/***************************** + $Log: string.cpp,v $ + Revision 1.1 2002-07-25 08:01:27 arjen + First checkin, AXE release 0.2 + +*****************************/ + +static const char RCSID[] = "$Id: string.cpp,v 1.1 2002-07-25 08:01:27 arjen Exp $"; + +#include +#include +#include "String.h" + + // Constructors and destructors for the String class + +String::String() // Create an empty String +{ + p = new srep; + p->s = 0; + p->n = 1; +} + +String::String(char c) // Create a String from a char +{ + p = new srep; + p->s = new char[2]; + p->s[0] = c; + p->s[1] = '\0'; + p->n = 1; +} + +String::String(const char *s) // Create a String from a char * +{ + p = new srep; + p->s = new char[strlen(s)+1]; + strcpy(p->s, s); + p->n = 1; +} + +String::String(const String& x) // Create a String from another String +{ + x.p->n++; + p = x.p; +} + +String::String(const substring &x) +{ + p = new srep; + + p->s = new char[x.len+1]; + strncpy(p->s, x.str->p->s+x.start, x.len); + p->s[x.len] = '\0'; // strncpy does not add the \0 + p->n = 1; +} + +String::~String() +{ + if (--p->n == 0) + { + delete p->s; + delete p; + } +} + +/* + * Assignment operators must handle cleanup of their left-hand operand. + */ + +String& String::operator=(const char c) +{ + if (p->n > 1) + { // Dsiconnect self + p->n--; + p = new srep; + } + else if (p->n == 1) + delete p->s; + + p->s = new char[2]; + p->s[0] = c; + p->s[1] = '\0'; + p->n = 1; + return *this; +} + +String& String::operator=(const char *s) +{ + if (p->n > 1) + { // Disconnect self + p->n--; + p = new srep; + } + else if (p->n == 1) + delete p->s; + + p->s = new char[strlen(s)+1]; + strcpy(p->s, s); + p->n = 1; + return *this; +} + +/* Make sure that assignment of an object to itself works correctly: */ + +String& String::operator=(const String& x) +{ + x.p->n++; + if (--p->n == 0) + { + delete p->s; + delete p; + } + + p = x.p; + return *this; +} + +/* Numerical conversion */ + +String::String(int i) +{ + p = new srep; + p->s = new char[15]; // A little longer than needed... + sprintf(p->s, "%d", i); + p->n = 1; +} + +String::String(long i) +{ + p = new srep; + p->s = new char[15]; // A little longer than needed... + sprintf(p->s, "%ld", i); + p->n = 1; +} + +String::String(unsigned long i) +{ + p = new srep; + p->s = new char[15]; // A little longer than needed... + sprintf(p->s, "%lu", i); + p->n = 1; +} + +String::String(double d) +{ + p = new srep; + p->s = new char[25]; // A little longer than needed... + sprintf(p->s, "%.3f", d); + p->n = 1; +} + +/* String concatenation */ + +String& String::operator+=(const String& x) +{ + char *s = new char[strlen(p->s) + strlen(x.p->s) + 1]; + + strcpy(s, p->s); + strcat(s, x.p->s); + + if (p->n > 1) + { // Disconnect self + p->n--; + p = new srep; + } + else if (p->n == 1) + delete p->s; + + p->s = s; + p->n = 1; + return *this; +} + +String& String::operator+=(const char * str) +{ + char *s = new char[strlen(p->s) + strlen(str) + 1]; + + strcpy(s, p->s); + strcat(s, str); + + if (p->n > 1) + { // Disconnect self + p->n--; + p = new srep; + } + else if (p->n == 1) + delete p->s; + + p->s = s; + p->n = 1; + return *this; +} + +String operator+(const String& x, const String& y) +{ + String cat = x; + + cat += y; + return cat; +} + +String operator+(const String& x, const char * y) +{ + String cat = x; + + cat += y; + return cat; +} + +String operator+(const char * x, const String& y) +{ + String cat = x; + + cat += y; + return cat; +} + +/* Shift operators */ + + +String operator<<(const String &x, int n) +{ + String s(x); + + s <<= n; + return s; +} + +String & String::operator<<=(int n) +{ + // Make sure we are the only one being shifted. + + if (p->n > 1) + { // Disconnect self + char *s = new char[strlen(p->s) + 1]; + + strcpy(s, p->s); + p->n--; + p = new srep; + p->s = s; + p->n = 1; + } + + // Shift left means we really have to copy all characters. + + int len = strlen(p->s); + int i; + + if (n >= len) + { + // Shift more than we have: the String becomes empty. + p->s[0] = '\0'; + } + else + { + for (i = 0; i <= len - n; i++) + { + p->s[i] = p->s[i+n]; + } + } + + return *this; +} + +String operator>>(const String &x, int n) +{ + String s(x); + + s >>= n; + return s; +} + +String & String::operator>>=(int n) +{ + // Make sure we are the only one being shifted. + + if (p->n > 1) + { // Disconnect self + char *s = new char[strlen(p->s) + 1]; + + strcpy(s, p->s); + p->n--; + p = new srep; + p->s = s; + p->n = 1; + } + + // Shift right is simple: just put the '\0' n places back. + + + int len = strlen(p->s); + + if (n >= len) + { + // Shift more than we have: the String becomes empty. + p->s[0] = '\0'; + } + else + { + p->s[len - n] = '\0'; + } + + return *this; +} + +/* Substring selection and assignment */ + +substring String::operator()(int start, int len) +{ + substring sub; + + sub.str = this; + sub.start = start; + sub.len = len; + return sub; +} + +String& substring::operator=(const String &x) +{ + char *s = new char[strlen(x.p->s) + ~*str - len + 1]; + + strncpy(s, str->p->s, start); + s[start] = '\0'; + strcat(s, x.p->s); + strcat(s, str->p->s+start+len); + + return *str = s; +} + +/* Input and output */ + +ostream& operator<<(ostream& s, const String& x) +{ + if (x.p->s) + s << x.p->s; + return s; +} + +istream& operator>>(istream& s, String& x) +{ + char buf[1024]; + int i; + + i = -1; + do + { + i++; + s.get(buf[i]); + } + while (buf[i] != '\n'); + buf[i] = '\0'; + x = buf; + return s; +} + +/* + * The subscript operator is provided for access to individual characters + */ + +char& String::operator[](int i) +{ + return p->s[i]; +} + +String String::upper(void) +{ + String up; + int i; + + up.p->s = new char[strlen(p->s)+1]; + + for(i=0; p->s[i]; i++) + { + up.p->s[i] = toupper(p->s[i]); + } + up.p->s[i] = '\0'; + + return up; +} + +String String::lower(void) +{ + String low; + int i; + + low.p->s = new char[strlen(p->s)+1]; + + for(i=0; p->s[i]; i++) + { + low.p->s[i] = tolower(p->s[i]); + } + low.p->s[i] = '\0'; + + return low; +} + +// Find the first occurance of 'c' + +int String::index(char c) +{ + char *found; + + found = strchr(p->s, c); + if (found) + return found - p->s; + else + return -1; +} + +// Find the last occurance of 'c' + +int String::rindex(char c) +{ + char *found; + + found = strrchr(p->s, c); + if (found) + return found - p->s; + else + return -1; +} + +/* In: see if I am part of x, return -1 if not found */ + +int String::in(String & x) +{ + char *match; + + match = strstr(x.p->s, p->s); + if (match) + return match - x.p->s; + else + return -1; +} diff --git a/src/table.cpp b/src/table.cpp new file mode 100644 index 0000000..aaccdd6 --- /dev/null +++ b/src/table.cpp @@ -0,0 +1,168 @@ +/************************************************************************** +** (c) Copyright 1999, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : table.cpp +** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : Implementation of table_view class +** +** EXPORTED OBJECTS : +** LOCAL OBJECTS : +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Aug 26, 1999 +** LAST UPDATE : Aug 26, 1999 +** MODIFICATIONS : +**************************************************************************/ + +/***************************** + $Log: table.cpp,v $ + Revision 1.1 2002-07-25 08:01:27 arjen + First checkin, AXE release 0.2 + +*****************************/ + +static const char *RCSID = "$Id: table.cpp,v 1.1 2002-07-25 08:01:27 arjen Exp $"; + +#include "table.h" + +void table_view::redraw(void) +{ + int i, j, x, y; + unsigned w, h; + unsigned desired_height; + unsigned font_height = 20; // For the time being... + + Size(w, h); + g.SetLineAttributes(2); + XDrawLine(stddpy, ID(), g, 0, 20, w, 20); + + // Determine if we need the scrollbar + + desired_height = (nr_rows + 1) * font_height; + if (desired_height > h) + { + unsigned visible_rows; + + visible_rows = (h - font_height) / font_height; + Vscroll->SetSizes(nr_rows, visible_rows); + Vscroll->Move(w-18, font_height+1); + Vscroll->Resize(16, h - font_height - 2); + Vscroll->Map(); + } + else + { + // All rows fit in the window + + Vscroll->Unmap(); + } + + // Draw the grid + + g.SetLineAttributes(0); + x = 0; + for (i = 0; i < nr_columns; i++) + { + x += Head[i].width; + XDrawLine(stddpy, ID(), g, x, 0, x, h); + } + + y = font_height; + g.SetLineAttributes(0, LineOnOffDash); + XSetDashes(stddpy, g, 0, "\001\001", 2); + for (j = 0; j < nr_rows && (unsigned)y < h; j++) + { + y += font_height; + XDrawLine(stddpy, ID(), g, 0, y, w, y); + } + + // Draw the header + + g.SetFont(header_font); + x = 2; // small margin + for (i = 0; i < nr_columns; i++) + { + if ((char *)(Head[i].title)) + { + XDrawString(stddpy, ID(), g, x, 15, Head[i].title, ~Head[i].title); + } + x += Head[i].width; + } + + // Draw the cells, depending on the scroll position. + + g.SetFont(cell_font); + y = 35; + for (i = *Vscroll; i < nr_rows && (unsigned)y < h; i++) + { + x = 2; + for (j = 0; j < nr_columns; j++) + { + XClearArea(stddpy, ID(), x, y - 14, Head[j].width - 2, + font_height -2, False); + if (i == selected_row) + { + XFillRectangle(stddpy, ID(), g, x, y - 14, Head[j].width - 2, + font_height -2); + g.SetForeground(stddpy.White()); + } + if ((char *)(Cells[i][j])) + { + int text_x, text_width; + + text_width = cell_font.TextWidth(Cells[i][j]); + switch (Head[j].alignment) + { + case Left: + text_x = x; + break; + case Center: + text_x = x + (Head[j].width - text_width) / 2; + break; + case Right: + text_x = x + Head[j].width - text_width - 4; + break; + } + XDrawString(stddpy, ID(), g, text_x, y, Cells[i][j], ~Cells[i][j]); + } + g.SetForeground(stddpy.Black()); + x += Head[j].width; + } + y += font_height; + } +} + +int table_view::EV_ButtonPress(XButtonEvent ev) +{ + unsigned font_height = 20; // Should be obtained from cell_font + int selected; + + if ((unsigned)ev.y > font_height) + { + // Below the header + + selected = (ev.y - font_height) / font_height + *Vscroll; + if (selected < nr_rows) + { + selected_row = selected; + redraw(); + ParentMessage(TABLE_ROW_SELECT); + } + } + return 1; +} + +void table_view::ChildMessage(win_message &msg) +{ + if (msg.msg_id == SCROLL_POSITIONED) + { + redraw(); + } +} + diff --git a/src/table.h b/src/table.h new file mode 100644 index 0000000..226f94a --- /dev/null +++ b/src/table.h @@ -0,0 +1,190 @@ +/************************************************************************** +** (c) Copyright 1999, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : table.h +** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : Definition of table_view class +** +** EXPORTED OBJECTS : class table_view +** LOCAL OBJECTS : +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Aug 26, 1999 +** LAST UPDATE : Aug 26, 1999 +** MODIFICATIONS : +**************************************************************************/ + +/***************************** + $Log: table.h,v $ + Revision 1.1 2002-07-25 08:01:27 arjen + First checkin, AXE release 0.2 + +*****************************/ + +/* static const char *RCSID = "$Id: table.h,v 1.1 2002-07-25 08:01:27 arjen Exp $"; */ + +#include "String.h" +#include "scroll.h" + +/* +/////////////////////////////////////////////////////////////////////////// +// NAME : table_view +// BASECLASS : window +// MEMBERS : +// OPERATORS : +// METHODS : +// +// DESCRIPTION : +// +// RELATIONS : +// SEE ALSO : +// LAST MODIFIED : Aug 26, 1999 +/////////////////////////////////////////////////////////////////////////// +*/ + +class table_view : public window +{ + + struct header + { + String title; + hor_alignment alignment; + int width; + }; + + header *Head; + String **Cells; + + int nr_rows, nr_columns; + + int selected_row; + + scrollbar *Vscroll; + font header_font, cell_font; + gc g; + +public: + + table_view(window &parent, int rows, int columns) + : window(parent) + { + int i; + + Vscroll = new scrollbar(*this, 120, 260, 16); + + Head = new header[columns]; + Cells = new String * [rows]; + for (i = 0; i < rows; i++) + { + Cells[i] = new String[columns]; + } + + for (i = 0; i < columns; i++) + { + Head[i].alignment = Left; + Head[i].width = 80; + } + nr_rows = rows; + nr_columns = columns; + selected_row = -1; + + g.Create(); + g.SetForeground(Black); + g.SetBackground(stddpy.White()); + header_font.Load("6x13bold"); + cell_font.Load("6x13"); + SelectInput(ExposureMask | ButtonPressMask, 1); + } + + ~table_view() + { + delete Vscroll; + delete [] Head; + for (int i = 0; i < nr_rows; i++) + { + delete [] Cells[i]; + } + delete [] Cells; + } + + void recreate(int rows) + { + int i; + + for (i = 0; i < nr_rows; i++) + { + delete [] Cells[i]; + } + delete [] Cells; + + nr_rows = rows; + Cells = new String * [nr_rows]; + for (i = 0; i < nr_rows; i++) + { + Cells[i] = new String[nr_columns]; + } + selected_row = -1; + Vscroll->move_slider(-*Vscroll); + Clear(); + redraw(); + } + + // Provide access to the cells of the table + + String & head(int col) + { + return Head[col].title; + } + + String & cell(int row, int col) + { + return Cells[row][col]; + } + + int selected(void) + { + return selected_row; + } + + void top_row(int row_nr) + { + Vscroll->move_slider(row_nr - *Vscroll); + } + + int top_row() + { + return int(*Vscroll); + } + + // Functions for layout control + + void align(int col, hor_alignment al) + { + Head[col].alignment = al; + } + + int & width(int col) + { + return Head[col].width; + } + + virtual void redraw(); + + virtual int EV_Expose(XExposeEvent ev) + { + redraw(); + return 1; + } + + virtual int EV_ButtonPress(XButtonEvent); + + virtual void ChildMessage(win_message &msg); +}; + diff --git a/src/xappl.cpp b/src/xappl.cpp new file mode 100644 index 0000000..684bbba --- /dev/null +++ b/src/xappl.cpp @@ -0,0 +1,280 @@ +/************************************************************************** +** (c) Copyright 1998, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : xappl.cpp +** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : Implementation of xapplication class +** +** EXPORTED OBJECTS : +** LOCAL OBJECTS : +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Feb 06, 1998 +** LAST UPDATE : Feb 22, 1998 +** MODIFICATIONS : +**************************************************************************/ + +/***************************** + $Log: xappl.cpp,v $ + Revision 1.1 2002-07-25 08:01:27 arjen + First checkin, AXE release 0.2 + +*****************************/ + +static const char *RCSID = "$Id: xappl.cpp,v 1.1 2002-07-25 08:01:27 arjen Exp $"; + +#include "xappl.h" + +#include + +static char dim_bits[] = +{ + 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA +}; + +#include "nopicture.xpm" + +xapplication *XApp; +display stddpy; + +color menu_normal("light grey"), menu_highlight("slate grey"); +color inside_3D(0xB000, 0xC000, 0xD000), + light_rim_3D(0xEF00, 0xF000, 0xFFFF), + dark_rim_3D(0x7000, 0x8000, 0x9000); +color Black("black"), White("white"); +color _Red("red"), _Green("green"); + +font default_font("variable"); +font fixed("fixed"); + +cursor hand_cursor(XC_hand1); +cursor text_cursor(XC_xterm); +cursor busy_cursor(XC_watch); + +stipple dim_pattern(dim_bits, 8, 8); + +gc menu_normal_gc(default_font, Black); +gc menu_dimmed_gc(default_font, Black, dim_pattern); +gc inside_3D_gc(inside_3D), + light_3D_gc(light_rim_3D), dark_3D_gc(dark_rim_3D); + +gc red_gc(default_font, _Red), green_gc(default_font, _Green); +gc white_gc(White); + +gc text_normal_gc(fixed, Black); +gc edit_cursor_gc(fixed, Black); + +pixmap nopicture(nopicture_xpm); + +xapplication::xapplication() +{ + XApp = this; + Pgrab_window = None; + +} + +void xapplication::add_window(XID w_id, window *w_ptr) +{ + wintab.xh_add(w_id, w_ptr); +} + +void xapplication::remove_window(XID w_id) +{ + wintab.xh_del(w_id); +} + +void xapplication::Pgrab(window *w_ptr) +{ + Pgrab_window = w_ptr; +} + +void xapplication::Topwin(managed_window *w_ptr) +{ + Top_window = w_ptr; +} + +/*========================================================================= +** NAME : +** SYNOPSIS : +** PARAMETERS : +** RETURN VALUE : +** +** DESCRIPTION : +** +** VARS USED : +** VARS CHANGED : +** FUNCTIONS USED : +** SEE ALSO : +** LAST MODIFIED : +**========================================================================= +*/ + +void xapplication::Initialize(void) +{ + XSetFont(stddpy, stddpy.gc(), default_font); + edit_cursor_gc.SetFunction(GXxor); + edit_cursor_gc.SetForeground(stddpy.Black() ^ stddpy.White()); +} + +/*========================================================================= +** NAME : +** SYNOPSIS : +** PARAMETERS : +** RETURN VALUE : +** +** DESCRIPTION : +** +** VARS USED : +** VARS CHANGED : +** FUNCTIONS USED : +** SEE ALSO : +** LAST MODIFIED : +**========================================================================= +*/ + +void xapplication::ParseArguments(int argc, char *argv[]) +{ +} + +void xapplication::SetupResources(void) +{ +} + +void xapplication::UserInit(void) +{ +} + +void xapplication::Cleanup(void) +{ +} + +int xapplication::DoCommand(int code) +{ + return 1; +} + +int xapplication::DispatchEvent(XEvent ev) +{ + window *target_win; + int go_on; + + target_win = wintab[ev.xany.window]; + + switch (ev.type) + { + case Expose: + go_on = target_win->EV_Expose(ev.xexpose); + break; + + case NoExpose: + go_on = target_win->EV_NoExpose(ev.xnoexpose); + break; + + case KeyPress: + go_on = target_win->EV_KeyPress(ev.xkey); + break; + + case ButtonPress: + if (Pgrab_window == None || target_win->SelectInput() & GrabPointerMask) + go_on = target_win->EV_ButtonPress(ev.xbutton); + else + go_on = Pgrab_window->EV_ButtonPress(ev.xbutton); + break; + + case ButtonRelease: + if (Pgrab_window == None || target_win->SelectInput() & GrabPointerMask) + go_on = target_win->EV_ButtonRelease(ev.xbutton); + else + go_on = Pgrab_window->EV_ButtonRelease(ev.xbutton); + break; + + case MotionNotify: + go_on = target_win->EV_MotionNotify(ev.xmotion); + break; + + case EnterNotify: + go_on = target_win->EV_EnterNotify(ev.xcrossing); + break; + + case LeaveNotify: + go_on = target_win->EV_LeaveNotify(ev.xcrossing); + break; + + case FocusOut: + go_on = target_win->EV_FocusOut(ev.xfocus); + break; + + case FocusIn: + go_on = target_win->EV_FocusIn(ev.xfocus); + break; + + case ConfigureNotify: + go_on = target_win->EV_ConfigureNotify(ev.xconfigure); + break; + + case ClientMessage: + go_on = target_win->EV_ClientMessage(ev.xclient); + break; + + default: + go_on = target_win->EV_Default(ev); + break; + } + + return go_on; +} + + +int xapplication::SendCommand(int code) +{ + int result; + + result = Top_window->DoCommand(code); + if (result < 0) + { + result = DoCommand(code); + } + + return result; +} + +/*========================================================================= +** NAME : +** SYNOPSIS : +** PARAMETERS : +** RETURN VALUE : +** +** DESCRIPTION : +** +** VARS USED : +** VARS CHANGED : +** FUNCTIONS USED : +** SEE ALSO : +** LAST MODIFIED : +**========================================================================= +*/ + +int main(int argc, char *argv[]) +{ + XEvent ev; + + XApp->Initialize(); + XApp->ParseArguments(argc, argv); + XApp->SetupResources(); + XApp->UserInit(); + + do + { + stddpy >> ev; + } + while (XApp->DispatchEvent(ev)); +}; + + diff --git a/src/xappl.h b/src/xappl.h new file mode 100644 index 0000000..189b71e --- /dev/null +++ b/src/xappl.h @@ -0,0 +1,296 @@ +/************************************************************************** +** (c) Copyright 1998, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : xappl.h +** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : Definition of xapplication class +** +** EXPORTED OBJECTS : class xapplication +** LOCAL OBJECTS : class xw_list, class xw_hash +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Feb 06, 1998 +** LAST UPDATE : Feb 23, 1998 +** MODIFICATIONS : +**************************************************************************/ + +/***************************** + $Log: xappl.h,v $ + Revision 1.1 2002-07-25 08:01:27 arjen + First checkin, AXE release 0.2 + +*****************************/ + +/* static const char *RCSID = "$Id: xappl.h,v 1.1 2002-07-25 08:01:27 arjen Exp $"; */ + +#ifndef XAPPL_H +#define XAPPL_H + +#include +#include "display.h" +#include "xwindow.h" +#include "cursor.h" + +/* +/////////////////////////////////////////////////////////////////////////// +// NAME : xw_list +// BASECLASS : +// MEMBERS : id : X id of the window +// win : Pointer to the window object +// next : Pointer to next xw_list +// OPERATORS : +// METHODS : xw_list(XID, window *, xw_list *) +// Insert at the start of the list. +// +// DESCRIPTION : Linked list of X-Window ID and window pointers. +// Is used in the hash table of windows. +// +// RELATIONS : +// SEE ALSO : xw_hash +// LAST MODIFIED : Feb 07, 1998 +/////////////////////////////////////////////////////////////////////////// +*/ + +class xw_list +{ +public: + XID id; + window *win; + xw_list *next; + + xw_list(XID win_id, window *win_ptr, xw_list *list) + { + id = win_id; + win = win_ptr; + next = list; + } +}; + + +/* +/////////////////////////////////////////////////////////////////////////// +// NAME : xw_hash +// BASECLASS : +// MEMBERS : tabsize : Size of the hash table. +// table : Array of xw_list entries. +// OPERATORS : window * [XID] +// METHODS : xw_hash(unsigned size) +// Create a hash table of specific size. +// xh_add(XID, window *) +// Add a new entry to the hash table. +// xh_del(XID) +// Delete an entry from the hash table. +// +// DESCRIPTION : The hash table associates a window's XID with a pointer +// to the window object. The xapplication object uses the +// hash table for dispatching events to windows. +// +// Each entry in the hash table, a xw_list pointer, is +// a linked list of these ID-pointer associations. The hash +// function is a simple modulo. +// +// RELATIONS : xw_list +// SEE ALSO : xapplication +// LAST MODIFIED : Feb 08, 1998 +/////////////////////////////////////////////////////////////////////////// +*/ + +class xw_hash +{ + xw_list **table; // The actual hash table. + unsigned tabsize; // Nr. of entries in the hash table. + + unsigned Hash(XID win) + { + return win % tabsize; + } + +public: + + xw_hash() + { + tabsize = 100; + + table = new (xw_list *)[tabsize]; + for (unsigned i=0; i < tabsize; i++) + { + table[i] = 0; + } + } + + xw_hash(unsigned size) + { + tabsize = size; + + table = new (xw_list *)[size]; + for (unsigned i=0; i < tabsize; i++) + { + table[i] = 0; + } + } + + ~xw_hash() + { + delete[] table; + } + + // Add a new entry in the hash table. + + void xh_add(XID win_id, window *win_ptr) + { + unsigned h; // The hash value; + + h = Hash(win_id); + table[h] = new xw_list(win_id, win_ptr, table[h]); + } + + // Delete an entry from the hash table. + + void xh_del(XID win_id) + { + unsigned h; // The hash value; + xw_list *entry; // The one we want to remove. + xw_list *previous; // The one just before entry. + + h = Hash(win_id); + + // find the window's entry in the list. + previous = 0; + entry = table[h]; + while (entry && entry->id != win_id) + { + previous = entry; + entry = entry->next; + } + + if (previous) + { + // Re-link the list, thus excluding entry. + previous->next = entry->next; + } + else + { + // It was the first entry. + table[h] = entry->next; + } + delete entry; + } + + window * operator[](XID win_id) + { + unsigned h; // The hash value; + xw_list *entry; + + h = Hash(win_id); + for (entry = table[h]; entry && entry->id != win_id; entry = entry->next); + if (entry) + { + return entry->win; + } + else + { + return 0; + } + } +}; + + +/* +/////////////////////////////////////////////////////////////////////////// +// NAME : xapplication +// BASECLASS : +// MEMBERS : wintab : The table of maintained windows. +// OPERATORS : +// METHODS : Initialize +// ParseArguments +// SetupResources +// UserInit +// DispatchEvent +// Cleanup +// add_window +// remove_window +// +// DESCRIPTION : Each X Windows application MUST have one object of a +// class derived from xapplication. +// The xapplication class implements the main thread of +// control: initialization, event-loop and termination. +// It maintains a list of all windows that are created by +// the application. +// +// RELATIONS : xw_hash +// SEE ALSO : +// LAST MODIFIED : Feb 23, 1998 +/////////////////////////////////////////////////////////////////////////// +*/ + +class xapplication +{ + xw_hash wintab; + + window *Pgrab_window; + + managed_window *Top_window; + +public: + + xapplication(); + + virtual ~xapplication() {} + + void add_window(XID w_id, window *w_ptr); + + void remove_window(XID w_id); + + void Pgrab(window *w_ptr); + void Topwin(managed_window *w_ptr); + + virtual void Initialize(void); + + virtual void ParseArguments(int argc, char *argv[]); + + virtual void SetupResources(void); + + virtual void UserInit(void); + + virtual int DoCommand(int code); + + virtual void Cleanup(void); + + int DispatchEvent(XEvent ev); + int SendCommand(int code); + +}; + +extern xapplication *XApp; + +extern color Black, White; +extern color menu_normal, menu_highlight; +extern color inside_3D, light_rim_3D, dark_rim_3D; + +extern font default_font; +extern font fixed; + +extern stipple dim_pattern; + +extern cursor hand_cursor; +extern cursor text_cursor; +extern cursor busy_cursor; + +extern gc menu_normal_gc; +extern gc menu_dimmed_gc; +extern gc inside_3D_gc, light_3D_gc, dark_3D_gc; +extern gc red_gc, green_gc; +extern gc white_gc; +extern gc text_normal_gc; +extern gc edit_cursor_gc; + +extern pixmap nopicture; + +#endif /* XAPPL_H */ diff --git a/src/xtest.cpp b/src/xtest.cpp new file mode 100644 index 0000000..ef89524 --- /dev/null +++ b/src/xtest.cpp @@ -0,0 +1,35 @@ + +#include "Xclass.h" + +main() +{ + window w(100,100,400,400); + XEvent ev; + + window subw(w, 25, 25, 350, 350); + w++; + subw++; + stddpy >> ev; + + point p1(10,40), p2(225,225); + subw << p1 << p2; + + subw.foreground(6); + + line l(p1, p2); + l[2] = point(125,345); + subw << l; + + rectangle r(p1,p2); + subw.foreground(2); + subw << r; + + text t(20,25,"Some text"); + subw.foreground(4); + subw << t; + + // XFlush(stddpy.Dpy()); + while (ev.type != ButtonPress) + stddpy >> ev; +} + diff --git a/src/xwindow.cpp b/src/xwindow.cpp new file mode 100644 index 0000000..e4c68a6 --- /dev/null +++ b/src/xwindow.cpp @@ -0,0 +1,521 @@ +/************************************************************************** +** (c) Copyright 1998, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : xwindow.cpp +** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : Implementation of the window class +** +** EXPORTED OBJECTS : +** LOCAL OBJECTS : +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Feb 06, 1998 +** LAST UPDATE : Feb 09, 1998 +** MODIFICATIONS : +**************************************************************************/ + +/***************************** + $Log: xwindow.cpp,v $ + Revision 1.1 2002-07-25 08:01:27 arjen + First checkin, AXE release 0.2 + +*****************************/ + +static const char *RCSID = "$Id: xwindow.cpp,v 1.1 2002-07-25 08:01:27 arjen Exp $"; + +#include "xappl.h" /* Includes xwindow.h */ + +#include + + +/*========================================================================= +** NAME : +** SYNOPSIS : +** PARAMETERS : +** RETURN VALUE : +** +** DESCRIPTION : +** +** VARS USED : +** VARS CHANGED : +** FUNCTIONS USED : +** SEE ALSO : +** LAST MODIFIED : +**========================================================================= +*/ + +window::window(int x, int y, unsigned int _w, unsigned int _h, int bw) +{ + w = _w; + h = _h; + + parent = 0; + children = 0; + + win_id = XCreateSimpleWindow(stddpy.Dpy(), stddpy.Root(), + x, y, w, h, bw, + stddpy.Black(), stddpy.White()); + + selection_mask = 0; + + XApp->add_window(win_id, this); +} + + +/*========================================================================= +** NAME : +** SYNOPSIS : +** PARAMETERS : +** RETURN VALUE : +** +** DESCRIPTION : +** +** VARS USED : +** VARS CHANGED : +** FUNCTIONS USED : +** SEE ALSO : +** LAST MODIFIED : +**========================================================================= +*/ + +window::window(window &parentw, int x, int y, + unsigned int _w, unsigned int _h, int bw) +{ + w = _w; + h = _h; + + parent = &parentw; + children = 0; + parentw.add_child(this); + + win_id = XCreateSimpleWindow(stddpy.Dpy(), parentw.win_id, + x, y, w, h, bw, + stddpy.Black(), stddpy.White()); + + selection_mask = 0; + + XApp->add_window(win_id, this); +} + + +/*========================================================================= +** NAME : +** SYNOPSIS : +** PARAMETERS : +** RETURN VALUE : +** +** DESCRIPTION : +** +** VARS USED : +** VARS CHANGED : +** FUNCTIONS USED : +** SEE ALSO : +** LAST MODIFIED : +**========================================================================= +*/ + +window::~window() +{ + if (parent) + { + parent->remove_child(this); + } + + XDestroyWindow(stddpy.Dpy(), win_id); + + XApp->remove_window(win_id); +} + + + +/*========================================================================= +** NAME : add_child - Add subwindow in the list +** SYNOPSIS : +** PARAMETERS : +** RETURN VALUE : +** +** DESCRIPTION : +** +** VARS USED : +** VARS CHANGED : +** FUNCTIONS USED : +** SEE ALSO : +** LAST MODIFIED : +**========================================================================= +*/ + +void window::add_child(window *ch) +{ + win_list *l; + + l = new win_list; + + l->next = children; + l->child = ch; + children = l; +} + +/*========================================================================= +** NAME : remove_child - Remove subwindow from the list +** SYNOPSIS : +** PARAMETERS : +** RETURN VALUE : +** +** DESCRIPTION : +** +** VARS USED : +** VARS CHANGED : +** FUNCTIONS USED : +** SEE ALSO : +** LAST MODIFIED : +**========================================================================= +*/ + +void window::remove_child(window *ch) +{ + win_list *l = 0, *prev = 0; + + l = children; + while (l && l->child != ch) + { + prev = l; + l = l->next; + } + + // If l would be NULL, the child window would not be in + // it's parent's list of children. This can not happen ! + + if (prev) + { + prev->next = l->next; + } + else + { + children = l->next; + } + + delete l; +} + +/*========================================================================= +** NAME : EV_Expose +** SYNOPSIS : int window::EV_Expose(XExposeEvent ev) +** PARAMETERS : +** RETURN VALUE : 0 if the application should quit +** +** DESCRIPTION : Event handling functions. +** Most of the event handling functions are empty. +** Derived classes of window should override these functions +** to implement speecific behavior. +** +** VARS USED : +** VARS CHANGED : +** FUNCTIONS USED : +** SEE ALSO : +** LAST MODIFIED : +**========================================================================= +*/ + +int window::EV_Expose(XExposeEvent ev) +{ + return 1; +} + +int window::EV_NoExpose(XNoExposeEvent ev) +{ + return 1; +} + +int window::EV_KeyPress(XKeyEvent ev) +{ + return 1; +} + +int window::EV_KeyRelease(XKeyEvent ev) +{ + return 1; +} + +int window::EV_ButtonPress(XButtonEvent ev) +{ + return 1; +} + +int window::EV_ButtonRelease(XButtonEvent ev) +{ + return 1; +} + +int window::EV_MotionNotify(XMotionEvent ev) +{ + return 1; +} + +int window::EV_EnterNotify(XCrossingEvent ev) +{ + return 1; +} + +int window::EV_LeaveNotify(XCrossingEvent ev) +{ + return 1; +} + +int window::EV_FocusIn(XFocusChangeEvent ev) +{ + return 1; +} + +int window::EV_FocusOut(XFocusChangeEvent ev) +{ + return 1; +} + + +/*========================================================================= +** NAME : EV_ConfigureNotify - Handle Configure event +** SYNOPSIS : +** PARAMETERS : +** RETURN VALUE : +** +** DESCRIPTION : Handles the event where the window is moved relative +** to its parent, resized or restacked. +** The default handler calls ParentResized for all of its +** children. The subwindows usually react by fitting their +** size to the size of the parent. +** +** VARS USED : +** VARS CHANGED : +** FUNCTIONS USED : +** SEE ALSO : +** LAST MODIFIED : Feb 10, 1998 +**========================================================================= +*/ + +int window::EV_ConfigureNotify(XConfigureEvent ev) +{ + win_list *l; + + w = ev.width; + h = ev.height; + + for (l = children; l; l = l->next) + { + l->child->ParentResized(ev.width, ev.height); + } + return 1; +} + +int window::EV_ClientMessage(XClientMessageEvent ev) +{ + return 1; +} + +int window::ParentResized(int w, int h) +{ + // stub + + return 1; +} + +/* Event names. Used in "type" field in XEvent structures. Not to be +confused with event masks above. They start from 2 because 0 and 1 +are reserved in the protocol for errors and replies. */ + +static char * event_names[] = +{ + " Undefined(0)", + " Undefined(1)", + " KeyPress", + " KeyRelease", + " ButtonPress", + " ButtonRelease", + " MotionNotify", + " EnterNotify", + " LeaveNotify", + " FocusIn", + " FocusOut", + " KeymapNotify", + " Expose", + " GraphicsExpose", + " NoExpose", + " VisibilityNotify", + " CreateNotify", + " DestroyNotify", + " UnmapNotify", + " MapNotify", + " MapRequest", + " ReparentNotify", + " ConfigureNotify", + " ConfigureRequest", + " GravityNotify", + " ResizeRequest", + " CirculateNotify", + " CirculateRequest", + " PropertyNotify", + " SelectionClear", + " SelectionRequest", + " SelectionNotify", + " ColormapNotify", + " ClientMessage", + " MappingNotify" +}; + +int window::EV_Default(XEvent ev) +{ + return 1; +} + +void window::ChildMessage(win_message &msg) +{ +} + +void window::ParentMessage(int id) +{ + win_message msg; + + + msg.msg_id = id; + msg.from = this; + + parent->ChildMessage(msg); +} + +void window::Resize(unsigned width, unsigned height) +{ + w = width; + h = height; + + XResizeWindow(stddpy.Dpy(), win_id, w, h); +} + +void window::Resize(size sz) +{ + w = sz.w; + h = sz.h; + + XResizeWindow(stddpy.Dpy(), win_id, w, h); +} + +void window::Move(int x, int y) +{ + XMoveWindow(stddpy, win_id, x, y); +} + +/*========================================================================= +** NAME : Background +** SYNOPSIS : void window::Background(unsigned long pixel) +** PARAMETERS : +** RETURN VALUE : +** +** DESCRIPTION : Set the pixel value of the window's background color +** +** VARS USED : +** VARS CHANGED : +** FUNCTIONS USED : +** SEE ALSO : +** LAST MODIFIED : +**========================================================================= +*/ + +void window::Background(unsigned long pixel) +{ + XSetWindowAttributes attrib; + + attrib.background_pixel = pixel; + XChangeWindowAttributes(stddpy.Dpy(), win_id, CWBackPixel, &attrib); +} + +void window::WindowGravity(int gravity) +{ + XSetWindowAttributes attrib; + + attrib.win_gravity = gravity; + XChangeWindowAttributes(stddpy.Dpy(), win_id, CWWinGravity, &attrib); +} + +void window::Clear(void) +{ + XClearWindow(stddpy.Dpy(), win_id); +} + +/*========================================================================= +** NAME : SelectInput - Turn events on or off. +** SYNOPSIS : long window::SelectInput(long events, int on) +** PARAMETERS : events : Bitwise OR of event masks +** on : 0 - Events off; 1 - Events on +** RETURN VALUE : The new event selection mask +** +** DESCRIPTION : +** +** VARS USED : +** VARS CHANGED : +** FUNCTIONS USED : +** SEE ALSO : +** LAST MODIFIED : +**========================================================================= +*/ + +long window::SelectInput(long events, int on) +{ + if (on) + { + selection_mask |= events; + } + else + { + selection_mask &= ~events; + } + + XSelectInput(stddpy.Dpy(), win_id, selection_mask); + + return selection_mask; +} + +int window::GrabPointer(Cursor curs) +{ + int status; + + status = XGrabPointer(stddpy, win_id, True, + ButtonPressMask|ButtonReleaseMask|EnterWindowMask|LeaveWindowMask, + GrabModeAsync, GrabModeAsync, None, curs, CurrentTime); + XApp->Pgrab(this); + + return status; +} + +int window::UngrabPointer(void) +{ + int status; + + status = XUngrabPointer(stddpy, CurrentTime); + XApp->Pgrab(None); + + return status; +} + +int managed_window::EV_FocusIn(XFocusChangeEvent ev) +{ + XApp->Topwin(this); + + return 1; +} + +int managed_window::EV_ClientMessage(XClientMessageEvent ev) +{ + if (ev.message_type == XInternAtom(stddpy, "WM_PROTOCOLS", True)) + { + if (ev.data.l[0] == XInternAtom(stddpy, "WM_DELETE_WINDOW", True)) + { + return XApp->SendCommand(WM_Delete_Command); + } + } + return 1; +} diff --git a/src/xwindow.h b/src/xwindow.h new file mode 100644 index 0000000..36f8e42 --- /dev/null +++ b/src/xwindow.h @@ -0,0 +1,382 @@ +/************************************************************************** +** (c) Copyright 1998, Andromeda Technology & Automation +*************************************************************************** +** MODULE INFORMATION * +*********************** +** FILE NAME : xwindow.h +** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation +** VERSION NUMBER : $Revision: 1.1 $ +** +** DESCRIPTION : Definition of the window class +** +** EXPORTED OBJECTS : class window +** LOCAL OBJECTS : +** MODULES USED : +*************************************************************************** +** ADMINISTRATIVE INFORMATION * +******************************** +** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl +** CREATION DATE : Feb 06, 1998 +** LAST UPDATE : Jul 28, 2000 +** MODIFICATIONS : +**************************************************************************/ + +/***************************** + $Log: xwindow.h,v $ + Revision 1.1 2002-07-25 08:01:27 arjen + First checkin, AXE release 0.2 + +*****************************/ + +/* static const char *RCSID = "$Id: xwindow.h,v 1.1 2002-07-25 08:01:27 arjen Exp $"; */ + +#ifndef AXE_XWINDOW_H +#define AXE_XWINDOW_H + +#include +#include +#include "geometry.h" +#include "gc.h" +#include "pixmap.h" +#include "String.h" + +#define GrabPointerMask (1L << 25) + +/* +/////////////////////////////////////////////////////////////////////////// +// NAME : window +// BASECLASS : +// MEMBERS : win_id : X server id of the window +// children : Linked list of child windows. +// parent : The parent window (0 if main window) +// selection_mask : Mask of selected events. +// OPERATORS : +// METHODS : +// +// DESCRIPTION : A window object encapsulates a window on the X workstation. +// A window is a rectangular area on the screen, used +// for graphical output. Input from mouse and keyboard +// is handled by event-handling functions in a window. +// +// RELATIONS : +// SEE ALSO : xapplication +// LAST MODIFIED : Feb 13, 1998 +/////////////////////////////////////////////////////////////////////////// +*/ + +class window; + + struct win_list + { + window *child; + win_list *next; + }; + + + struct win_message + { + int msg_id; + window *from; + }; + +class window +{ + XID win_id; + + unsigned w, h; // Size of the window + + long selection_mask; + + void add_child(window *ch); + void remove_child(window *ch); + +protected: + + window *parent; + +public: + + win_list *children; + XID ID() + { + return win_id; + } + + // Event handlers + + virtual int EV_Expose(XExposeEvent); + virtual int EV_NoExpose(XNoExposeEvent); + virtual int EV_KeyPress(XKeyEvent); + virtual int EV_KeyRelease(XKeyEvent); + virtual int EV_ButtonPress(XButtonEvent); + virtual int EV_ButtonRelease(XButtonEvent); + virtual int EV_MotionNotify(XMotionEvent); + virtual int EV_EnterNotify(XCrossingEvent); + virtual int EV_LeaveNotify(XCrossingEvent); + virtual int EV_FocusIn(XFocusChangeEvent); + virtual int EV_FocusOut(XFocusChangeEvent); + virtual int EV_ConfigureNotify(XConfigureEvent); + virtual int EV_ClientMessage(XClientMessageEvent); + + virtual int ParentResized(int w, int h); + + virtual void ChildMessage(win_message &msg); + + void ParentMessage(int id); + + int EV_Default(XEvent); + + window(int x=0, int y=0, unsigned w=320, unsigned h=256, int bw = 4); + window(window &, int x=0, int y=0, + unsigned int w=100, unsigned int h=100, int bw = 1); + virtual ~window(); + + // Mapping and unmapping + + void Map(void) + { + XMapWindow(stddpy.Dpy(), win_id); + } + + void Realize(void) + { + XMapSubwindows(stddpy, win_id); + XMapRaised(stddpy, win_id); + } + + void Unmap(void) + { + XUnmapWindow(stddpy.Dpy(), win_id); + } + + // Size and position + + void Size(unsigned &width, unsigned &height) + { + width = w; + height = h; + } + + size Size(void) + { + return size(w, h); + } + + void Resize(unsigned width, unsigned height); + void Resize(size sz); + void Move(int x, int y); + + // Border and background + + void Border(unsigned int borderwidth) + { + XSetWindowBorderWidth(stddpy, win_id, borderwidth); + } + + void Background(unsigned long pixel); + void WindowGravity(int gravity); + void Clear(void); + + long SelectInput(long events, int on); + long SelectInput(void) + { + return selection_mask; + } + + void SetFocus(void) + { + XSetInputFocus(stddpy, win_id, RevertToPointerRoot, CurrentTime); + } + + int GrabPointer(Cursor curs); + int UngrabPointer(void); + void DefineCursor(Cursor curs) + { + XDefineCursor(stddpy, ID(), curs); + } + void UndefineCursor(void) + { + XUndefineCursor(stddpy, ID()); + } + + // Graphic drawing functions + + void DrawString(const gc &graphic, int x, int y, String str) const + { + XDrawString(stddpy, win_id, graphic, x, y, str, ~str); + } + + void DrawString(const gc &graphic, point p, String str) const + { + XDrawString(stddpy, win_id, graphic, p.x, p.y, str, ~str); + } + + void DrawLine(const gc &graphic, int x1, int y1, int x2, int y2) const + { + XDrawLine(stddpy, win_id, graphic, x1, y1, x2, y2); + } + + void DrawLine(const gc &graphic, point p1, point p2) const + { + XDrawLine(stddpy, win_id, graphic, p1.x, p1.y, p2.x, p2.y); + } + + void DrawLine(const gc &graphic, std::vector &l, int mode = CoordModeOrigin) const + { + int npoints = l.size(); + XPoint *points = new XPoint[npoints]; + + for (int i = 0; i < npoints; i++) + { + points[i].x = l[i].x; + points[i].y = l[i].y; + } + + XDrawLines(stddpy, win_id, graphic, points, npoints, mode); + } + + void FillPolygon(const gc &graphic, std::vector &l, + int mode = CoordModeOrigin, int shape = Complex) const + { + int npoints = l.size(); + XPoint *points = new XPoint[npoints]; + + for (int i = 0; i < npoints; i++) + { + points[i].x = l[i].x; + points[i].y = l[i].y; + } + + XFillPolygon(stddpy, win_id, graphic, points, npoints, shape, mode); + } + + void DrawRectangle(const gc &graphic, point p, size s) const + { + XDrawRectangle(stddpy, win_id, graphic, p.x, p.y, s.w, s.h); + } + + void DrawRectangle(const gc &graphic, int x, int y, unsigned w, unsigned h) const + { + XDrawRectangle(stddpy, win_id, graphic, x, y, w, h); + } + + void DrawRectangle(const gc &graphic, rectangle r) const + { + DrawRectangle(graphic, r.Origin(), r.Size()); + } + + void DrawRectangle(const gc &graphic, point p1, point p2) const + { + DrawRectangle(graphic, rectangle(p1, p2)); + } + + void FillRectangle(const gc &graphic, point p, size s) const + { + XFillRectangle(stddpy, win_id, graphic, p.x, p.y, s.w, s.h); + } + + void FillRectangle(const gc &graphic, int x, int y, unsigned w, unsigned h) const + { + XFillRectangle(stddpy, win_id, graphic, x, y, w, h); + } + + void FillRectangle(const gc &graphic, rectangle r) const + { + FillRectangle(graphic, r.Origin(), r.Size()); + } + + void FillRectangle(const gc &graphic, point p1, point p2) const + { + FillRectangle(graphic, rectangle(p1, p2)); + } + + void DrawArc(const gc &graphic, int x, int y, unsigned w, unsigned h, + int angle1, int angle2) const + { + XDrawArc(stddpy, win_id, graphic, x, y, w, h, angle1, angle2); + } + + void FillArc(const gc &graphic, int x, int y, unsigned w, unsigned h, + int angle1, int angle2) const + { + XFillArc(stddpy, win_id, graphic, x, y, w, h, angle1, angle2); + } + + void DrawPixmap(const gc &graphic, int x, int y, const pixmap &pm) const + { + XCopyArea(stddpy, pm, win_id, graphic, 0, 0, + pm.Size().w, pm.Size().h, x, y); + } +}; + +class managed_window : public window +{ + unsigned long bg; + int WM_Delete_Command; // Command to send op 'close' button. + +public: + + managed_window() + { + WM_Delete_Command = 0; + Atom wm_delete; + + wm_delete = XInternAtom(stddpy, "WM_DELETE_WINDOW", true); + bg = 0; + + XStoreName(stddpy, ID(), "AXE Test"); + + XSetWMProtocols(stddpy, ID(),&wm_delete , 1); + + SelectInput(StructureNotifyMask, 1); + SelectInput(FocusChangeMask, 1); + + } + + managed_window(char *name) + { + WM_Delete_Command = 0; + Atom wm_delete; + + wm_delete = XInternAtom(stddpy, "WM_DELETE_WINDOW", true); + bg = 0; + + XStoreName(stddpy, ID(), name); + + XSetWMProtocols(stddpy, ID(),&wm_delete , 1); + + SelectInput(StructureNotifyMask, 1); + SelectInput(FocusChangeMask, 1); + + } + + void Title(char *name) + { + XStoreName(stddpy, ID(), name); + } + + void Command_WhenClosed(int cmd) + { + WM_Delete_Command = cmd; + } + + virtual int EV_FocusIn(XFocusChangeEvent); + virtual int EV_ClientMessage(XClientMessageEvent ev); + + virtual int DoCommand(int code) + { + return -1; + } +}; + +/* + * Predefined message id's in a win_message + */ + +#define EDIT_ENTERED 1 +#define EDIT_FOCUSLOST 2 +#define SCROLL_POSITIONED 3 +#define TABLE_ROW_SELECT 4 + +#endif /* AXE_XWINDOW_H */ +